workos 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7d48c12ff6a0a470ca2a35fb76cabf17fe9d4f2444b11811891a9ea0c81f9cda
4
- data.tar.gz: ec43b59ca57135efd145346ce14ebab1ed30341f210b3a47f8525afb907d3856
3
+ metadata.gz: c1e38af4531cb784be6a6cc834752307e8bfcf7379dde43272c0e85b762f9f56
4
+ data.tar.gz: 2de643c621a51264c255d7d8b0a55d1aa7a900f5a1b9bd49877e6f5ad9f47956
5
5
  SHA512:
6
- metadata.gz: 2068f4bd90b52d90b802eea6f1e8ebeb2a5e1b166d5256d952df40af30821bd858999813532f18e9ab44eff36f4cde40a27f423126028509fe9c12f15ef07d58
7
- data.tar.gz: 526f33fd44a2371696dc19f400461af7e170e362d7057bf04529767eae8692d12b8e56635f6b61d5b0e8c585f2275e65e62422f064bbe056645c2c0cc1cfe14f
6
+ metadata.gz: '095f641cd40934575456a19cdf4dc5714d010555680d18b98f599467bafaf57b78f6f90988d064f53611f6d95bb7daa6e1ebdea450a7e7a03f43637026856a7b'
7
+ data.tar.gz: 157928a66025475cc4b306fbcc719ea6e3fe6404006f3fb00eb6498d7d4655d18076cbe64874137ba8c301a22561752c5feb40d9158225a89797e5eff36c1503
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- workos (1.1.0)
4
+ workos (1.2.0)
5
5
  sorbet-runtime (~> 0.5)
6
6
 
7
7
  GEM
@@ -62,7 +62,7 @@ module WorkOS
62
62
  # :id=>"org_domain_01E6PK9N3XMD8RHWF7S66380AR",
63
63
  # :domain=>"foo-corp.com"}]>
64
64
  #
65
- # @return [WorkOS::Connection]
65
+ # @return [WorkOS::Organization]
66
66
  sig { params(id: String).returns(WorkOS::Organization) }
67
67
  def get_organization(id:)
