xbim_identity 2.0.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 (103) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +174 -0
  4. data/Rakefile +10 -0
  5. data/lib/xbim_identity/api/authentication_api.rb +118 -0
  6. data/lib/xbim_identity/api/client_applications_api.rb +315 -0
  7. data/lib/xbim_identity/api/invitations_api.rb +489 -0
  8. data/lib/xbim_identity/api/me_api.rb +148 -0
  9. data/lib/xbim_identity/api/members_api.rb +406 -0
  10. data/lib/xbim_identity/api/registration_api.rb +85 -0
  11. data/lib/xbim_identity/api/tenants_api.rb +709 -0
  12. data/lib/xbim_identity/api/users_api.rb +308 -0
  13. data/lib/xbim_identity/api_client.rb +390 -0
  14. data/lib/xbim_identity/api_error.rb +57 -0
  15. data/lib/xbim_identity/configuration.rb +278 -0
  16. data/lib/xbim_identity/models/application_type.rb +39 -0
  17. data/lib/xbim_identity/models/client_app.rb +351 -0
  18. data/lib/xbim_identity/models/client_app_endpoint.rb +239 -0
  19. data/lib/xbim_identity/models/draft_invitation.rb +379 -0
  20. data/lib/xbim_identity/models/invitation.rb +379 -0
  21. data/lib/xbim_identity/models/invitation_create.rb +253 -0
  22. data/lib/xbim_identity/models/invitation_edit.rb +239 -0
  23. data/lib/xbim_identity/models/invite_status.rb +41 -0
  24. data/lib/xbim_identity/models/master.rb +331 -0
  25. data/lib/xbim_identity/models/master_base.rb +243 -0
  26. data/lib/xbim_identity/models/master_subscription.rb +323 -0
  27. data/lib/xbim_identity/models/o_data_boolean.rb +230 -0
  28. data/lib/xbim_identity/models/o_data_client_app_endpoint_list.rb +252 -0
  29. data/lib/xbim_identity/models/o_data_client_app_list.rb +252 -0
  30. data/lib/xbim_identity/models/o_data_invitation_list.rb +252 -0
  31. data/lib/xbim_identity/models/o_data_string.rb +230 -0
  32. data/lib/xbim_identity/models/o_data_tenant_list.rb +252 -0
  33. data/lib/xbim_identity/models/o_data_tenant_user_list.rb +252 -0
  34. data/lib/xbim_identity/models/o_data_user_list.rb +252 -0
  35. data/lib/xbim_identity/models/problem_details.rb +259 -0
  36. data/lib/xbim_identity/models/region.rb +280 -0
  37. data/lib/xbim_identity/models/region_info.rb +256 -0
  38. data/lib/xbim_identity/models/subscription.rb +309 -0
  39. data/lib/xbim_identity/models/team_member_create.rb +229 -0
  40. data/lib/xbim_identity/models/team_member_edit.rb +219 -0
  41. data/lib/xbim_identity/models/tenancy_type.rb +38 -0
  42. data/lib/xbim_identity/models/tenant.rb +383 -0
  43. data/lib/xbim_identity/models/tenant_create.rb +267 -0
  44. data/lib/xbim_identity/models/tenant_edit.rb +229 -0
  45. data/lib/xbim_identity/models/tenant_role.rb +39 -0
  46. data/lib/xbim_identity/models/tenant_user.rb +299 -0
  47. data/lib/xbim_identity/models/token_err_response.rb +219 -0
  48. data/lib/xbim_identity/models/token_response.rb +259 -0
  49. data/lib/xbim_identity/models/user.rb +261 -0
  50. data/lib/xbim_identity/models/user_create.rb +247 -0
  51. data/lib/xbim_identity/models/user_tenant.rb +279 -0
  52. data/lib/xbim_identity/version.rb +15 -0
  53. data/lib/xbim_identity.rb +83 -0
  54. data/spec/api/authentication_api_spec.rb +52 -0
  55. data/spec/api/client_applications_api_spec.rb +101 -0
  56. data/spec/api/invitations_api_spec.rb +130 -0
  57. data/spec/api/me_api_spec.rb +61 -0
  58. data/spec/api/members_api_spec.rb +113 -0
  59. data/spec/api/registration_api_spec.rb +48 -0
  60. data/spec/api/tenants_api_spec.rb +176 -0
  61. data/spec/api/users_api_spec.rb +95 -0
  62. data/spec/api_client_spec.rb +226 -0
  63. data/spec/configuration_spec.rb +42 -0
  64. data/spec/models/application_type_spec.rb +28 -0
  65. data/spec/models/client_app_endpoint_spec.rb +46 -0
  66. data/spec/models/client_app_spec.rb +112 -0
  67. data/spec/models/draft_invitation_spec.rb +130 -0
  68. data/spec/models/invitation_create_spec.rb +52 -0
  69. data/spec/models/invitation_edit_spec.rb +46 -0
  70. data/spec/models/invitation_spec.rb +130 -0
  71. data/spec/models/invite_status_spec.rb +28 -0
  72. data/spec/models/master_base_spec.rb +46 -0
  73. data/spec/models/master_spec.rb +94 -0
  74. data/spec/models/master_subscription_spec.rb +94 -0
  75. data/spec/models/o_data_boolean_spec.rb +40 -0
  76. data/spec/models/o_data_client_app_endpoint_list_spec.rb +52 -0
  77. data/spec/models/o_data_client_app_list_spec.rb +52 -0
  78. data/spec/models/o_data_invitation_list_spec.rb +52 -0
  79. data/spec/models/o_data_string_spec.rb +40 -0
  80. data/spec/models/o_data_tenant_list_spec.rb +52 -0
  81. data/spec/models/o_data_tenant_user_list_spec.rb +52 -0
  82. data/spec/models/o_data_user_list_spec.rb +52 -0
  83. data/spec/models/problem_details_spec.rb +58 -0
  84. data/spec/models/region_info_spec.rb +46 -0
  85. data/spec/models/region_spec.rb +58 -0
  86. data/spec/models/subscription_spec.rb +88 -0
  87. data/spec/models/team_member_create_spec.rb +40 -0
  88. data/spec/models/team_member_edit_spec.rb +34 -0
  89. data/spec/models/tenancy_type_spec.rb +28 -0
  90. data/spec/models/tenant_create_spec.rb +58 -0
  91. data/spec/models/tenant_edit_spec.rb +40 -0
  92. data/spec/models/tenant_role_spec.rb +28 -0
  93. data/spec/models/tenant_spec.rb +130 -0
  94. data/spec/models/tenant_user_spec.rb +82 -0
  95. data/spec/models/token_err_response_spec.rb +34 -0
  96. data/spec/models/token_response_spec.rb +58 -0
  97. data/spec/models/user_create_spec.rb +46 -0
  98. data/spec/models/user_spec.rb +58 -0
  99. data/spec/models/user_tenant_spec.rb +70 -0
  100. data/spec/spec_helper.rb +111 -0
  101. data/xbim_identity-1.0.0.gem +0 -0
  102. data/xbim_identity.gemspec +38 -0
  103. metadata +184 -0
