passageidentity 0.2.3 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +27 -0
  3. data/README.md +18 -61
  4. data/docs/custom/AuthApi.md +141 -0
  5. data/docs/custom/ClientApi.md +107 -0
  6. data/docs/custom/UserApi.md +419 -0
  7. data/docs/generated/AppInfo.md +94 -0
  8. data/docs/generated/AppResponse.md +18 -0
  9. data/docs/generated/AppsApi.md +77 -0
  10. data/docs/generated/AuthMethods.md +22 -0
  11. data/docs/generated/CreateMagicLinkRequest.md +36 -0
  12. data/docs/generated/CreateUserRequest.md +22 -0
  13. data/docs/generated/ElementCustomization.md +56 -0
  14. data/docs/generated/FontFamily.md +15 -0
  15. data/docs/generated/GithubSocialConnection.md +24 -0
  16. data/docs/generated/GoogleSocialConnection.md +24 -0
  17. data/docs/generated/LayoutConfig.md +26 -0
  18. data/docs/generated/Layouts.md +20 -0
  19. data/docs/generated/ListDevicesResponse.md +18 -0
  20. data/docs/generated/MagicLink.md +36 -0
  21. data/docs/generated/MagicLinkAuthMethod.md +22 -0
  22. data/docs/generated/MagicLinkChannel.md +15 -0
  23. data/docs/generated/MagicLinkResponse.md +18 -0
  24. data/docs/generated/MagicLinkType.md +15 -0
  25. data/docs/generated/MagicLinksApi.md +79 -0
  26. data/docs/generated/Model400Error.md +20 -0
  27. data/docs/generated/Model401Error.md +20 -0
  28. data/docs/generated/Model404Error.md +20 -0
  29. data/docs/generated/Model500Error.md +20 -0
  30. data/docs/generated/OtpAuthMethod.md +22 -0
  31. data/docs/generated/PasskeysAuthMethod.md +18 -0
  32. data/docs/generated/README.md +152 -0
  33. data/docs/generated/Technologies.md +15 -0
  34. data/docs/generated/TokensApi.md +78 -0
  35. data/docs/generated/TtlDisplayUnit.md +15 -0
  36. data/docs/generated/UpdateMagicLinkAuthMethod.md +22 -0
  37. data/docs/generated/UpdateOtpAuthMethod.md +22 -0
  38. data/docs/generated/UpdatePasskeysAuthMethod.md +18 -0
  39. data/docs/generated/UpdateUserRequest.md +22 -0
  40. data/docs/generated/UserDevicesApi.md +152 -0
  41. data/docs/generated/UserEventInfo.md +26 -0
  42. data/docs/generated/UserInfo.md +48 -0
  43. data/docs/generated/UserMetadataField.md +28 -0
  44. data/docs/generated/UserMetadataFieldType.md +15 -0
  45. data/docs/generated/UserResponse.md +18 -0
  46. data/docs/generated/UserSocialConnections.md +20 -0
  47. data/docs/generated/UserStatus.md +15 -0
  48. data/docs/generated/UsersApi.md +440 -0
  49. data/docs/generated/WebAuthnDevices.md +34 -0
  50. data/docs/generated/WebAuthnIcons.md +20 -0
  51. data/docs/generated/WebAuthnType.md +15 -0
  52. data/generate.sh +31 -0
  53. data/lib/openapi_client/api/apps_api.rb +85 -0
  54. data/lib/openapi_client/api/magic_links_api.rb +96 -0
  55. data/lib/openapi_client/api/tokens_api.rb +91 -0
  56. data/lib/openapi_client/api/user_devices_api.rb +166 -0
  57. data/lib/openapi_client/api/users_api.rb +452 -0
  58. data/lib/openapi_client/api_client.rb +431 -0
  59. data/lib/openapi_client/api_error.rb +58 -0
  60. data/lib/openapi_client/configuration.rb +383 -0
  61. data/lib/openapi_client/models/app_info.rb +853 -0
  62. data/lib/openapi_client/models/app_response.rb +221 -0
  63. data/lib/openapi_client/models/auth_methods.rb +254 -0
  64. data/lib/openapi_client/models/create_magic_link_request.rb +374 -0
  65. data/lib/openapi_client/models/create_user_request.rb +234 -0
  66. data/lib/openapi_client/models/element_customization.rb +457 -0
  67. data/lib/openapi_client/models/font_family.rb +58 -0
  68. data/lib/openapi_client/models/github_social_connection.rb +271 -0
  69. data/lib/openapi_client/models/google_social_connection.rb +271 -0
  70. data/lib/openapi_client/models/layout_config.rb +285 -0
  71. data/lib/openapi_client/models/layouts.rb +241 -0
  72. data/lib/openapi_client/models/list_devices_response.rb +223 -0
  73. data/lib/openapi_client/models/magic_link.rb +387 -0
  74. data/lib/openapi_client/models/magic_link_auth_method.rb +302 -0
  75. data/lib/openapi_client/models/magic_link_channel.rb +40 -0
  76. data/lib/openapi_client/models/magic_link_response.rb +221 -0
  77. data/lib/openapi_client/models/magic_link_type.rb +40 -0
  78. data/lib/openapi_client/models/model400_error.rb +271 -0
  79. data/lib/openapi_client/models/model401_error.rb +271 -0
  80. data/lib/openapi_client/models/model404_error.rb +271 -0
  81. data/lib/openapi_client/models/model500_error.rb +271 -0
  82. data/lib/openapi_client/models/otp_auth_method.rb +302 -0
  83. data/lib/openapi_client/models/passkeys_auth_method.rb +228 -0
  84. data/lib/openapi_client/models/technologies.rb +46 -0
  85. data/lib/openapi_client/models/ttl_display_unit.rb +42 -0
  86. data/lib/openapi_client/models/update_magic_link_auth_method.rb +276 -0
  87. data/lib/openapi_client/models/update_otp_auth_method.rb +276 -0
  88. data/lib/openapi_client/models/update_passkeys_auth_method.rb +216 -0
  89. data/lib/openapi_client/models/update_user_request.rb +232 -0
  90. data/lib/openapi_client/models/user_event_info.rb +285 -0
  91. data/lib/openapi_client/models/user_info.rb +486 -0
  92. data/lib/openapi_client/models/user_metadata_field.rb +323 -0
  93. data/lib/openapi_client/models/user_metadata_field_type.rb +44 -0
  94. data/lib/openapi_client/models/user_response.rb +221 -0
  95. data/lib/openapi_client/models/user_social_connections.rb +223 -0
  96. data/lib/openapi_client/models/user_status.rb +41 -0
  97. data/lib/openapi_client/models/web_authn_devices.rb +378 -0
  98. data/lib/openapi_client/models/web_authn_icons.rb +230 -0
  99. data/lib/openapi_client/models/web_authn_type.rb +41 -0
  100. data/lib/openapi_client/version.rb +15 -0
  101. data/lib/openapi_client.rb +83 -0
  102. data/lib/passageidentity/auth.rb +32 -5
  103. data/lib/passageidentity/client.rb +17 -121
  104. data/lib/passageidentity/user_api.rb +29 -131
  105. data/lib/passageidentity/version.rb +5 -0
  106. data/openapitools.json +7 -0
  107. data/passageidentity.gemspec +3 -1
  108. data/tests/auth_test.rb +6 -1
  109. data/tests/magic_link_test.rb +5 -4
  110. data/tests/user_api_test.rb +2 -2
  111. metadata +103 -2
