workos 2.2.0 → 2.4.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.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/lib/workos/audit_trail.rb +1 -0
  4. data/lib/workos/challenge.rb +2 -1
  5. data/lib/workos/connection.rb +1 -0
  6. data/lib/workos/deprecated_hash_wrapper.rb +76 -0
  7. data/lib/workos/directory.rb +1 -0
  8. data/lib/workos/directory_group.rb +26 -2
  9. data/lib/workos/directory_sync.rb +11 -8
  10. data/lib/workos/directory_user.rb +16 -2
  11. data/lib/workos/factor.rb +2 -6
  12. data/lib/workos/hash_provider.rb +19 -0
  13. data/lib/workos/organization.rb +1 -0
  14. data/lib/workos/organizations.rb +1 -0
  15. data/lib/workos/profile.rb +1 -0
  16. data/lib/workos/profile_and_token.rb +1 -0
  17. data/lib/workos/sso.rb +1 -0
  18. data/lib/workos/types/challenge_struct.rb +1 -1
  19. data/lib/workos/types/directory_group_struct.rb +6 -0
  20. data/lib/workos/types/directory_user_struct.rb +2 -0
  21. data/lib/workos/types/factor_struct.rb +0 -1
  22. data/lib/workos/types/passwordless_session_struct.rb +2 -0
  23. data/lib/workos/types/verify_factor_struct.rb +1 -3
  24. data/lib/workos/verify_factor.rb +1 -0
  25. data/lib/workos/version.rb +1 -1
  26. data/lib/workos/webhook.rb +1 -0
  27. data/lib/workos.rb +2 -0
  28. data/spec/lib/workos/directory_sync_spec.rb +29 -18
  29. data/spec/lib/workos/directory_user_spec.rb +36 -0
  30. data/spec/lib/workos/mfa_spec.rb +31 -1
  31. data/spec/support/fixtures/vcr_cassettes/directory_sync/get_group.yml +47 -29
  32. data/spec/support/fixtures/vcr_cassettes/directory_sync/get_user.yml +28 -31
  33. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_after.yml +46 -32
  34. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_before.yml +47 -31
  35. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_directory.yml +46 -34
  36. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_limit.yml +41 -31
  37. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_no_options.yml +36 -26
  38. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_user.yml +38 -28
  39. data/spec/support/fixtures/vcr_cassettes/mfa/challenge_factor_totp_valid.yml +1 -1
  40. data/spec/support/fixtures/vcr_cassettes/mfa/enroll_factor_generic_valid.yml +1 -1
  41. data/spec/support/fixtures/vcr_cassettes/mfa/enroll_factor_sms_valid.yml +1 -1
  42. data/spec/support/fixtures/vcr_cassettes/mfa/enroll_factor_totp_valid.yml +1 -1
  43. data/spec/support/fixtures/vcr_cassettes/mfa/get_factor_valid.yml +1 -1
  44. data/spec/support/fixtures/vcr_cassettes/mfa/verify_factor_generic_valid_is_false.yml +82 -0
  45. metadata +9 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 983d578de3e27144af8a7947eebfb770ad7ee640954511586617505c520ee657
4
- data.tar.gz: 92cb0b75234f56a1e18c47d9cb339b2f389e17463798141bc7a3a2977f5f9372
3
+ metadata.gz: 3b8ce6f7bddb9f3bbee9713d7ec1674c487f1c9f963e7e57ee8e6b99b26e183a
4
+ data.tar.gz: de86e65fad32c780bc23ba9a2e2e7e611af89c2025f768d96ca51a59b5c23218
5
5
  SHA512:
