workos 2.16.0 → 2.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3cbb0a53c0c7c21c1d8cb22a6d3d2679421da8fbeb237009bcd31c1f679c1586
4
- data.tar.gz: 914321349e893fb0d9e7c955c6bff5c92851f5946d2f2bc278de6cad01295ae2
3
+ metadata.gz: ef5e91f45a32fca11bf7338b94c35c1c9cbc74d7193a065e2f7b4f995b40a108
4
+ data.tar.gz: 168c7c0b96de3b066845ece0fdb7c92ae37f7ba3ac8729cdc0226f22bf12442b
5
5
  SHA512:
6
- metadata.gz: 777ab4dd91a7ce30ce709dd4578018abf4cde6b1c3d213588b1d1cc0d0b5c0c503ecd79e9c8fa30ff6d8d597fcb92ca027527b46e96d93fdbbb060b916830f90
7
- data.tar.gz: 63ee003031a51bfa309e0095d2e4a6abb7caee9c6b3202efda809b7b6922a782fe04214af94a5647863bf059eca7f9228d91cdebc86e1800e3ae1caf9aeedbff
6
+ metadata.gz: 57574ab78fd8bdd0cd5e77612290c58c252b80ac7e086b7c7d60046e9688d4bf19e4ede830f4ac91f53f4400e3b25c3001322d8e83656866fece316a41c6a9ac
7
+ data.tar.gz: 7595a48e1a25602247bb684bb4d95727f8a0fdc39c27a02662f9f677335b310f980596522519e294bedabae88e460e81589c34fdf04a85bdaea544c64400f38b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- workos (2.16.0)
4
+ workos (2.17.0)
5
5
  sorbet-runtime (~> 0.5)
6
6
 
7
7
  GEM
data/lib/workos/client.rb CHANGED
@@ -9,7 +9,7 @@ module WorkOS
9
9
 
10
10
  sig { returns(Net::HTTP) }
11
11
  def client
12
- Net::HTTP.new(WorkOS::API_HOSTNAME, 443).tap do |http_client|
12
+ Net::HTTP.new(WorkOS.config.api_hostname, 443).tap do |http_client|
13
13
  http_client.use_ssl = true
14
14
  http_client.open_timeout = WorkOS.config.timeout
15
15
  http_client.read_timeout = WorkOS.config.timeout
@@ -4,7 +4,7 @@
4
4
  module WorkOS
5
5
  # Configuration class sets config initializer
6
6
  class Configuration
7
- attr_accessor :timeout, :key
7
+ attr_accessor :api_hostname, :timeout, :key
8
8
 
9
9
  def initialize
10
10
  @timeout = 60
data/lib/workos/sso.rb CHANGED
@@ -104,7 +104,7 @@ module WorkOS
104
104
  organization: organization,
105
105
  }.compact)
106
106
 
107
- "https://#{WorkOS::API_HOSTNAME}/sso/authorize?#{query}"
107
+ "https://#{WorkOS.config.api_hostname}/sso/authorize?#{query}"
108
108
  end
109
109
  # rubocop:enable Metrics/ParameterLists
110
110
 
@@ -7,6 +7,7 @@ module WorkOS
7
7
  # fixed set of values for SSO Providers.
8
8
  class Provider < T::Enum
9
9
  enums do
10
+ GitHub = new('GitHubOAuth')
10
11
  Google = new('GoogleOAuth')
11
12
  Microsoft = new('MicrosoftOAuth')
12
13
  end
@@ -2,5 +2,5 @@
2
2
  # typed: strong
3
3
 
4
4
  module WorkOS
5
- VERSION = '2.16.0'
5
+ VERSION = '2.17.0'
6
6
  end
data/lib/workos.rb CHANGED
@@ -11,10 +11,25 @@ require 'workos/configuration'
11
11
  # requests to the WorkOS API. The gem will read
12
12
  # your API key automatically from the ENV var `WORKOS_API_KEY`.
13
13
  # Alternatively, you can set the key yourself with
14
- # `WorkOS.key = [your api key]` somewhere in the load path of
15
- # your application, such as an initializer.
14
+ # `WorkOS.configure { |config| config.key = [your api key] }` somewhere
15
+ # in the load path of your application, such as an initializer.
16
16
  module WorkOS
17
- API_HOSTNAME = ENV['WORKOS_API_HOSTNAME'] || 'api.workos.com'
17
+ def self.default_config
18
+ Configuration.new.tap do |config|
19
+ config.api_hostname = ENV['WORKOS_API_HOSTNAME'] || 'api.workos.com'
20
+ # Remove WORKOS_KEY at some point in the future. Keeping it here now for
21
+ # backwards compatibility.
22
+ config.key = ENV['WORKOS_API_KEY'] || ENV['WORKOS_KEY']
23
+ end
24
+ end
25
+
26
+ def self.config
27
+ @config ||= default_config
28
+ end
29
+
30
+ def self.configure
31
+ yield(config)
32
+ end
18
33
 
19
34
  def self.key=(value)
20
35
  warn '`WorkOS.key=` is deprecated. Use `WorkOS.configure` instead.'
@@ -28,14 +43,6 @@ module WorkOS
28
43
  config.key
29
44
  end
30
45
 