@@ -0,0 +1,223 @@
1
+ =begin
2
+ #Passage Management API
3
+
4
+ #Passage's management API to manage your Passage apps and users.
5
+
6
+ The version of the OpenAPI document: 1
7
+ Contact: support@passage.id
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.1.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OpenapiClient
17
+ class UserSocialConnections
18
+ attr_accessor :google
19
+
20
+ attr_accessor :github
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'google' => :'google',
26
+ :'github' => :'github'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'google' => :'GoogleSocialConnection',
39
+ :'github' => :'GithubSocialConnection'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::UserSocialConnections` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::UserSocialConnections`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'google')
65
+ self.google = attributes[:'google']
66
+ end
67
+
68
+ if attributes.key?(:'github')
69
+ self.github = attributes[:'github']
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
77
+ invalid_properties = Array.new
78
+ invalid_properties
79
+ end
80
+
81
+ # Check to see if the all the properties in the model are valid
82
+ # @return true if the model is valid
83
+ def valid?
84
+ warn '[DEPRECATED] the `valid?` method is obsolete'
85
+ true
86
+ end
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] Object to be compared
90
+ def ==(o)
91
+ return true if self.equal?(o)
92
+ self.class == o.class &&
93
+ google == o.google &&
94
+ github == o.github
95
+ end
96
+
97
+ # @see the `==` method
98
+ # @param [Object] Object to be compared
99
+ def eql?(o)
100
+ self == o
101
+ end
102
+
103
+ # Calculates hash code according to all attributes.
104
+ # @return [Integer] Hash code
105
+ def hash
106
+ [google, github].hash
107
+ end
108
+
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def self.build_from_hash(attributes)
113
+ return nil unless attributes.is_a?(Hash)
114
+ attributes = attributes.transform_keys(&:to_sym)
115
+ transformed_hash = {}
116
+ openapi_types.each_pair do |key, type|
117
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
118
+ transformed_hash["#{key}"] = nil
119
+ elsif type =~ /\AArray<(.*)>/i
120
+ # check to ensure the input is an array given that the attribute
121
+ # is documented as an array but the input is not
122
+ if attributes[attribute_map[key]].is_a?(Array)
123
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
124
+ end
125
+ elsif !attributes[attribute_map[key]].nil?
126
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
127
+ end
128
+ end
129
+ new(transformed_hash)
130
+ end
131
+
132
+ # Deserializes the data based on type
133
+ # @param string type Data type
134
+ # @param string value Value to be deserialized
135
+ # @return [Object] Deserialized data
136
+ def self._deserialize(type, value)
137
+ case type.to_sym
138
+ when :Time
139
+ Time.parse(value)
140
+ when :Date
141
+ Date.parse(value)
142
+ when :String
143
+ value.to_s
144
+ when :Integer
145
+ value.to_i
146
+ when :Float
147
+ value.to_f
148
+ when :Boolean
149
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
150
+ true
151
+ else
152
+ false
153
+ end
154
+ when :Object
155
+ # generic object (usually a Hash), return directly
156
+ value
157
+ when /\AArray<(?<inner_type>.+)>\z/
158
+ inner_type = Regexp.last_match[:inner_type]
159
+ value.map { |v| _deserialize(inner_type, v) }
160
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
161
+ k_type = Regexp.last_match[:k_type]
162
+ v_type = Regexp.last_match[:v_type]
163
+ {}.tap do |hash|
164
+ value.each do |k, v|
165
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
166
+ end
167
+ end
168
+ else # model
169
+ # models (e.g. Pet) or oneOf
170
+ klass = OpenapiClient.const_get(type)
171
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
172
+ end
173
+ end
174
+
175
+ # Returns the string representation of the object
176
+ # @return [String] String presentation of the object
177
+ def to_s
178
+ to_hash.to_s
179
+ end
180
+
181
+ # to_body is an alias to to_hash (backward compatibility)
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_body
184
+ to_hash
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = self.send(attr)
193
+ if value.nil?
194
+ is_nullable = self.class.openapi_nullable.include?(attr)
195
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
196
+ end
197
+
198
+ hash[param] = _to_hash(value)
199
+ end
200
+ hash
201
+ end
202
+
203
+ # Outputs non-array value in the form of hash
204
+ # For object, use to_hash. Otherwise, just return the value
205
+ # @param [Object] value Any valid value
206
+ # @return [Hash] Returns the value in the form of hash
207
+ def _to_hash(value)
208
+ if value.is_a?(Array)
209
+ value.compact.map { |v| _to_hash(v) }
210
+ elsif value.is_a?(Hash)
211
+ {}.tap do |hash|
212
+ value.each { |k, v| hash[k] = _to_hash(v) }
213
+ end
214
+ elsif value.respond_to? :to_hash
215
+ value.to_hash
216
+ else
217
+ value
218
+ end
219
+ end
220
+
221
+ end
222
+
223
+ end
@@ -0,0 +1,41 @@
1
+ =begin
2
+ #Passage Management API
3
+
4
+ #Passage's management API to manage your Passage apps and users.
5
+
6
+ The version of the OpenAPI document: 1
7
+ Contact: support@passage.id
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.1.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OpenapiClient
17
+ class UserStatus
18
+ ACTIVE = "active".freeze
19
+ INACTIVE = "inactive".freeze
20
+ PENDING = "pending".freeze
21
+
22
+ def self.all_vars
23
+ @all_vars ||= [ACTIVE, INACTIVE, PENDING].freeze
24
+ end
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def self.build_from_hash(value)
30
+ new.build_from_hash(value)
31
+ end
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ return value if UserStatus.all_vars.include?(value)
38
+ raise "Invalid ENUM value #{value} for class #UserStatus"
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,378 @@
1
+ =begin
2
+ #Passage Management API
3
+
4
+ #Passage's management API to manage your Passage apps and users.
5
+
6
+ The version of the OpenAPI document: 1
7
+ Contact: support@passage.id
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.1.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OpenapiClient
17
+ class WebAuthnDevices
18
+ # The first time this webAuthn device was used to authenticate the user
19
+ attr_accessor :created_at
20
+
21
+ # The CredID for this webAuthn device
22
+ attr_accessor :cred_id
23
+
24
+ # The friendly name for the webAuthn device used to authenticate
25
+ attr_accessor :friendly_name
26
+
27
+ # The ID of the webAuthn device used for authentication
28
+ attr_accessor :id
29
+
30
+ # The last time this webAuthn device was used to authenticate the user
31
+ attr_accessor :last_login_at
32
+
33
+ attr_accessor :type
34
+
35
+ # The last time this webAuthn device was updated
36
+ attr_accessor :updated_at
37
+
38
+ # How many times this webAuthn device has been used to authenticate the user
39
+ attr_accessor :usage_count
40
+
41
+ attr_accessor :icons
42
+
43
+ class EnumAttributeValidator
44
+ attr_reader :datatype
45
+ attr_reader :allowable_values
46
+
47
+ def initialize(datatype, allowable_values)
48
+ @allowable_values = allowable_values.map do |value|
49
+ case datatype.to_s
50
+ when /Integer/i
51
+ value.to_i
52
+ when /Float/i
53
+ value.to_f
54
+ else
55
+ value
56
+ end
57
+ end
58
+ end
59
+
60
+ def valid?(value)
61
+ !value || allowable_values.include?(value)
62
+ end
63
+ end
64
+
65
+ # Attribute mapping from ruby-style variable name to JSON key.
66
+ def self.attribute_map
67
+ {
68
+ :'created_at' => :'created_at',
69
+ :'cred_id' => :'cred_id',
70
+ :'friendly_name' => :'friendly_name',
71
+ :'id' => :'id',
72
+ :'last_login_at' => :'last_login_at',
73
+ :'type' => :'type',
74
+ :'updated_at' => :'updated_at',
75
+ :'usage_count' => :'usage_count',
76
+ :'icons' => :'icons'
77
+ }
78
+ end
79
+
80
+ # Returns all the JSON keys this model knows about
81
+ def self.acceptable_attributes
82
+ attribute_map.values
83
+ end
84
+
85
+ # Attribute type mapping.
86
+ def self.openapi_types
87
+ {
88
+ :'created_at' => :'Time',
89
+ :'cred_id' => :'String',
90
+ :'friendly_name' => :'String',
91
+ :'id' => :'String',
92
+ :'last_login_at' => :'Time',
93
+ :'type' => :'WebAuthnType',
94
+ :'updated_at' => :'Time',
95
+ :'usage_count' => :'Integer',
96
+ :'icons' => :'WebAuthnIcons'
97
+ }
98
+ end
99
+
100
+ # List of attributes with nullable: true
101
+ def self.openapi_nullable
102
+ Set.new([
103
+ ])
104
+ end
105
+
106
+ # Initializes the object
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ def initialize(attributes = {})
109
+ if (!attributes.is_a?(Hash))
110
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::WebAuthnDevices` initialize method"
111
+ end
112
+
113
+ # check to see if the attribute exists and convert string to symbol for hash key
114
+ attributes = attributes.each_with_object({}) { |(k, v), h|
115
+ if (!self.class.attribute_map.key?(k.to_sym))
116
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::WebAuthnDevices`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
117
+ end
118
+ h[k.to_sym] = v
119
+ }
120
+
121
+ if attributes.key?(:'created_at')
122
+ self.created_at = attributes[:'created_at']
123
+ else
124
+ self.created_at = nil
125
+ end
126
+
127
+ if attributes.key?(:'cred_id')
128
+ self.cred_id = attributes[:'cred_id']
129
+ else
130
+ self.cred_id = nil
131
+ end
132
+
133
+ if attributes.key?(:'friendly_name')
134
+ self.friendly_name = attributes[:'friendly_name']
135
+ else
136
+ self.friendly_name = nil
137
+ end
138
+
139
+ if attributes.key?(:'id')
140
+ self.id = attributes[:'id']
141
+ else
142
+ self.id = nil
143
+ end
144
+
145
+ if attributes.key?(:'last_login_at')
146
+ self.last_login_at = attributes[:'last_login_at']
147
+ else
148
+ self.last_login_at = nil
149
+ end
150
+
151
+ if attributes.key?(:'type')
152
+ self.type = attributes[:'type']
153
+ else
154
+ self.type = nil
155
+ end
156
+
157
+ if attributes.key?(:'updated_at')
158
+ self.updated_at = attributes[:'updated_at']
159
+ else
160
+ self.updated_at = nil
161
+ end
162
+
163
+ if attributes.key?(:'usage_count')
164
+ self.usage_count = attributes[:'usage_count']
165
+ else
166
+ self.usage_count = nil
167
+ end
168
+
169
+ if attributes.key?(:'icons')
170
+ self.icons = attributes[:'icons']
171
+ else
172
+ self.icons = nil
173
+ end
174
+ end
175
+
176
+ # Show invalid properties with the reasons. Usually used together with valid?
177
+ # @return Array for valid properties with the reasons
178
+ def list_invalid_properties
179
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
180
+ invalid_properties = Array.new
181
+ if @created_at.nil?
182
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
183
+ end
184
+
185
+ if @cred_id.nil?
186
+ invalid_properties.push('invalid value for "cred_id", cred_id cannot be nil.')
187
+ end
188
+
189
+ if @friendly_name.nil?
190
+ invalid_properties.push('invalid value for "friendly_name", friendly_name cannot be nil.')
191
+ end
192
+
193
+ if @id.nil?
194
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
195
+ end
196
+
197
+ if @last_login_at.nil?
198
+ invalid_properties.push('invalid value for "last_login_at", last_login_at cannot be nil.')
199
+ end
200
+
201
+ if @type.nil?
202
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
203
+ end
204
+
205
+ if @updated_at.nil?
206
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
207
+ end
208
+
209
+ if @usage_count.nil?
210
+ invalid_properties.push('invalid value for "usage_count", usage_count cannot be nil.')
211
+ end
212
+
213
+ if @icons.nil?
214
+ invalid_properties.push('invalid value for "icons", icons cannot be nil.')
215
+ end
216
+
217
+ invalid_properties
218
+ end
219
+
220
+ # Check to see if the all the properties in the model are valid
221
+ # @return true if the model is valid
222
+ def valid?
223
+ warn '[DEPRECATED] the `valid?` method is obsolete'
224
+ return false if @created_at.nil?
225
+ return false if @cred_id.nil?
226
+ return false if @friendly_name.nil?
227
+ return false if @id.nil?
228
+ return false if @last_login_at.nil?
229
+ return false if @type.nil?
230
+ return false if @updated_at.nil?
231
+ return false if @usage_count.nil?
232
+ return false if @icons.nil?
233
+ true
234
+ end
235
+
236
+ # Checks equality by comparing each attribute.
237
+ # @param [Object] Object to be compared
238
+ def ==(o)
239
+ return true if self.equal?(o)
240
+ self.class == o.class &&
241
+ created_at == o.created_at &&
242
+ cred_id == o.cred_id &&
243
+ friendly_name == o.friendly_name &&
244
+ id == o.id &&
245
+ last_login_at == o.last_login_at &&
246
+ type == o.type &&
247
+ updated_at == o.updated_at &&
248
+ usage_count == o.usage_count &&
249
+ icons == o.icons
250
+ end
251
+
252
+ # @see the `==` method
253
+ # @param [Object] Object to be compared
254
+ def eql?(o)
255
+ self == o
256
+ end
257
+
258
+ # Calculates hash code according to all attributes.
259
+ # @return [Integer] Hash code
260
+ def hash
261
+ [created_at, cred_id, friendly_name, id, last_login_at, type, updated_at, usage_count, icons].hash
262
+ end
263
+
264
+ # Builds the object from hash
265
+ # @param [Hash] attributes Model attributes in the form of hash
266
+ # @return [Object] Returns the model itself
267
+ def self.build_from_hash(attributes)
268
+ return nil unless attributes.is_a?(Hash)
269
+ attributes = attributes.transform_keys(&:to_sym)
270
+ transformed_hash = {}
271
+ openapi_types.each_pair do |key, type|
272
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
273
+ transformed_hash["#{key}"] = nil
274
+ elsif type =~ /\AArray<(.*)>/i
275
+ # check to ensure the input is an array given that the attribute
276
+ # is documented as an array but the input is not
277
+ if attributes[attribute_map[key]].is_a?(Array)
278
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
279
+ end
280
+ elsif !attributes[attribute_map[key]].nil?
281
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
282
+ end
283
+ end
284
+ new(transformed_hash)
285
+ end
286
+
287
+ # Deserializes the data based on type
288
+ # @param string type Data type
289
+ # @param string value Value to be deserialized
290
+ # @return [Object] Deserialized data
291
+ def self._deserialize(type, value)
292
+ case type.to_sym
293
+ when :Time
294
+ Time.parse(value)
295
+ when :Date
296
+ Date.parse(value)
297
+ when :String
298
+ value.to_s
299
+ when :Integer
300
+ value.to_i
301
+ when :Float
302
+ value.to_f
303
+ when :Boolean
304
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
305
+ true
306
+ else
307
+ false
308
+ end
309
+ when :Object
310
+ # generic object (usually a Hash), return directly
311
+ value
312
+ when /\AArray<(?<inner_type>.+)>\z/
313
+ inner_type = Regexp.last_match[:inner_type]
314
+ value.map { |v| _deserialize(inner_type, v) }
315
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
316
+ k_type = Regexp.last_match[:k_type]
317
+ v_type = Regexp.last_match[:v_type]
318
+ {}.tap do |hash|
319
+ value.each do |k, v|
320
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
321
+ end
322
+ end
323
+ else # model
324
+ # models (e.g. Pet) or oneOf
325
+ klass = OpenapiClient.const_get(type)
326
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
327
+ end
328
+ end
329
+
330
+ # Returns the string representation of the object
331
+ # @return [String] String presentation of the object
332
+ def to_s
333
+ to_hash.to_s
334
+ end
335
+
336
+ # to_body is an alias to to_hash (backward compatibility)
337
+ # @return [Hash] Returns the object in the form of hash
338
+ def to_body
339
+ to_hash
340
+ end
341
+
342
+ # Returns the object in the form of hash
343
+ # @return [Hash] Returns the object in the form of hash
344
+ def to_hash
345
+ hash = {}
346
+ self.class.attribute_map.each_pair do |attr, param|
347
+ value = self.send(attr)
348
+ if value.nil?
349
+ is_nullable = self.class.openapi_nullable.include?(attr)
350
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
351
+ end
352
+
353
+ hash[param] = _to_hash(value)
354
+ end
355
+ hash
356
+ end
357
+
358
+ # Outputs non-array value in the form of hash
359
+ # For object, use to_hash. Otherwise, just return the value
360
+ # @param [Object] value Any valid value
361
+ # @return [Hash] Returns the value in the form of hash
362
+ def _to_hash(value)
363
+ if value.is_a?(Array)
364
+ value.compact.map { |v| _to_hash(v) }
365
+ elsif value.is_a?(Hash)
366
+ {}.tap do |hash|
367
+ value.each { |k, v| hash[k] = _to_hash(v) }
368
+ end
369
+ elsif value.respond_to? :to_hash
370
+ value.to_hash
371
+ else
372
+ value
373
+ end
374
+ end
375
+
376
+ end
377
+
378
+ end