diff --git a/Gemfile.lock b/Gemfile.lock index 82b19b83..88c7ee39 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.3.0) + workos (5.4.0) GEM remote: https://rubygems.org/ diff --git a/lib/workos/organizations.rb b/lib/workos/organizations.rb index 0c7fda72..bedf28ef 100644 --- a/lib/workos/organizations.rb +++ b/lib/workos/organizations.rb @@ -131,7 +131,7 @@ def update_organization( organization:, domain_data: nil, domains: nil, - name:, + name: nil, allow_profiles_outside_organization: nil ) body = { name: name } diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 6f91fce1..17e23576 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.3.0' + VERSION = '5.4.0' end diff --git a/spec/lib/workos/organizations_spec.rb b/spec/lib/workos/organizations_spec.rb index 7754d816..bf9deb91 100644 --- a/spec/lib/workos/organizations_spec.rb +++ b/spec/lib/workos/organizations_spec.rb @@ -267,7 +267,7 @@ describe '.update_organization' do context 'with valid payload' do - it 'creates an organization' do + it 'updates the organization' do VCR.use_cassette 'organization/update' do organization = described_class.update_organization( organization: 'org_01F6Q6TFP7RD2PF6J03ANNWDKV', @@ -275,6 +275,20 @@ name: 'Test Organization', ) + expect(organization.id).to eq('org_01F6Q6TFP7RD2PF6J03ANNWDKV') + expect(organization.name).to eq('Test Organization') + expect(organization.domains.first[:domain]).to eq('example.me') + end + end + end + context 'without a name' do + it 'updates the organization' do + VCR.use_cassette 'organization/update_without_name' do + organization = described_class.update_organization( + organization: 'org_01F6Q6TFP7RD2PF6J03ANNWDKV', + domains: ['example.me'], + ) + expect(organization.id).to eq('org_01F6Q6TFP7RD2PF6J03ANNWDKV') expect(organization.name).to eq('Test Organization') expect(organization.domains.first[:domain]).to eq('example.me') diff --git a/spec/support/fixtures/vcr_cassettes/organization/update_without_name.yml b/spec/support/fixtures/vcr_cassettes/organization/update_without_name.yml new file mode 100644 index 00000000..8f8a49e5 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/organization/update_without_name.yml @@ -0,0 +1,85 @@ +--- +http_interactions: + - request: + method: put + uri: https://api.workos.com/organizations/org_01F6Q6TFP7RD2PF6J03ANNWDKV + body: + encoding: UTF-8 + string: '{"domains":["example.me"]}' + headers: + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - WorkOS; ruby/3.0.1; x86_64-darwin19; v1.4.0 + Authorization: + - Bearer + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 09 Aug 2021 21:53:34 GMT + Content-Type: + - application/json; charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Origin, Accept-Encoding + Access-Control-Allow-Credentials: + - "true" + Content-Security-Policy: + - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' + https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src + 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" + X-Dns-Prefetch-Control: + - "off" + Expect-Ct: + - max-age=0 + X-Frame-Options: + - SAMEORIGIN + Strict-Transport-Security: + - max-age=15552000; includeSubDomains + X-Download-Options: + - noopen + X-Content-Type-Options: + - nosniff + X-Permitted-Cross-Domain-Policies: + - none + Referrer-Policy: + - no-referrer + X-Xss-Protection: + - "0" + X-Request-Id: + - b8c5da9a-d1f7-470c-abbd-a2de3f2edf77 + Etag: + - W/"11a-SLpC9UGp2O5SWQr5VJZSNCpOF/Q" + Via: + - 1.1 vegur + Cf-Cache-Status: + - DYNAMIC + Report-To: + - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=jh1EtP1h1CwA2nWmx0cvFGD5NdEiga3dbTCmcQH%2BgrdDPGqko8R8mehU9ywQ%2BW1AKKTGWbmRNHiRXpVhaJTNrULEuLt9TpGVoDH0IrixJhVS4N0Czi7n2UfPL0m684giLJtD2t7EVEj1XeeLlQ%3D%3D"}],"group":"cf-nel","max_age":604800}' + Nel: + - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' + Server: + - cloudflare + Cf-Ray: + - 67c437cdde060bb8-DFW + Alt-Svc: + - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; + ma=86400 + body: + encoding: ASCII-8BIT + string: + '{"object":"organization","id":"org_01F6Q6TFP7RD2PF6J03ANNWDKV","name":"Test + Organization","allow_profiles_outside_organization":false,"created_at":"2021-05-27T15:24:25.670Z","updated_at":"2021-08-09T21:53:34.525Z","domains":[{"object":"organization_domain","id":"org_domain_01FCPEG7BAYMQ4CHMG41Y2VNHF","domain":"example.me"}]}' + http_version: + recorded_at: Mon, 09 Aug 2021 21:53:34 GMT +recorded_with: VCR 5.0.0