31
- def self.config
32
- @config ||= Configuration.new
33
- end
34
-
35
- def self.configure
36
- yield(config)
37
- end
38
-
39
46
  autoload :Types, 'workos/types'
40
47
  autoload :Client, 'workos/client'
41
48
  autoload :Configuration, 'workos/configuration'
@@ -71,9 +78,4 @@ module WorkOS
71
78
  autoload :InvalidRequestError, 'workos/errors'
72
79
  autoload :SignatureVerificationError, 'workos/errors'
73
80
  autoload :TimeoutError, 'workos/errors'
74
-
75
- # Remove WORKOS_KEY at some point in the future. Keeping it here now for
76
- # backwards compatibility.
77
- key = ENV['WORKOS_API_KEY'] || ENV['WORKOS_KEY']
78
- config.key = key unless key.nil?
79
81
  end
@@ -26,7 +26,7 @@ describe WorkOS::SSO do
26
26
  it 'returns the expected hostname' do
27
27
  authorization_url = described_class.authorization_url(**args)
28
28
 
29
- expect(URI.parse(authorization_url).host).to eq(WorkOS::API_HOSTNAME)
29
+ expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname)
30
30
  end
31
31
 
32
32
  it 'returns the expected query string' do
@@ -60,7 +60,7 @@ describe WorkOS::SSO do
60
60
  it 'returns the expected hostname' do
61
61
  authorization_url = described_class.authorization_url(**args)
62
62
 
63
- expect(URI.parse(authorization_url).host).to eq(WorkOS::API_HOSTNAME)
63
+ expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname)
64
64
  end
65
65
 
66
66
  it 'returns the expected query string' do
@@ -94,7 +94,7 @@ describe WorkOS::SSO do
94
94
  it 'returns the expected hostname' do
95
95
  authorization_url = described_class.authorization_url(**args)
96
96
 
97
- expect(URI.parse(authorization_url).host).to eq(WorkOS::API_HOSTNAME)
97
+ expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname)
98
98
  end
99
99
 
100
100
  it 'returns the expected query string' do
@@ -128,7 +128,7 @@ describe WorkOS::SSO do
128
128
  it 'returns the expected hostname' do
129
129
  authorization_url = described_class.authorization_url(**args)
130
130
 
131
- expect(URI.parse(authorization_url).host).to eq(WorkOS::API_HOSTNAME)
131
+ expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname)
132
132
  end
133
133
 
134
134
  it 'returns the expected query string' do
@@ -163,7 +163,7 @@ describe WorkOS::SSO do
163
163
  it 'returns the expected hostname' do
164
164
  authorization_url = described_class.authorization_url(**args)
165
165
 
166
- expect(URI.parse(authorization_url).host).to eq(WorkOS::API_HOSTNAME)
166
+ expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname)
167
167
  end
168
168
 
169
169
  it 'returns the expected query string' do
@@ -198,7 +198,7 @@ describe WorkOS::SSO do
198
198
  it 'returns the expected hostname' do
199
199
  authorization_url = described_class.authorization_url(**args)
200
200
 
201
- expect(URI.parse(authorization_url).host).to eq(WorkOS::API_HOSTNAME)
201
+ expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname)
202
202
  end
203
203
 
204
204
  it 'returns the expected query string' do
@@ -232,7 +232,7 @@ describe WorkOS::SSO do
232
232
  it 'returns the expected hostname' do
233
233
  authorization_url = described_class.authorization_url(**args)
234
234
 
235
- expect(URI.parse(authorization_url).host).to eq(WorkOS::API_HOSTNAME)
235
+ expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname)
236
236
  end
237
237
 
238
238
  it 'returns the expected query string' do
@@ -282,7 +282,7 @@ describe WorkOS::SSO do
282
282
  described_class.authorization_url(**args)
283
283
  end.to raise_error(
284
284
  ArgumentError,
285
- 'Okta is not a valid value. `provider` must be in ["GoogleOAuth", "MicrosoftOAuth"]',
285
+ 'Okta is not a valid value. `provider` must be in ["GitHubOAuth", "GoogleOAuth", "MicrosoftOAuth"]',
286
286
  )
287
287
  end
288
288
  end
data/workos.gemspec CHANGED
@@ -18,7 +18,6 @@ Gem::Specification.new do |spec|
18
18
  }
19
19
 
20
20
  spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
21
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
22
21
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
23
22
  spec.require_paths = ['lib']
24
23
 
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: 2.16.0
4
+ version: 2.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - WorkOS
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-14 00:00:00.000000000 Z
11
+ date: 2023-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sorbet-runtime
@@ -153,12 +153,7 @@ dependencies:
153
153
  description: API client for WorkOS
154
154
  email:
155
155
  - support@workos.com
156
- executables:
157
- - build
158
- - console
159
- - docs
160
- - publish
161
- - tapioca
156
+ executables: []
162
157
  extensions: []
163
158
  extra_rdoc_files: []
164
159
  files:
@@ -423,7 +418,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
423
418
  - !ruby/object:Gem::Version
424
419
  version: '0'
425
420
  requirements: []
426
- rubygems_version: 3.4.16
421
+ rubygems_version: 3.4.22
427
422
  signing_key:
428
423
  specification_version: 4
429
424
  summary: API client for WorkOS