xbim_identity 2.0.1 → 2.0.2

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 (102) hide show
  1. checksums.yaml +4 -4
  2. metadata +7 -107
  3. data/Gemfile +0 -9
  4. data/README.md +0 -175
  5. data/Rakefile +0 -10
  6. data/lib/xbim_identity/api/authentication_api.rb +0 -118
  7. data/lib/xbim_identity/api/client_applications_api.rb +0 -315
  8. data/lib/xbim_identity/api/invitations_api.rb +0 -489
  9. data/lib/xbim_identity/api/me_api.rb +0 -148
  10. data/lib/xbim_identity/api/members_api.rb +0 -406
  11. data/lib/xbim_identity/api/registration_api.rb +0 -85
  12. data/lib/xbim_identity/api/tenants_api.rb +0 -709
  13. data/lib/xbim_identity/api/users_api.rb +0 -382
  14. data/lib/xbim_identity/api_client.rb +0 -390
  15. data/lib/xbim_identity/api_error.rb +0 -57
  16. data/lib/xbim_identity/configuration.rb +0 -278
  17. data/lib/xbim_identity/models/application_type.rb +0 -39
  18. data/lib/xbim_identity/models/client_app.rb +0 -351
  19. data/lib/xbim_identity/models/client_app_endpoint.rb +0 -239
  20. data/lib/xbim_identity/models/draft_invitation.rb +0 -379
  21. data/lib/xbim_identity/models/invitation.rb +0 -379
  22. data/lib/xbim_identity/models/invitation_create.rb +0 -253
  23. data/lib/xbim_identity/models/invitation_edit.rb +0 -239
  24. data/lib/xbim_identity/models/invite_status.rb +0 -41
  25. data/lib/xbim_identity/models/master.rb +0 -331
  26. data/lib/xbim_identity/models/master_base.rb +0 -243
  27. data/lib/xbim_identity/models/master_subscription.rb +0 -323
  28. data/lib/xbim_identity/models/o_data_boolean.rb +0 -230
  29. data/lib/xbim_identity/models/o_data_client_app_endpoint_list.rb +0 -252
  30. data/lib/xbim_identity/models/o_data_client_app_list.rb +0 -252
  31. data/lib/xbim_identity/models/o_data_invitation_list.rb +0 -252
  32. data/lib/xbim_identity/models/o_data_string.rb +0 -230
  33. data/lib/xbim_identity/models/o_data_tenant_list.rb +0 -252
  34. data/lib/xbim_identity/models/o_data_tenant_user_list.rb +0 -252
  35. data/lib/xbim_identity/models/o_data_user_list.rb +0 -252
  36. data/lib/xbim_identity/models/problem_details.rb +0 -259
  37. data/lib/xbim_identity/models/region.rb +0 -280
  38. data/lib/xbim_identity/models/region_info.rb +0 -256
  39. data/lib/xbim_identity/models/subscription.rb +0 -309
  40. data/lib/xbim_identity/models/team_member_create.rb +0 -229
  41. data/lib/xbim_identity/models/team_member_edit.rb +0 -219
  42. data/lib/xbim_identity/models/tenancy_type.rb +0 -38
  43. data/lib/xbim_identity/models/tenant.rb +0 -383
  44. data/lib/xbim_identity/models/tenant_create.rb +0 -267
  45. data/lib/xbim_identity/models/tenant_edit.rb +0 -229
  46. data/lib/xbim_identity/models/tenant_role.rb +0 -39
  47. data/lib/xbim_identity/models/tenant_user.rb +0 -299
  48. data/lib/xbim_identity/models/token_err_response.rb +0 -219
  49. data/lib/xbim_identity/models/token_response.rb +0 -259
  50. data/lib/xbim_identity/models/user.rb +0 -261
  51. data/lib/xbim_identity/models/user_create.rb +0 -247
  52. data/lib/xbim_identity/models/user_tenant.rb +0 -279
  53. data/lib/xbim_identity/version.rb +0 -15
  54. data/lib/xbim_identity.rb +0 -83
  55. data/spec/api/authentication_api_spec.rb +0 -52
  56. data/spec/api/client_applications_api_spec.rb +0 -101
  57. data/spec/api/invitations_api_spec.rb +0 -130
  58. data/spec/api/me_api_spec.rb +0 -61
  59. data/spec/api/members_api_spec.rb +0 -113
  60. data/spec/api/registration_api_spec.rb +0 -48
  61. data/spec/api/tenants_api_spec.rb +0 -176
  62. data/spec/api/users_api_spec.rb +0 -109
  63. data/spec/api_client_spec.rb +0 -226
  64. data/spec/configuration_spec.rb +0 -42
  65. data/spec/models/application_type_spec.rb +0 -28
  66. data/spec/models/client_app_endpoint_spec.rb +0 -46
  67. data/spec/models/client_app_spec.rb +0 -112
  68. data/spec/models/draft_invitation_spec.rb +0 -130
  69. data/spec/models/invitation_create_spec.rb +0 -52
  70. data/spec/models/invitation_edit_spec.rb +0 -46
  71. data/spec/models/invitation_spec.rb +0 -130
  72. data/spec/models/invite_status_spec.rb +0 -28
  73. data/spec/models/master_base_spec.rb +0 -46
  74. data/spec/models/master_spec.rb +0 -94
  75. data/spec/models/master_subscription_spec.rb +0 -94
  76. data/spec/models/o_data_boolean_spec.rb +0 -40
  77. data/spec/models/o_data_client_app_endpoint_list_spec.rb +0 -52
  78. data/spec/models/o_data_client_app_list_spec.rb +0 -52
  79. data/spec/models/o_data_invitation_list_spec.rb +0 -52
  80. data/spec/models/o_data_string_spec.rb +0 -40
  81. data/spec/models/o_data_tenant_list_spec.rb +0 -52
  82. data/spec/models/o_data_tenant_user_list_spec.rb +0 -52
  83. data/spec/models/o_data_user_list_spec.rb +0 -52
  84. data/spec/models/problem_details_spec.rb +0 -58
  85. data/spec/models/region_info_spec.rb +0 -46
  86. data/spec/models/region_spec.rb +0 -58
  87. data/spec/models/subscription_spec.rb +0 -88
  88. data/spec/models/team_member_create_spec.rb +0 -40
  89. data/spec/models/team_member_edit_spec.rb +0 -34
  90. data/spec/models/tenancy_type_spec.rb +0 -28
  91. data/spec/models/tenant_create_spec.rb +0 -58
  92. data/spec/models/tenant_edit_spec.rb +0 -40
  93. data/spec/models/tenant_role_spec.rb +0 -28
  94. data/spec/models/tenant_spec.rb +0 -130
  95. data/spec/models/tenant_user_spec.rb +0 -82
  96. data/spec/models/token_err_response_spec.rb +0 -34
  97. data/spec/models/token_response_spec.rb +0 -58
  98. data/spec/models/user_create_spec.rb +0 -46
  99. data/spec/models/user_spec.rb +0 -58
  100. data/spec/models/user_tenant_spec.rb +0 -70
  101. data/spec/spec_helper.rb +0 -111
  102. data/xbim_identity.gemspec +0 -38