6
- metadata.gz: 1143a28ee95755c80fe36aa5fba02e069143ebdb96e67f909d566bbf091928176ac29f23ccfa7764da163a248268f7a882616e0db7bd73612eda060c78cf8515
7
- data.tar.gz: a2e279f2f2427dd8089eddcc692e677d21978fdd16f3918ffe162822d116b7904f1dbc6826d151f583ba1c60cd5c0e8fbe8b825fb78212f772d7a1aa11faa6da
6
+ metadata.gz: 82b37f71d2b099ccfde1f6d47f5a43392f275e093d130156796079be0f2ada5f8e787143991aa9b2d65878c5cd4ab052b5c81f60fe43e46e59619714c17b08c4
7
+ data.tar.gz: f02fbd38fedce2ac51834fb10196b6c79a1ed29013afb7f681ec9329df0e571035330f2a6f52bdb0c963bb0be5ade92b389962609f2d87cba8fd83bbca471a60
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- workos (2.2.0)
4
+ workos (2.4.0)
5
5
  sorbet-runtime (~> 0.5)
6
6
 
7
7
  GEM
@@ -60,7 +60,7 @@ GEM
60
60
  simplecov_json_formatter (0.1.2)
61
61
  sorbet (0.5.6388)
62
62
  sorbet-static (= 0.5.6388)
63
- sorbet-runtime (0.5.9300)
63
+ sorbet-runtime (0.5.10090)
64
64
  sorbet-static (0.5.6388-universal-darwin-14)
65
65
  sorbet-static (0.5.6388-universal-darwin-15)
66
66
  sorbet-static (0.5.6388-universal-darwin-16)
@@ -65,6 +65,7 @@ module WorkOS
65
65
  # @option options [String] before Event ID to look before
66
66
  # @option options [String] after Event ID to look after
67
67
  # @option options [Integer] limit Number of Events to return
68
+ # @option options [String] order The order in which to paginate records
68
69
  # @option options [Array<String>] group List of Groups to filter for
69
70
  # @option options [Array<String>] action List of Actions to filter for
70
71
  # @option options [Array<String>] action_type List of Action Types to
@@ -6,6 +6,7 @@ module WorkOS
6
6
  # a WorkOS DirectoryUser resource. This class is not meant to be instantiated
7
7
  # in DirectoryUser space, and is instantiated internally but exposed.
8
8
  class Challenge
9
+ include HashProvider
9
10
  extend T::Sig
10
11
 
11
12
  attr_accessor :id, :object, :expires_at, :code, :authentication_factor_id, :updated_at, :created_at
@@ -15,7 +16,7 @@ module WorkOS
15
16
  raw = parse_json(json)
16
17
  @id = T.let(raw.id, String)
17
18
  @object = T.let(raw.object, String)
18
- @expires_at = raw.expires_at
19
+ @expires_at = T.let(raw.expires_at, String)
19
20
  @code = raw.code
20
21
  @authentication_factor_id = T.let(raw.authentication_factor_id, String)
21
22
  @created_at = T.let(raw.created_at, String)
@@ -7,6 +7,7 @@ module WorkOS
7
7
  # in user space, and is instantiated internally but exposed.
8
8
  # Note: status is deprecated - use state instead
9
9
  class Connection
10
+ include HashProvider
10
11
  extend T::Sig
11
12
 