68
68
  request = get_request(
@@ -125,6 +125,27 @@ module WorkOS
125
125
  WorkOS::Organization.new(response.body)
126
126
  end
127
127
 
128
+ # Delete an Organization
129
+ #
130
+ # @param [String] id Organization unique identifier
131
+ #
132
+ # @example
133
+ # WorkOS::SSO.delete_organization(id: 'org_01EHZNVPK3SFK441A1RGBFSHRT')
134
+ # => true
135
+ #
136
+ # @return [Bool] - returns `true` if successful
137
+ sig { params(id: String).returns(T::Boolean) }
138
+ def delete_organization(id:)
139
+ request = delete_request(
140
+ auth: true,
141
+ path: "/organizations/#{id}",
142
+ )
143
+
144
+ response = execute_request(request: request)
145
+
146
+ response.is_a? Net::HTTPSuccess
147
+ end
148
+
128
149
  private
129
150
 
130
151
  sig { params(response: Net::HTTPResponse).void }
@@ -2,5 +2,5 @@
2
2
  # typed: strong
3
3
 
4
4
  module WorkOS
5
- VERSION = '1.1.0'
5
+ VERSION = '1.2.0'
6
6
  end
@@ -161,4 +161,31 @@ describe WorkOS::Organizations do
161
161
  end
162
162
  end
163
163
  end
164
+
165
+ describe '.delete_organization' do
166
+ context 'with a valid id' do
167
+ it 'returns true' do
168
+ VCR.use_cassette('organization/delete') do
169
+ response = described_class.delete_organization(
170
+ id: 'org_01F4A8TD0B4N1Y9SJ8SH635HDB',
171
+ )
172
+
173
+ expect(response).to be(true)
174
+ end
175
+ end
176
+ end
177
+
178
+ context 'with an invalid id' do
179
+ it 'returns false' do
180
+ VCR.use_cassette('organization/delete_invalid') do
181
+ expect do
182
+ described_class.delete_organization(id: 'invalid')
183
+ end.to raise_error(
184
+ WorkOS::APIError,
185
+ 'Status 404, Not Found - request ID: ',
186
+ )
187
+ end
188
+ end
189
+ end
190
+ end
164
191
  end
@@ -0,0 +1,72 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: delete
5
+ uri: https://api.workos.com/organizations/org_01F4A8TD0B4N1Y9SJ8SH635HDB
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ User-Agent:
17
+ - WorkOS; ruby/3.0.1; x86_64-darwin19; v1.1.0
18
+ Authorization:
19
+ - Bearer <API_KEY>
20
+ response:
21
+ status:
22
+ code: 202
23
+ message: Accepted
24
+ headers:
25
+ Server:
26
+ - Cowboy
27
+ Connection:
28
+ - keep-alive
29
+ Vary:
30
+ - Origin, Accept-Encoding
31
+ Access-Control-Allow-Credentials:
32
+ - 'true'
33
+ Content-Security-Policy:
34
+ - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
35
+ https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
36
+ ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
37
+ X-Dns-Prefetch-Control:
38
+ - 'off'
39
+ Expect-Ct:
40
+ - max-age=0
41
+ X-Frame-Options:
42
+ - SAMEORIGIN
43
+ Strict-Transport-Security:
44
+ - max-age=15552000; includeSubDomains
45
+ X-Download-Options:
46
+ - noopen
47
+ X-Content-Type-Options:
48
+ - nosniff
49
+ X-Permitted-Cross-Domain-Policies:
50
+ - none
51
+ Referrer-Policy:
52
+ - no-referrer
53
+ X-Xss-Protection:
54
+ - '0'
55
+ X-Request-Id:
56
+ -
57
+ Content-Type:
58
+ - text/plain; charset=utf-8
59
+ Content-Length:
60
+ - '8'
61
+ Etag:
62
+ - W/"8-YaBXLEiT7zQxEyDYTILfiL6oPhE"
63
+ Date:
64
+ - Mon, 24 May 2021 21:07:34 GMT
65
+ Via:
66
+ - 1.1 vegur
67
+ body:
68
+ encoding: UTF-8
69
+ string: Accepted
70
+ http_version:
71
+ recorded_at: Mon, 24 May 2021 21:07:34 GMT
72
+ recorded_with: VCR 5.0.0
@@ -0,0 +1,72 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: delete
5
+ uri: https://api.workos.com/organizations/invalid
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ User-Agent:
17
+ - WorkOS; ruby/3.0.1; x86_64-darwin19; v1.1.0
18
+ Authorization:
19
+ - Bearer <API_KEY>
20
+ response:
21
+ status:
22
+ code: 404
23
+ message: Not Found
24
+ headers:
25
+ Server:
26
+ - Cowboy
27
+ Connection:
28
+ - keep-alive
29
+ Vary:
30
+ - Origin, Accept-Encoding
31
+ Access-Control-Allow-Credentials:
32
+ - 'true'
33
+ Content-Security-Policy:
34
+ - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
35
+ https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
36
+ ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
37
+ X-Dns-Prefetch-Control:
38
+ - 'off'
39
+ Expect-Ct:
40
+ - max-age=0
41
+ X-Frame-Options:
42
+ - SAMEORIGIN
43
+ Strict-Transport-Security:
44
+ - max-age=15552000; includeSubDomains
45
+ X-Download-Options:
46
+ - noopen
47
+ X-Content-Type-Options:
48
+ - nosniff
49
+ X-Permitted-Cross-Domain-Policies:
50
+ - none
51
+ Referrer-Policy:
52
+ - no-referrer
53
+ X-Xss-Protection:
54
+ - '0'
55
+ X-Request-Id:
56
+ -
57
+ Content-Type:
58
+ - application/json; charset=utf-8
59
+ Content-Length:
60
+ - '23'
61
+ Etag:
62
+ - W/"17-SuRA/yvUWUo8rK6x7dKURLeBo+0"
63
+ Date:
64
+ - Mon, 24 May 2021 21:07:34 GMT
65
+ Via:
66
+ - 1.1 vegur
67
+ body:
68
+ encoding: UTF-8
69
+ string: '{"message":"Not Found"}'
70
+ http_version:
71
+ recorded_at: Mon, 24 May 2021 21:07:34 GMT
72
+ recorded_with: VCR 5.0.0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workos
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - WorkOS
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-24 00:00:00.000000000 Z
11
+ date: 2021-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sorbet-runtime
@@ -309,6 +309,8 @@ files:
309
309
  - spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_no_options.yml
310
310
  - spec/support/fixtures/vcr_cassettes/organization/create.yml
311
311
  - spec/support/fixtures/vcr_cassettes/organization/create_invalid.yml
312
+ - spec/support/fixtures/vcr_cassettes/organization/delete.yml
313
+ - spec/support/fixtures/vcr_cassettes/organization/delete_invalid.yml
312
314
  - spec/support/fixtures/vcr_cassettes/organization/get.yml
313
315
  - spec/support/fixtures/vcr_cassettes/organization/get_invalid.yml
314
316
  - spec/support/fixtures/vcr_cassettes/organization/list.yml
@@ -400,6 +402,8 @@ test_files:
400
402
  - spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_no_options.yml
401
403
  - spec/support/fixtures/vcr_cassettes/organization/create.yml
402
404
  - spec/support/fixtures/vcr_cassettes/organization/create_invalid.yml
405
+ - spec/support/fixtures/vcr_cassettes/organization/delete.yml
406
+ - spec/support/fixtures/vcr_cassettes/organization/delete_invalid.yml
403
407
  - spec/support/fixtures/vcr_cassettes/organization/get.yml
404
408
  - spec/support/fixtures/vcr_cassettes/organization/get_invalid.yml
405
409
  - spec/support/fixtures/vcr_cassettes/organization/list.yml