@@ -1,239 +0,0 @@
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 ClientAppEndpoint
18
- attr_accessor :client_id
19
-
20
- attr_accessor :endpoint_name
21
-
22
- attr_accessor :tokenised_path
23
-
24
- # Attribute mapping from ruby-style variable name to JSON key.
25
- def self.attribute_map
26
- {
27
- :'client_id' => :'clientId',
28
- :'endpoint_name' => :'endpointName',
29
- :'tokenised_path' => :'tokenisedPath'
30
- }
31
- end
32
-
33
- # Returns all the JSON keys this model knows about
34
- def self.acceptable_attributes
35
- attribute_map.values
36
- end
37
-
38
- # Attribute type mapping.
39
- def self.openapi_types
40
- {
41
- :'client_id' => :'String',
42
- :'endpoint_name' => :'String',
43
- :'tokenised_path' => :'String'
44
- }
45
- end
46
-
47
- # List of attributes with nullable: true
48
- def self.openapi_nullable
49
- Set.new([
50
- :'client_id',
51
- :'endpoint_name',
52
- :'tokenised_path'
53
- ])
54
- end
55
-
56
- # Initializes the object
57
- # @param [Hash] attributes Model attributes in the form of hash
58
- def initialize(attributes = {})
59
- if (!attributes.is_a?(Hash))
60
- fail ArgumentError, "The input argument (attributes) must be a hash in `XbimIdentity::ClientAppEndpoint` initialize method"
61
- end
62
-
63
- # check to see if the attribute exists and convert string to symbol for hash key
64
- attributes = attributes.each_with_object({}) { |(k, v), h|
65
- if (!self.class.attribute_map.key?(k.to_sym))
66
- fail ArgumentError, "`#{k}` is not a valid attribute in `XbimIdentity::ClientAppEndpoint`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
- end
68
- h[k.to_sym] = v
69
- }
70
-
71
- if attributes.key?(:'client_id')
72
- self.client_id = attributes[:'client_id']
73
- end
74
-
75
- if attributes.key?(:'endpoint_name')
76
- self.endpoint_name = attributes[:'endpoint_name']
77
- end
78
-
79
- if attributes.key?(:'tokenised_path')
80
- self.tokenised_path = attributes[:'tokenised_path']
81
- end
82
- end
83
-
84
- # Show invalid properties with the reasons. Usually used together with valid?
85
- # @return Array for valid properties with the reasons
86
- def list_invalid_properties
87
- invalid_properties = Array.new
88
- invalid_properties
89
- end
90
-
91
- # Check to see if the all the properties in the model are valid
92
- # @return true if the model is valid
93
- def valid?
94
- true
95
- end
96
-
97
- # Checks equality by comparing each attribute.
98
- # @param [Object] Object to be compared
99
- def ==(o)
100
- return true if self.equal?(o)
101
- self.class == o.class &&
102
- client_id == o.client_id &&
103
- endpoint_name == o.endpoint_name &&
104
- tokenised_path == o.tokenised_path
105
- end
106
-
107
- # @see the `==` method
108
- # @param [Object] Object to be compared
109
- def eql?(o)
110
- self == o
111
- end
112
-
113
- # Calculates hash code according to all attributes.
114
- # @return [Integer] Hash code
115
- def hash
116
- [client_id, endpoint_name, tokenised_path].hash
117
- end
118
-
119
- # Builds the object from hash
120
- # @param [Hash] attributes Model attributes in the form of hash
121
- # @return [Object] Returns the model itself
122
- def self.build_from_hash(attributes)
123
- new.build_from_hash(attributes)
124
- end
125
-
126
- # Builds the object from hash
127
- # @param [Hash] attributes Model attributes in the form of hash
128
- # @return [Object] Returns the model itself
129
- def build_from_hash(attributes)
130
- return nil unless attributes.is_a?(Hash)
131
- self.class.openapi_types.each_pair do |key, type|
132
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
133
- self.send("#{key}=", nil)
134
- elsif type =~ /\AArray<(.*)>/i
135
- # check to ensure the input is an array given that the attribute
136
- # is documented as an array but the input is not
137
- if attributes[self.class.attribute_map[key]].is_a?(Array)
138
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
139
- end
140
- elsif !attributes[self.class.attribute_map[key]].nil?
141
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
142
- end
143
- end
144
-
145
- self
146
- end
147
-
148
- # Deserializes the data based on type
149
- # @param string type Data type
150
- # @param string value Value to be deserialized
151
- # @return [Object] Deserialized data
152
- def _deserialize(type, value)
153
- case type.to_sym
154
- when :Time
155
- Time.parse(value)
156
- when :Date
157
- Date.parse(value)
158
- when :String
159
- value.to_s
160
- when :Integer
161
- value.to_i
162
- when :Float
163
- value.to_f
164
- when :Boolean
165
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
166
- true
167
- else
168
- false
169
- end
170
- when :Object
171
- # generic object (usually a Hash), return directly
172
- value
173
- when /\AArray<(?<inner_type>.+)>\z/
174
- inner_type = Regexp.last_match[:inner_type]
175
- value.map { |v| _deserialize(inner_type, v) }
176
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
177
- k_type = Regexp.last_match[:k_type]
178
- v_type = Regexp.last_match[:v_type]
179
- {}.tap do |hash|
180
- value.each do |k, v|
181
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
182
- end
183
- end
184
- else # model
185
- # models (e.g. Pet) or oneOf
186
- klass = XbimIdentity.const_get(type)
187
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
188
- end
189
- end
190
-
191
- # Returns the string representation of the object
192
- # @return [String] String presentation of the object
193
- def to_s
194
- to_hash.to_s
195
- end
196
-
197
- # to_body is an alias to to_hash (backward compatibility)
198
- # @return [Hash] Returns the object in the form of hash
199
- def to_body
200
- to_hash
201
- end
202
-
203
- # Returns the object in the form of hash
204
- # @return [Hash] Returns the object in the form of hash
205
- def to_hash
206
- hash = {}
207
- self.class.attribute_map.each_pair do |attr, param|
208
- value = self.send(attr)
209
- if value.nil?
210
- is_nullable = self.class.openapi_nullable.include?(attr)
211
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
- end
213
-
214
- hash[param] = _to_hash(value)
215
- end
216
- hash
217
- end
218
-
219
- # Outputs non-array value in the form of hash
220
- # For object, use to_hash. Otherwise, just return the value
221
- # @param [Object] value Any valid value
222
- # @return [Hash] Returns the value in the form of hash
223
- def _to_hash(value)
224
- if value.is_a?(Array)
225
- value.compact.map { |v| _to_hash(v) }
226
- elsif value.is_a?(Hash)
227
- {}.tap do |hash|
228
- value.each { |k, v| hash[k] = _to_hash(v) }
229
- end
230
- elsif value.respond_to? :to_hash
231
- value.to_hash
232
- else
233
- value
234
- end
235
- end
236
-
237
- end
238
-
239
- end
@@ -1,379 +0,0 @@
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 DraftInvitation
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::DraftInvitation` 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::DraftInvitation`. 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