@@ -0,0 +1,379 @@
1
+ =begin
2
+ #Xbim Flex Identity API 2.0
3
+
4
+ #Communication centralised around construction data
5
+
6
+ The version of the OpenAPI document: 2.0
7
+ Contact: info@xbim.net
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.4.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module XbimIdentity
17
+ class Invitation
18
+ attr_accessor :invitation_id
19
+
20
+ attr_accessor :tenant_id
21
+
22
+ attr_accessor :email_address
23
+
24
+ attr_accessor :email_message
25
+
26
+ attr_accessor :tenant_role
27
+
28
+ attr_accessor :status
29
+
30
+ attr_accessor :date_sent
31
+
32
+ attr_accessor :email_tracking_id
33
+
34
+ attr_accessor :accepted_by_id
35
+
36
+ attr_accessor :date_accepted
37
+
38
+ attr_accessor :date_created
39
+
40
+ attr_accessor :date_modified
41
+
42
+ attr_accessor :created_by
43
+
44
+ attr_accessor :last_modified_by
45
+
46
+ attr_accessor :accepted_by
47
+
48
+ attr_accessor :tenant
49
+
50
+ attr_accessor :secret
51
+
52
+ # Attribute mapping from ruby-style variable name to JSON key.
53
+ def self.attribute_map
54
+ {
55
+ :'invitation_id' => :'invitationId',
56
+ :'tenant_id' => :'tenantId',
57
+ :'email_address' => :'emailAddress',
58
+ :'email_message' => :'emailMessage',
59
+ :'tenant_role' => :'tenantRole',
60
+ :'status' => :'status',
61
+ :'date_sent' => :'dateSent',
62
+ :'email_tracking_id' => :'emailTrackingId',
63
+ :'accepted_by_id' => :'acceptedById',
64
+ :'date_accepted' => :'dateAccepted',
65
+ :'date_created' => :'dateCreated',
66
+ :'date_modified' => :'dateModified',
67
+ :'created_by' => :'createdBy',
68
+ :'last_modified_by' => :'lastModifiedBy',
69
+ :'accepted_by' => :'acceptedBy',
70
+ :'tenant' => :'tenant',
71
+ :'secret' => :'secret'
72
+ }
73
+ end
74
+
75
+ # Returns all the JSON keys this model knows about
76
+ def self.acceptable_attributes
77
+ attribute_map.values
78
+ end
79
+
80
+ # Attribute type mapping.
81
+ def self.openapi_types
82
+ {
83
+ :'invitation_id' => :'String',
84
+ :'tenant_id' => :'String',
85
+ :'email_address' => :'String',
86
+ :'email_message' => :'String',
87
+ :'tenant_role' => :'TenantRole',
88
+ :'status' => :'InviteStatus',
89
+ :'date_sent' => :'Time',
90
+ :'email_tracking_id' => :'String',
91
+ :'accepted_by_id' => :'String',
92
+ :'date_accepted' => :'Time',
93
+ :'date_created' => :'Time',
94
+ :'date_modified' => :'Time',
95
+ :'created_by' => :'User',
96
+ :'last_modified_by' => :'User',
97
+ :'accepted_by' => :'User',
98
+ :'tenant' => :'Tenant',
99
+ :'secret' => :'String'
100
+ }
101
+ end
102
+
103
+ # List of attributes with nullable: true
104
+ def self.openapi_nullable
105
+ Set.new([
106
+ :'invitation_id',
107
+ :'tenant_id',
108
+ :'email_address',
109
+ :'email_message',
110
+ :'tenant_role',
111
+ :'status',
112
+ :'date_sent',
113
+ :'email_tracking_id',
114
+ :'accepted_by_id',
115
+ :'date_accepted',
116
+ :'date_created',
117
+ :'date_modified',
118
+ :'created_by',
119
+ :'last_modified_by',
120
+ :'accepted_by',
121
+ :'tenant',
122
+ :'secret'
123
+ ])
124
+ end
125
+
126
+ # Initializes the object
127
+ # @param [Hash] attributes Model attributes in the form of hash
128
+ def initialize(attributes = {})
129
+ if (!attributes.is_a?(Hash))
130
+ fail ArgumentError, "The input argument (attributes) must be a hash in `XbimIdentity::Invitation` initialize method"
131
+ end
132
+
133
+ # check to see if the attribute exists and convert string to symbol for hash key
134
+ attributes = attributes.each_with_object({}) { |(k, v), h|
135
+ if (!self.class.attribute_map.key?(k.to_sym))
136
+ fail ArgumentError, "`#{k}` is not a valid attribute in `XbimIdentity::Invitation`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
137
+ end
138
+ h[k.to_sym] = v
139
+ }
140
+
141
+ if attributes.key?(:'invitation_id')
142
+ self.invitation_id = attributes[:'invitation_id']
143
+ end
144
+
145
+ if attributes.key?(:'tenant_id')
146
+ self.tenant_id = attributes[:'tenant_id']
147
+ end
148
+
149
+ if attributes.key?(:'email_address')
150
+ self.email_address = attributes[:'email_address']
151
+ end
152
+
153
+ if attributes.key?(:'email_message')
154
+ self.email_message = attributes[:'email_message']
155
+ end
156
+
157
+ if attributes.key?(:'tenant_role')
158
+ self.tenant_role = attributes[:'tenant_role']
159
+ end
160
+
161
+ if attributes.key?(:'status')
162
+ self.status = attributes[:'status']
163
+ end
164
+
165
+ if attributes.key?(:'date_sent')
166
+ self.date_sent = attributes[:'date_sent']
167
+ end
168
+
169
+ if attributes.key?(:'email_tracking_id')
170
+ self.email_tracking_id = attributes[:'email_tracking_id']
171
+ end
172
+
173
+ if attributes.key?(:'accepted_by_id')
174
+ self.accepted_by_id = attributes[:'accepted_by_id']
175
+ end
176
+
177
+ if attributes.key?(:'date_accepted')
178
+ self.date_accepted = attributes[:'date_accepted']
179
+ end
180
+
181
+ if attributes.key?(:'date_created')
182
+ self.date_created = attributes[:'date_created']
183
+ end
184
+
185
+ if attributes.key?(:'date_modified')
186
+ self.date_modified = attributes[:'date_modified']
187
+ end
188
+
189
+ if attributes.key?(:'created_by')
190
+ self.created_by = attributes[:'created_by']
191
+ end
192
+
193
+ if attributes.key?(:'last_modified_by')
194
+ self.last_modified_by = attributes[:'last_modified_by']
195
+ end
196
+
197
+ if attributes.key?(:'accepted_by')
198
+ self.accepted_by = attributes[:'accepted_by']
199
+ end
200
+
201
+ if attributes.key?(:'tenant')
202
+ self.tenant = attributes[:'tenant']
203
+ end
204
+
205
+ if attributes.key?(:'secret')
206
+ self.secret = attributes[:'secret']
207
+ end
208
+ end
209
+
210
+ # Show invalid properties with the reasons. Usually used together with valid?
211
+ # @return Array for valid properties with the reasons
212
+ def list_invalid_properties
213
+ invalid_properties = Array.new
214
+ invalid_properties
215
+ end
216
+
217
+ # Check to see if the all the properties in the model are valid
218
+ # @return true if the model is valid
219
+ def valid?
220
+ true
221
+ end
222
+
223
+ # Checks equality by comparing each attribute.
224
+ # @param [Object] Object to be compared
225
+ def ==(o)
226
+ return true if self.equal?(o)
227
+ self.class == o.class &&
228
+ invitation_id == o.invitation_id &&
229
+ tenant_id == o.tenant_id &&
230
+ email_address == o.email_address &&
231
+ email_message == o.email_message &&
232
+ tenant_role == o.tenant_role &&
233
+ status == o.status &&
234
+ date_sent == o.date_sent &&
235
+ email_tracking_id == o.email_tracking_id &&
236
+ accepted_by_id == o.accepted_by_id &&
237
+ date_accepted == o.date_accepted &&
238
+ date_created == o.date_created &&
239
+ date_modified == o.date_modified &&
240
+ created_by == o.created_by &&
241
+ last_modified_by == o.last_modified_by &&
242
+ accepted_by == o.accepted_by &&
243
+ tenant == o.tenant &&
244
+ secret == o.secret
245
+ end
246
+
247
+ # @see the `==` method
248
+ # @param [Object] Object to be compared
249
+ def eql?(o)
250
+ self == o
251
+ end
252
+
253
+ # Calculates hash code according to all attributes.
254
+ # @return [Integer] Hash code
255
+ def hash
256
+ [invitation_id, tenant_id, email_address, email_message, tenant_role, status, date_sent, email_tracking_id, accepted_by_id, date_accepted, date_created, date_modified, created_by, last_modified_by, accepted_by, tenant, secret].hash
257
+ end
258
+
259
+ # Builds the object from hash
260
+ # @param [Hash] attributes Model attributes in the form of hash
261
+ # @return [Object] Returns the model itself
262
+ def self.build_from_hash(attributes)
263
+ new.build_from_hash(attributes)
264
+ end
265
+
266
+ # Builds the object from hash
267
+ # @param [Hash] attributes Model attributes in the form of hash
268
+ # @return [Object] Returns the model itself
269
+ def build_from_hash(attributes)
270
+ return nil unless attributes.is_a?(Hash)
271
+ self.class.openapi_types.each_pair do |key, type|
272
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
273
+ self.send("#{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[self.class.attribute_map[key]].is_a?(Array)
278
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
279
+ end
280
+ elsif !attributes[self.class.attribute_map[key]].nil?
281
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
282
+ end
283
+ end
284
+
285
+ self
286
+ end
287
+
288
+ # Deserializes the data based on type
289
+ # @param string type Data type
290
+ # @param string value Value to be deserialized
291
+ # @return [Object] Deserialized data
292
+ def _deserialize(type, value)
293
+ case type.to_sym
294
+ when :Time
295
+ Time.parse(value)
296
+ when :Date
297
+ Date.parse(value)
298
+ when :String
299
+ value.to_s
300
+ when :Integer
301
+ value.to_i
302
+ when :Float
303
+ value.to_f
304
+ when :Boolean
305
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
306
+ true
307
+ else
308
+ false
309
+ end
310
+ when :Object
311
+ # generic object (usually a Hash), return directly
312
+ value
313
+ when /\AArray<(?<inner_type>.+)>\z/
314
+ inner_type = Regexp.last_match[:inner_type]
315
+ value.map { |v| _deserialize(inner_type, v) }
316
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
317
+ k_type = Regexp.last_match[:k_type]
318
+ v_type = Regexp.last_match[:v_type]
319
+ {}.tap do |hash|
320
+ value.each do |k, v|
321
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
322
+ end
323
+ end
324
+ else # model
325
+ # models (e.g. Pet) or oneOf
326
+ klass = XbimIdentity.const_get(type)
327
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
328
+ end
329
+ end
330
+
331
+ # Returns the string representation of the object
332
+ # @return [String] String presentation of the object
333
+ def to_s
334
+ to_hash.to_s
335
+ end
336
+
337
+ # to_body is an alias to to_hash (backward compatibility)
338
+ # @return [Hash] Returns the object in the form of hash
339
+ def to_body
340
+ to_hash
341
+ end
342
+
343
+ # Returns the object in the form of hash
344
+ # @return [Hash] Returns the object in the form of hash
345
+ def to_hash
346
+ hash = {}
347
+ self.class.attribute_map.each_pair do |attr, param|
348
+ value = self.send(attr)
349
+ if value.nil?
350
+ is_nullable = self.class.openapi_nullable.include?(attr)
351
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
352
+ end
353
+
354
+ hash[param] = _to_hash(value)
355
+ end
356
+ hash
357
+ end
358
+
359
+ # Outputs non-array value in the form of hash
360
+ # For object, use to_hash. Otherwise, just return the value
361
+ # @param [Object] value Any valid value
362
+ # @return [Hash] Returns the value in the form of hash
363
+ def _to_hash(value)
364
+ if value.is_a?(Array)
365
+ value.compact.map { |v| _to_hash(v) }
366
+ elsif value.is_a?(Hash)
367
+ {}.tap do |hash|
368
+ value.each { |k, v| hash[k] = _to_hash(v) }
369
+ end
370
+ elsif value.respond_to? :to_hash
371
+ value.to_hash
372
+ else
373
+ value
374
+ end
375
+ end
376
+
377
+ end
378
+
379
+ end
@@ -0,0 +1,253 @@
1
+ =begin
2
+ #Xbim Flex Identity API 2.0
3
+
4
+ #Communication centralised around construction data
5
+
6
+ The version of the OpenAPI document: 2.0
7
+ Contact: info@xbim.net
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.4.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module XbimIdentity
17
+ class InvitationCreate
18
+ attr_accessor :email_address
19
+
20
+ attr_accessor :email_message
21
+
22
+ attr_accessor :tenant_role
23
+
24
+ attr_accessor :draft_only
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'email_address' => :'emailAddress',
30
+ :'email_message' => :'emailMessage',
31
+ :'tenant_role' => :'tenantRole',
32
+ :'draft_only' => :'draftOnly'
33
+ }
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'email_address' => :'String',
45
+ :'email_message' => :'String',
46
+ :'tenant_role' => :'TenantRole',
47
+ :'draft_only' => :'Boolean'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ :'email_message',
55
+ :'tenant_role',
56
+ :'draft_only'
57
+ ])
58
+ end
59
+
60
+ # Initializes the object
61
+ # @param [Hash] attributes Model attributes in the form of hash
62
+ def initialize(attributes = {})
63
+ if (!attributes.is_a?(Hash))
64
+ fail ArgumentError, "The input argument (attributes) must be a hash in `XbimIdentity::InvitationCreate` initialize method"
65
+ end
66
+
67
+ # check to see if the attribute exists and convert string to symbol for hash key
68
+ attributes = attributes.each_with_object({}) { |(k, v), h|
69
+ if (!self.class.attribute_map.key?(k.to_sym))
70
+ fail ArgumentError, "`#{k}` is not a valid attribute in `XbimIdentity::InvitationCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
71
+ end
72
+ h[k.to_sym] = v
73
+ }
74
+
75
+ if attributes.key?(:'email_address')
76
+ self.email_address = attributes[:'email_address']
77
+ end
78
+
79
+ if attributes.key?(:'email_message')
80
+ self.email_message = attributes[:'email_message']
81
+ end
82
+
83
+ if attributes.key?(:'tenant_role')
84
+ self.tenant_role = attributes[:'tenant_role']
85
+ end
86
+
87
+ if attributes.key?(:'draft_only')
88
+ self.draft_only = attributes[:'draft_only']
89
+ end
90
+ end
91
+
92
+ # Show invalid properties with the reasons. Usually used together with valid?
93
+ # @return Array for valid properties with the reasons
94
+ def list_invalid_properties
95
+ invalid_properties = Array.new
96
+ if @email_address.nil?
97
+ invalid_properties.push('invalid value for "email_address", email_address cannot be nil.')
98
+ end
99
+
100
+ invalid_properties
101
+ end
102
+
103
+ # Check to see if the all the properties in the model are valid
104
+ # @return true if the model is valid
105
+ def valid?
106
+ return false if @email_address.nil?
107
+ true
108
+ end
109
+
110
+ # Checks equality by comparing each attribute.
111
+ # @param [Object] Object to be compared
112
+ def ==(o)
113
+ return true if self.equal?(o)
114
+ self.class == o.class &&
115
+ email_address == o.email_address &&
116
+ email_message == o.email_message &&
117
+ tenant_role == o.tenant_role &&
118
+ draft_only == o.draft_only
119
+ end
120
+
121
+ # @see the `==` method
122
+ # @param [Object] Object to be compared
123
+ def eql?(o)
124
+ self == o
125
+ end
126
+
127
+ # Calculates hash code according to all attributes.
128
+ # @return [Integer] Hash code
129
+ def hash
130
+ [email_address, email_message, tenant_role, draft_only].hash
131
+ end
132
+
133
+ # Builds the object from hash
134
+ # @param [Hash] attributes Model attributes in the form of hash
135
+ # @return [Object] Returns the model itself
136
+ def self.build_from_hash(attributes)
137
+ new.build_from_hash(attributes)
138
+ end
139
+
140
+ # Builds the object from hash
141
+ # @param [Hash] attributes Model attributes in the form of hash
142
+ # @return [Object] Returns the model itself
143
+ def build_from_hash(attributes)
144
+ return nil unless attributes.is_a?(Hash)
145
+ self.class.openapi_types.each_pair do |key, type|
146
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
147
+ self.send("#{key}=", nil)
148
+ elsif type =~ /\AArray<(.*)>/i
149
+ # check to ensure the input is an array given that the attribute
150
+ # is documented as an array but the input is not
151
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
152
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
153
+ end
154
+ elsif !attributes[self.class.attribute_map[key]].nil?
155
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
156
+ end
157
+ end
158
+
159
+ self
160
+ end
161
+
162
+ # Deserializes the data based on type
163
+ # @param string type Data type
164
+ # @param string value Value to be deserialized
165
+ # @return [Object] Deserialized data
166
+ def _deserialize(type, value)
167
+ case type.to_sym
168
+ when :Time
169
+ Time.parse(value)
170
+ when :Date
171
+ Date.parse(value)
172
+ when :String
173
+ value.to_s
174
+ when :Integer
175
+ value.to_i
176
+ when :Float
177
+ value.to_f
178
+ when :Boolean
179
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
180
+ true
181
+ else
182
+ false
183
+ end
184
+ when :Object
185
+ # generic object (usually a Hash), return directly
186
+ value
187
+ when /\AArray<(?<inner_type>.+)>\z/
188
+ inner_type = Regexp.last_match[:inner_type]
189
+ value.map { |v| _deserialize(inner_type, v) }
190
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
191
+ k_type = Regexp.last_match[:k_type]
192
+ v_type = Regexp.last_match[:v_type]
193
+ {}.tap do |hash|
194
+ value.each do |k, v|
195
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
196
+ end
197
+ end
198
+ else # model
199
+ # models (e.g. Pet) or oneOf
200
+ klass = XbimIdentity.const_get(type)
201
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
202
+ end
203
+ end
204
+
205
+ # Returns the string representation of the object
206
+ # @return [String] String presentation of the object
207
+ def to_s
208
+ to_hash.to_s
209
+ end
210
+
211
+ # to_body is an alias to to_hash (backward compatibility)
212
+ # @return [Hash] Returns the object in the form of hash
213
+ def to_body
214
+ to_hash
215
+ end
216
+
217
+ # Returns the object in the form of hash
218
+ # @return [Hash] Returns the object in the form of hash
219
+ def to_hash
220
+ hash = {}
221
+ self.class.attribute_map.each_pair do |attr, param|
222
+ value = self.send(attr)
223
+ if value.nil?
224
+ is_nullable = self.class.openapi_nullable.include?(attr)
225
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
226
+ end
227
+
228
+ hash[param] = _to_hash(value)
229
+ end
230
+ hash
231
+ end
232
+
233
+ # Outputs non-array value in the form of hash
234
+ # For object, use to_hash. Otherwise, just return the value
235
+ # @param [Object] value Any valid value
236
+ # @return [Hash] Returns the value in the form of hash
237
+ def _to_hash(value)
238
+ if value.is_a?(Array)
239
+ value.compact.map { |v| _to_hash(v) }
240
+ elsif value.is_a?(Hash)
241
+ {}.tap do |hash|
242
+ value.each { |k, v| hash[k] = _to_hash(v) }
243
+ end
244
+ elsif value.respond_to? :to_hash
245
+ value.to_hash
246
+ else
247
+ value
248
+ end
249
+ end
250
+
251
+ end
252
+
253
+ end