12
13
  attr_accessor :id, :name, :connection_type, :domains, :organization_id,
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WorkOS
4
+ # A Temporary wrapper class for a Hash, currently the base class for
5
+ # WorOS::DirectoryGroup and WorkOS::DirectoryUser. Makes all the Hash
6
+ # methods available to those classes, but will also emit a deprecation
7
+ # warning whenever any of them are used.
8
+ #
9
+ # Once we deprecate Hash compatibility, this model can be deleted.
10
+ class DeprecatedHashWrapper < Hash
11
+ (public_instance_methods - Object.methods).each do |method_name|
12
+ define_method method_name do |*args, &block|
13
+ print_deprecation_warning(method_name)
14
+ super(*args, &block)
15
+ end
16
+ end
17
+
18
+ # call the original implementation of :replace in Hash,
19
+ # so we don't show the deprecation warning
20
+ def replace_without_warning(new_hash)
21
+ method(:replace).super_method&.call(new_hash)
22
+ end
23
+
24
+ def [](attribute_name)
25
+ usage = "#{object_name}.#{attribute_name}"
26
+ warning_message = "WARNING: The Hash style access for #{class_name} attributes is deprecated
27
+ and will be removed in a future version. Please use `#{usage}` or equivalent accessor.\n"
28
+
29
+ print_deprecation_warning('[]', warning_message)
30
+
31
+ super(attribute_name.to_sym)
32
+ end
33
+
34
+ private
35
+
36
+ def deprecation_warning(method_name)
37
+ usage = "#{object_name}.to_h.#{method_name}"
38
+
39
+ "WARNING: Hash compatibility for #{class_name} is deprecated and will be removed
40
+ in a future version. Please use `#{usage}` to access methods on the attribute Hash object.\n"
41
+ end
42
+
43
+ def print_deprecation_warning(method_name, warning_message = deprecation_warning(method_name))
44
+ if RUBY_VERSION > '3'
45
+ warn warning_message, category: :deprecated
46
+ else
47
+ warn warning_message
48
+ end
49
+ end
50
+
51
+ def class_name
52
+ self.class.name
53
+ end
54
+
55
+ # We want to do class_name.demodulize.underscore here, but that's not available in Ruby 1.9, so
56
+ # implementing the demodulize and underscore methods here.
57
+ def object_name
58
+ i = class_name.rindex('::')
59
+ object_name = i ? class_name[(i + 2)..-1] : class_name
60
+ underscore(object_name)
61
+ end
62
+
63
+ def underscore(camel_cased_word)
64
+ return camel_cased_word.to_s unless /[A-Z-]|::/.match?(camel_cased_word)
65
+
66
+ word = camel_cased_word.to_s.gsub('::', '/')
67
+ word.gsub!(/(?:(?<=([A-Za-z\d]))|\b)((?=a)b)(?=\b|[^a-z])/) do
68
+ "#{Regexp.last_match(1) && '_'}#{Regexp.last_match(2).downcase}"
69
+ end
70
+ word.gsub!(/([A-Z]+)(?=[A-Z][a-z])|([a-z\d])(?=[A-Z])/) { (Regexp.last_match(1) || Regexp.last_match(2)) << '_' }
71
+ word.tr!('-', '_')
72
+ word.downcase!
73
+ word
74
+ end
75
+ end
76
+ end
@@ -6,6 +6,7 @@ module WorkOS
6
6
  # a WorkOS Directory resource. This class is not meant to be instantiated
7
7
  # in user space, and is instantiated internally but exposed.
8
8
  class Directory
9
+ include HashProvider
9
10
  extend T::Sig
10
11
 
11
12
  attr_accessor :id, :domain, :name, :type, :state, :organization_id, :created_at, :updated_at
@@ -5,23 +5,41 @@ module WorkOS
5
5
  # The DirectoryGroup class provides a lightweight wrapper around
6
6
  # a WorkOS DirectoryGroup resource. This class is not meant to be instantiated
7
7
  # in user space, and is instantiated internally but exposed.
8
- class DirectoryGroup
8
+ class DirectoryGroup < DeprecatedHashWrapper
9
+ include HashProvider
9
10
  extend T::Sig
10
11
 
11
- attr_accessor :id, :name
12
+ attr_accessor :id, :directory_id, :idp_id, :name, :created_at, :updated_at,
13
+ :raw_attributes, :organization_id
12
14
 
15
+ # rubocop:disable Metrics/AbcSize
13
16
  sig { params(json: String).void }
14
17
  def initialize(json)
15
18
  raw = parse_json(json)
16
19
 
17
20
  @id = T.let(raw.id, String)
21
+ @directory_id = T.let(raw.directory_id, String)
22
+ @organization_id = raw.organization_id
23
+ @idp_id = T.let(raw.idp_id, String)
18
24
  @name = T.let(raw.name, String)
25
+ @created_at = T.let(raw.created_at, String)
26
+ @updated_at = T.let(raw.updated_at, String)
27
+ @raw_attributes = raw.raw_attributes
28
+
29
+ replace_without_warning(to_json)
19
30
  end
31
+ # rubocop:enable Metrics/AbcSize
20
32
 
21
33
  def to_json(*)
22
34
  {
23
35
  id: id,
36
+ directory_id: directory_id,
37
+ organization_id: organization_id,
38
+ idp_id: idp_id,
24
39
  name: name,
40
+ created_at: created_at,
41
+ updated_at: updated_at,
42
+ raw_attributes: raw_attributes,
25
43
  }
26
44
  end
27
45
 
@@ -37,7 +55,13 @@ module WorkOS
37
55
 
38
56
  WorkOS::Types::DirectoryGroupStruct.new(
39
57
  id: hash[:id],
58
+ directory_id: hash[:directory_id],
59
+ organization_id: hash[:organization_id],
60
+ idp_id: hash[:idp_id],
40
61
  name: hash[:name],
62
+ created_at: hash[:created_at],
63
+ updated_at: hash[:updated_at],
64
+ raw_attributes: hash[:raw_attributes],
41
65
  )
42
66
  end
43
67
  end
@@ -22,6 +22,7 @@ module WorkOS
22
22
  # retrieved.
23
23
  # @option options [String] search A search term for direcory names.
24
24
  # @option options [String] limit Maximum number of records to return.
25
+ # @option options [String] order The order in which to paginate records
25
26
  # @option options [String] before Pagination cursor to receive records
26
27
  # before a provided Directory ID.
27
28
  # @option options [String] after Pagination cursor to receive records
@@ -91,12 +92,13 @@ module WorkOS
91
92
  # @option options [String] user The ID of the directory user whose
92
93
  # directory groups will be retrieved.
93
94
  # @option options [String] limit Maximum number of records to return.
95
+ # @option options [String] order The order in which to paginate records
94
96
  # @option options [String] before Pagination cursor to receive records
95
97
  # before a provided Directory Group ID.
96
98
  # @option options [String] after Pagination cursor to receive records
97
99
  # before a provided Directory Group ID.
98
100
  #
99
- # @return [Hash]
101
+ # @return [WorkOS::DirectoryGroup]
100
102
  sig do
101
103
  params(
102
104
  options: T::Hash[Symbol, String],
@@ -130,12 +132,13 @@ module WorkOS
130
132
  # @option options [String] user The ID of the directory group whose
131
133
  # directory users will be retrieved.
132
134
  # @option options [String] limit Maximum number of records to return.
135
+ # @option options [String] order The order in which to paginate records
133
136
  # @option options [String] before Pagination cursor to receive records
134
137
  # before a provided Directory User ID.
135
138
  # @option options [String] after Pagination cursor to receive records
136
139
  # before a provided Directory User ID.
137
140
  #
138
- # @return [Hash]
141
+ # @return [WorkOS::DirectoryUser]
139
142
  sig do
140
143
  params(
141
144
  options: T::Hash[Symbol, String],
@@ -165,8 +168,8 @@ module WorkOS
165
168
  #
166
169
  # @param [String] id The ID of the directory group.
167
170
  #
168
- # @return Hash
169
- sig { params(id: String).returns(T::Hash[String, T.untyped]) }
171
+ # @return WorkOS::DirectoryGroup
172
+ sig { params(id: String).returns(WorkOS::DirectoryGroup) }
170
173
  def get_group(id)
171
174
  response = execute_request(
172
175
  request: get_request(
@@ -175,15 +178,15 @@ module WorkOS
175
178
  ),
176
179
  )
177
180
 
178
- JSON.parse(response.body)
181
+ ::WorkOS::DirectoryGroup.new(response.body)
179
182
  end
180
183
 
181
184
  # Retrieve the directory user with the given ID.
182
185
  #
183
186
  # @param [String] id The ID of the directory user.
184
187
  #
185
- # @return Hash
186
- sig { params(id: String).returns(T::Hash[String, T.untyped]) }
188
+ # @return WorkOS::DirectoryUser
189
+ sig { params(id: String).returns(WorkOS::DirectoryUser) }
187
190
  def get_user(id)
188
191
  response = execute_request(
189
192
  request: get_request(
@@ -192,7 +195,7 @@ module WorkOS
192
195
  ),
193
196
  )
194
197
 
195
- JSON.parse(response.body)
198
+ ::WorkOS::DirectoryUser.new(response.body)
196
199
  end
197
200
 
198
201
  # Delete the directory with the given ID.
@@ -5,11 +5,12 @@ module WorkOS
5
5
  # The DirectoryUser class provides a lightweight wrapper around
6
6
  # a WorkOS DirectoryUser resource. This class is not meant to be instantiated
7
7
  # in DirectoryUser space, and is instantiated internally but exposed.
8
- class DirectoryUser
8
+ class DirectoryUser < DeprecatedHashWrapper
9
+ include HashProvider
9
10
  extend T::Sig
10
11
 
11
12
  attr_accessor :id, :idp_id, :emails, :first_name, :last_name, :username, :state,
12
- :groups, :custom_attributes, :raw_attributes
13
+ :groups, :custom_attributes, :raw_attributes, :directory_id, :organization_id
13
14
 
14
15
  # rubocop:disable Metrics/AbcSize
15
16
  sig { params(json: String).void }
@@ -17,6 +18,8 @@ module WorkOS
17
18
  raw = parse_json(json)
18
19
 
19
20
  @id = T.let(raw.id, String)
21
+ @directory_id = T.let(raw.directory_id, String)
22
+ @organization_id = raw.organization_id
20
23
  @idp_id = T.let(raw.idp_id, String)
21
24
  @emails = T.let(raw.emails, Array)
22
25
  @first_name = raw.first_name
@@ -26,12 +29,16 @@ module WorkOS
26
29
  @groups = T.let(raw.groups, Array)
27
30
  @custom_attributes = raw.custom_attributes
28
31
  @raw_attributes = raw.raw_attributes
32
+
33
+ replace_without_warning(to_json)
29
34
  end
30
35
  # rubocop:enable Metrics/AbcSize
31
36
 
32
37
  def to_json(*)
33
38
  {
34
39
  id: id,
40
+ directory_id: directory_id,
41
+ organization_id: organization_id,
35
42
  idp_id: idp_id,
36
43
  emails: emails,
37
44
  first_name: first_name,
@@ -44,6 +51,11 @@ module WorkOS
44
51
  }
45
52
  end
46
53
 
54
+ def primary_email
55
+ primary_email = (emails || []).find { |email| email[:primary] }
56
+ return primary_email[:value] if primary_email
57
+ end
58
+
47
59
  private
48
60
 
49
61
  sig do
@@ -56,6 +68,8 @@ module WorkOS
56
68
 
57
69
  WorkOS::Types::DirectoryUserStruct.new(
58
70
  id: hash[:id],
71
+ directory_id: hash[:directory_id],
72
+ organization_id: hash[:organization_id],
59
73
  idp_id: hash[:idp_id],
60
74
  emails: hash[:emails],
61
75
  first_name: hash[:first_name],
data/lib/workos/factor.rb CHANGED
@@ -6,15 +6,14 @@ module WorkOS
6
6
  # a WorkOS DirectoryUser resource. This class is not meant to be instantiated
7
7
  # in DirectoryUser space, and is instantiated internally but exposed.
8
8
  class Factor
9
- # rubocop:disable Metrics/AbcSize
9
+ include HashProvider
10
10
  extend T::Sig
11
- attr_accessor :id, :environment_id, :object, :type, :sms, :totp, :updated_at, :created_at
11
+ attr_accessor :id, :object, :type, :sms, :totp, :updated_at, :created_at
12
12
 
13
13
  sig { params(json: String).void }
14
14
  def initialize(json)
15
15
  raw = parse_json(json)
16
16
  @id = T.let(raw.id, String)
17
- @environment_id = T.let(raw.environment_id, String)
18
17
  @object = T.let(raw.object, String)
19
18
  @type = T.let(raw.type, String)
20
19
  @created_at = T.let(raw.created_at, String)
@@ -26,7 +25,6 @@ module WorkOS
26
25
  def to_json(*)
27
26
  {
28
27
  id: id,
29
- environment_id: environment_id,
30
28
  object: object,
31
29
  type: type,
32
30
  totp: totp,
@@ -44,7 +42,6 @@ module WorkOS
44
42
 
45
43
  WorkOS::Types::FactorStruct.new(
46
44
  id: hash[:id],
47
- environment_id: hash[:environment_id],
48
45
  object: hash[:object],
49
46
  type: hash[:type],
50
47
  totp: hash[:totp],
@@ -53,6 +50,5 @@ module WorkOS
53
50
  updated_at: hash[:updated_at],
54
51
  )
55
52
  end
56
- # rubocop:enable Metrics/AbcSize
57
53
  end
58
54
  end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+ # typed: true
3
+
4
+ module WorkOS
5
+ # Module to include an explicit method for converting a model into a Hash containing
6
+ # its attributes. Default implementation will simply call to_json. Individual classes
7
+ # may override.
8
+ module HashProvider
9
+ include Kernel
10
+
11
+ def to_json(*)
12
+ raise 'Must be implemented by including class.'
13
+ end
14
+
15
+ def to_h
16
+ to_json
17
+ end
18
+ end
19
+ end
@@ -6,6 +6,7 @@ module WorkOS
6
6
  # a WorkOS Organization resource. This class is not meant to be instantiated
7
7
  # in user space, and is instantiated internally but exposed.
8
8
  class Organization
9
+ include HashProvider
9
10
  extend T::Sig
10
11
 
11
12
  attr_accessor :id, :domains, :name, :allow_profiles_outside_organization, :created_at, :updated_at
@@ -21,6 +21,7 @@ module WorkOS
21
21
  # @param [String] after A pagination argument used to request
22
22
  # organizations after the provided Organization ID.
23
23
  # @param [Integer] limit A pagination argument used to limit the number
24
+ # @param [String] order The order in which to paginate records
24
25
  # of listed Organizations that are returned.
25
26
  sig do
26
27
  params(
@@ -8,6 +8,7 @@ module WorkOS
8
8
  # is not meant to be instantiated in user space, and
9
9
  # is instantiated internally but exposed.
10
10
  class Profile
11
+ include HashProvider
11
12
  extend T::Sig
12
13
 
13
14
  sig { returns(String) }
@@ -6,6 +6,7 @@ module WorkOS
6
6
  # Access Token. This class is not meant to be instantiated in user space, and
7
7
  # is instantiated internally but exposed.
8
8
  class ProfileAndToken
9
+ include HashProvider
9
10
  extend T::Sig
10
11
 
11
12
  attr_accessor :access_token, :profile
data/lib/workos/sso.rb CHANGED
@@ -163,6 +163,7 @@ module WorkOS
163
163
  # @option options [String] organization_id The id of the organization
164
164
  # of the connections to be retrieved.
165
165
  # @option options [String] limit Maximum number of records to return.
166
+ # @option options [String] order The order in which to paginate records
166
167
  # @option options [String] before Pagination cursor to receive records
167
168
  # before a provided Connection ID.
168
169
  # @option options [String] after Pagination cursor to receive records
@@ -8,7 +8,7 @@ module WorkOS
8
8
  class ChallengeStruct < T::Struct
9
9
  const :id, String
10
10
  const :object, String
11
- const :expires_at, T.nilable(String)
11
+ const :expires_at, String
12
12
  const :code, T.nilable(String)
13
13
  const :authentication_factor_id, String
14
14
  const :created_at, String
@@ -7,7 +7,13 @@ module WorkOS
7
7
  # for the DirectoryGroup class
8
8
  class DirectoryGroupStruct < T::Struct
9
9
  const :id, String
10
+ const :directory_id, String
11
+ const :organization_id, T.nilable(String)
12
+ const :idp_id, String
10
13
  const :name, String
14
+ const :created_at, String
15
+ const :updated_at, String
16
+ const :raw_attributes, T::Hash[Symbol, Object]
11
17
  end
12
18
  end
13
19
  end
@@ -7,6 +7,8 @@ module WorkOS
7
7
  # for the DirectoryUser class
8
8
  class DirectoryUserStruct < T::Struct
9
9
  const :id, String
10
+ const :directory_id, String
11
+ const :organization_id, T.nilable(String)
10
12
  const :idp_id, String
11
13
  const :emails, T::Array[T.untyped]
12
14
  const :first_name, T.nilable(String)
@@ -7,7 +7,6 @@ module WorkOS
7
7
  # for the Factor class
8
8
  class FactorStruct < T::Struct
9
9
  const :id, String
10
- const :environment_id, String
11
10
  const :object, String
12
11
  const :type, String
13
12
  const :totp, T.nilable(T::Hash[Symbol, Object])
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
  # typed: strict
3
3
 
4
+ require 'date'
5
+
4
6
  module WorkOS
5
7
  module Types
6
8
  # This PasswordlessSessionStruct acts as a typed interface
@@ -7,9 +7,7 @@ module WorkOS
7
7
  # for the Factor class
8
8
  class VerifyFactorStruct < T::Struct
9
9
  const :challenge, T.nilable(T::Hash[Symbol, Object])
10
- const :valid, T.nilable(TrueClass)
11
- const :code, T.nilable(String)
12
- const :message, T.nilable(String)
10
+ const :valid, T::Boolean
13
11
  end
14
12
  end
15
13
  end
@@ -6,6 +6,7 @@ module WorkOS
6
6
  # a WorkOS DirectoryUser resource. This class is not meant to be instantiated
7
7
  # in DirectoryUser space, and is instantiated internally but exposed.
8
8
  class VerifyFactor
9
+ include HashProvider
9
10
  extend T::Sig
10
11
 
11
12
  attr_accessor :challenge, :valid
@@ -2,5 +2,5 @@
2
2
  # typed: strong
3
3
 
4
4
  module WorkOS
5
- VERSION = '2.2.0'
5
+ VERSION = '2.4.0'
6
6
  end
@@ -6,6 +6,7 @@ module WorkOS
6
6
  # a WorkOS Webhook resource. This class is not meant to be instantiated
7
7
  # in user space, and is instantiated internally but exposed.
8
8
  class Webhook
9
+ include HashProvider
9
10
  extend T::Sig
10
11
 
11
12
  attr_accessor :id, :event, :data
data/lib/workos.rb CHANGED
@@ -4,6 +4,7 @@
4
4
  require 'workos/version'
5
5
  require 'sorbet-runtime'
6
6
  require 'json'
7
+ require 'workos/hash_provider'
7
8
 
8
9
  # Use the WorkOS module to authenticate your
9
10
  # requests to the WorkOS API. The gem will read
@@ -48,6 +49,7 @@ module WorkOS
48
49
  autoload :Factor, 'workos/factor'
49
50
  autoload :Challenge, 'workos/challenge'
50
51
  autoload :VerifyFactor, 'workos/verify_factor'
52
+ autoload :DeprecatedHashWrapper, 'workos/deprecated_hash_wrapper'
51
53
 
52
54
 
53
55
  # Errors