weft-sdk 0.2.1

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 (81) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +9 -0
  3. data/docs/APIKeysApi.md +208 -0
  4. data/docs/AccountApi.md +72 -0
  5. data/docs/AccountDetails.md +30 -0
  6. data/docs/Agent.md +38 -0
  7. data/docs/AgentListResponse.md +20 -0
  8. data/docs/AgentResponse.md +18 -0
  9. data/docs/AgentStats.md +30 -0
  10. data/docs/AgentsApi.md +147 -0
  11. data/docs/ApiKey.md +28 -0
  12. data/docs/ApiKeyCreated.md +26 -0
  13. data/docs/ApiKeyCreatedResponse.md +18 -0
  14. data/docs/ApiKeyListResponse.md +18 -0
  15. data/docs/AuthApi.md +385 -0
  16. data/docs/AuthResponse.md +18 -0
  17. data/docs/AuthResponseData.md +22 -0
  18. data/docs/ConfirmRequest.md +18 -0
  19. data/docs/CreateApiKeyRequest.md +18 -0
  20. data/docs/DefaultApi.md +67 -0
  21. data/docs/Error.md +24 -0
  22. data/docs/ErrorResponse.md +18 -0
  23. data/docs/MeResponse.md +18 -0
  24. data/docs/MessageResponse.md +18 -0
  25. data/docs/MessageResponseData.md +18 -0
  26. data/docs/Pagination.md +24 -0
  27. data/docs/PasswordResetRequest.md +18 -0
  28. data/docs/PasswordUpdateRequest.md +22 -0
  29. data/docs/Payment.md +44 -0
  30. data/docs/PaymentListResponse.md +20 -0
  31. data/docs/PaymentResponse.md +18 -0
  32. data/docs/PaymentsApi.md +147 -0
  33. data/docs/ResendConfirmationRequest.md +18 -0
  34. data/docs/SignInRequest.md +20 -0
  35. data/docs/SignUpRequest.md +22 -0
  36. data/docs/User.md +22 -0
  37. data/lib/weft/facilitator/client.rb +89 -0
  38. data/lib/weft/facilitator/fee.rb +47 -0
  39. data/lib/weft/facilitator/middleware.rb +190 -0
  40. data/lib/weft/generated/api/account_api.rb +77 -0
  41. data/lib/weft/generated/api/agents_api.rb +148 -0
  42. data/lib/weft/generated/api/api_keys_api.rb +204 -0
  43. data/lib/weft/generated/api/auth_api.rb +418 -0
  44. data/lib/weft/generated/api/default_api.rb +77 -0
  45. data/lib/weft/generated/api/payments_api.rb +148 -0
  46. data/lib/weft/generated/api_client.rb +397 -0
  47. data/lib/weft/generated/api_error.rb +58 -0
  48. data/lib/weft/generated/api_model_base.rb +88 -0
  49. data/lib/weft/generated/configuration.rb +317 -0
  50. data/lib/weft/generated/models/account_details.rb +310 -0
  51. data/lib/weft/generated/models/agent.rb +417 -0
  52. data/lib/weft/generated/models/agent_list_response.rb +192 -0
  53. data/lib/weft/generated/models/agent_response.rb +164 -0
  54. data/lib/weft/generated/models/agent_stats.rb +201 -0
  55. data/lib/weft/generated/models/api_key.rb +244 -0
  56. data/lib/weft/generated/models/api_key_created.rb +252 -0
  57. data/lib/weft/generated/models/api_key_created_response.rb +164 -0
  58. data/lib/weft/generated/models/api_key_list_response.rb +166 -0
  59. data/lib/weft/generated/models/auth_response.rb +164 -0
  60. data/lib/weft/generated/models/auth_response_data.rb +199 -0
  61. data/lib/weft/generated/models/confirm_request.rb +164 -0
  62. data/lib/weft/generated/models/create_api_key_request.rb +148 -0
  63. data/lib/weft/generated/models/error.rb +208 -0
  64. data/lib/weft/generated/models/error_response.rb +164 -0
  65. data/lib/weft/generated/models/me_response.rb +164 -0
  66. data/lib/weft/generated/models/message_response.rb +164 -0
  67. data/lib/weft/generated/models/message_response_data.rb +164 -0
  68. data/lib/weft/generated/models/pagination.rb +242 -0
  69. data/lib/weft/generated/models/password_reset_request.rb +164 -0
  70. data/lib/weft/generated/models/password_update_request.rb +216 -0
  71. data/lib/weft/generated/models/payment.rb +437 -0
  72. data/lib/weft/generated/models/payment_list_response.rb +192 -0
  73. data/lib/weft/generated/models/payment_response.rb +164 -0
  74. data/lib/weft/generated/models/resend_confirmation_request.rb +164 -0
  75. data/lib/weft/generated/models/sign_in_request.rb +190 -0
  76. data/lib/weft/generated/models/sign_up_request.rb +216 -0
  77. data/lib/weft/generated/models/user.rb +199 -0
  78. data/lib/weft/generated/version.rb +15 -0
  79. data/lib/weft/generated.rb +4 -0
  80. data/lib/weft/sdk.rb +10 -0
  81. metadata +123 -0
@@ -0,0 +1,417 @@
1
+ =begin
2
+ #Weft API
3
+
4
+ #API for agent-first payments and discovery.
5
+
6
+ The version of the OpenAPI document: 0.2.1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Weft
17
+ class Agent < ApiModelBase
18
+ attr_accessor :id
19
+
20
+ attr_accessor :name
21
+
22
+ attr_accessor :slug
23
+
24
+ attr_accessor :wallet_address
25
+
26
+ attr_accessor :description
27
+
28
+ attr_accessor :category
29
+
30
+ attr_accessor :visibility
31
+
32
+ attr_accessor :verified
33
+
34
+ # Whether the agent is claimed by a user
35
+ attr_accessor :claimed
36
+
37
+ attr_accessor :stats
38
+
39
+ attr_accessor :created_at
40
+
41
+ class EnumAttributeValidator
42
+ attr_reader :datatype
43
+ attr_reader :allowable_values
44
+
45
+ def initialize(datatype, allowable_values)
46
+ @allowable_values = allowable_values.map do |value|
47
+ case datatype.to_s
48
+ when /Integer/i
49
+ value.to_i
50
+ when /Float/i
51
+ value.to_f
52
+ else
53
+ value
54
+ end
55
+ end
56
+ end
57
+
58
+ def valid?(value)
59
+ !value || allowable_values.include?(value)
60
+ end
61
+ end
62
+
63
+ # Attribute mapping from ruby-style variable name to JSON key.
64
+ def self.attribute_map
65
+ {
66
+ :'id' => :'id',
67
+ :'name' => :'name',
68
+ :'slug' => :'slug',
69
+ :'wallet_address' => :'wallet_address',
70
+ :'description' => :'description',
71
+ :'category' => :'category',
72
+ :'visibility' => :'visibility',
73
+ :'verified' => :'verified',
74
+ :'claimed' => :'claimed',
75
+ :'stats' => :'stats',
76
+ :'created_at' => :'created_at'
77
+ }
78
+ end
79
+
80
+ # Returns attribute mapping this model knows about
81
+ def self.acceptable_attribute_map
82
+ attribute_map
83
+ end
84
+
85
+ # Returns all the JSON keys this model knows about
86
+ def self.acceptable_attributes
87
+ acceptable_attribute_map.values
88
+ end
89
+
90
+ # Attribute type mapping.
91
+ def self.openapi_types
92
+ {
93
+ :'id' => :'Integer',
94
+ :'name' => :'String',
95
+ :'slug' => :'String',
96
+ :'wallet_address' => :'String',
97
+ :'description' => :'String',
98
+ :'category' => :'String',
99
+ :'visibility' => :'String',
100
+ :'verified' => :'Boolean',
101
+ :'claimed' => :'Boolean',
102
+ :'stats' => :'AgentStats',
103
+ :'created_at' => :'Time'
104
+ }
105
+ end
106
+
107
+ # List of attributes with nullable: true
108
+ def self.openapi_nullable
109
+ Set.new([
110
+ ])
111
+ end
112
+
113
+ # Initializes the object
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ def initialize(attributes = {})
116
+ if (!attributes.is_a?(Hash))
117
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::Agent` initialize method"
118
+ end
119
+
120
+ # check to see if the attribute exists and convert string to symbol for hash key
121
+ acceptable_attribute_map = self.class.acceptable_attribute_map
122
+ attributes = attributes.each_with_object({}) { |(k, v), h|
123
+ if (!acceptable_attribute_map.key?(k.to_sym))
124
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::Agent`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
125
+ end
126
+ h[k.to_sym] = v
127
+ }
128
+
129
+ if attributes.key?(:'id')
130
+ self.id = attributes[:'id']
131
+ else
132
+ self.id = nil
133
+ end
134
+
135
+ if attributes.key?(:'name')
136
+ self.name = attributes[:'name']
137
+ else
138
+ self.name = nil
139
+ end
140
+
141
+ if attributes.key?(:'slug')
142
+ self.slug = attributes[:'slug']
143
+ else
144
+ self.slug = nil
145
+ end
146
+
147
+ if attributes.key?(:'wallet_address')
148
+ self.wallet_address = attributes[:'wallet_address']
149
+ else
150
+ self.wallet_address = nil
151
+ end
152
+
153
+ if attributes.key?(:'description')
154
+ self.description = attributes[:'description']
155
+ end
156
+
157
+ if attributes.key?(:'category')
158
+ self.category = attributes[:'category']
159
+ else
160
+ self.category = nil
161
+ end
162
+
163
+ if attributes.key?(:'visibility')
164
+ self.visibility = attributes[:'visibility']
165
+ else
166
+ self.visibility = nil
167
+ end
168
+
169
+ if attributes.key?(:'verified')
170
+ self.verified = attributes[:'verified']
171
+ else
172
+ self.verified = nil
173
+ end
174
+
175
+ if attributes.key?(:'claimed')
176
+ self.claimed = attributes[:'claimed']
177
+ else
178
+ self.claimed = nil
179
+ end
180
+
181
+ if attributes.key?(:'stats')
182
+ self.stats = attributes[:'stats']
183
+ end
184
+
185
+ if attributes.key?(:'created_at')
186
+ self.created_at = attributes[:'created_at']
187
+ else
188
+ self.created_at = nil
189
+ end
190
+ end
191
+
192
+ # Show invalid properties with the reasons. Usually used together with valid?
193
+ # @return Array for valid properties with the reasons
194
+ def list_invalid_properties
195
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
196
+ invalid_properties = Array.new
197
+ if @id.nil?
198
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
199
+ end
200
+
201
+ if @name.nil?
202
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
203
+ end
204
+
205
+ if @slug.nil?
206
+ invalid_properties.push('invalid value for "slug", slug cannot be nil.')
207
+ end
208
+
209
+ if @wallet_address.nil?
210
+ invalid_properties.push('invalid value for "wallet_address", wallet_address cannot be nil.')
211
+ end
212
+
213
+ if @category.nil?
214
+ invalid_properties.push('invalid value for "category", category cannot be nil.')
215
+ end
216
+
217
+ if @visibility.nil?
218
+ invalid_properties.push('invalid value for "visibility", visibility cannot be nil.')
219
+ end
220
+
221
+ if @verified.nil?
222
+ invalid_properties.push('invalid value for "verified", verified cannot be nil.')
223
+ end
224
+
225
+ if @claimed.nil?
226
+ invalid_properties.push('invalid value for "claimed", claimed cannot be nil.')
227
+ end
228
+
229
+ if @created_at.nil?
230
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
231
+ end
232
+
233
+ invalid_properties
234
+ end
235
+
236
+ # Check to see if the all the properties in the model are valid
237
+ # @return true if the model is valid
238
+ def valid?
239
+ warn '[DEPRECATED] the `valid?` method is obsolete'
240
+ return false if @id.nil?
241
+ return false if @name.nil?
242
+ return false if @slug.nil?
243
+ return false if @wallet_address.nil?
244
+ return false if @category.nil?
245
+ category_validator = EnumAttributeValidator.new('String', ["agent", "data_seller", "service_provider", "facilitator"])
246
+ return false unless category_validator.valid?(@category)
247
+ return false if @visibility.nil?
248
+ visibility_validator = EnumAttributeValidator.new('String', ["public_profile", "private_profile", "unlisted"])
249
+ return false unless visibility_validator.valid?(@visibility)
250
+ return false if @verified.nil?
251
+ return false if @claimed.nil?
252
+ return false if @created_at.nil?
253
+ true
254
+ end
255
+
256
+ # Custom attribute writer method with validation
257
+ # @param [Object] id Value to be assigned
258
+ def id=(id)
259
+ if id.nil?
260
+ fail ArgumentError, 'id cannot be nil'
261
+ end
262
+
263
+ @id = id
264
+ end
265
+
266
+ # Custom attribute writer method with validation
267
+ # @param [Object] name Value to be assigned
268
+ def name=(name)
269
+ if name.nil?
270
+ fail ArgumentError, 'name cannot be nil'
271
+ end
272
+
273
+ @name = name
274
+ end
275
+
276
+ # Custom attribute writer method with validation
277
+ # @param [Object] slug Value to be assigned
278
+ def slug=(slug)
279
+ if slug.nil?
280
+ fail ArgumentError, 'slug cannot be nil'
281
+ end
282
+
283
+ @slug = slug
284
+ end
285
+
286
+ # Custom attribute writer method with validation
287
+ # @param [Object] wallet_address Value to be assigned
288
+ def wallet_address=(wallet_address)
289
+ if wallet_address.nil?
290
+ fail ArgumentError, 'wallet_address cannot be nil'
291
+ end
292
+
293
+ @wallet_address = wallet_address
294
+ end
295
+
296
+ # Custom attribute writer method checking allowed values (enum).
297
+ # @param [Object] category Object to be assigned
298
+ def category=(category)
299
+ validator = EnumAttributeValidator.new('String', ["agent", "data_seller", "service_provider", "facilitator"])
300
+ unless validator.valid?(category)
301
+ fail ArgumentError, "invalid value for \"category\", must be one of #{validator.allowable_values}."
302
+ end
303
+ @category = category
304
+ end
305
+
306
+ # Custom attribute writer method checking allowed values (enum).
307
+ # @param [Object] visibility Object to be assigned
308
+ def visibility=(visibility)
309
+ validator = EnumAttributeValidator.new('String', ["public_profile", "private_profile", "unlisted"])
310
+ unless validator.valid?(visibility)
311
+ fail ArgumentError, "invalid value for \"visibility\", must be one of #{validator.allowable_values}."
312
+ end
313
+ @visibility = visibility
314
+ end
315
+
316
+ # Custom attribute writer method with validation
317
+ # @param [Object] verified Value to be assigned
318
+ def verified=(verified)
319
+ if verified.nil?
320
+ fail ArgumentError, 'verified cannot be nil'
321
+ end
322
+
323
+ @verified = verified
324
+ end
325
+
326
+ # Custom attribute writer method with validation
327
+ # @param [Object] claimed Value to be assigned
328
+ def claimed=(claimed)
329
+ if claimed.nil?
330
+ fail ArgumentError, 'claimed cannot be nil'
331
+ end
332
+
333
+ @claimed = claimed
334
+ end
335
+
336
+ # Custom attribute writer method with validation
337
+ # @param [Object] created_at Value to be assigned
338
+ def created_at=(created_at)
339
+ if created_at.nil?
340
+ fail ArgumentError, 'created_at cannot be nil'
341
+ end
342
+
343
+ @created_at = created_at
344
+ end
345
+
346
+ # Checks equality by comparing each attribute.
347
+ # @param [Object] Object to be compared
348
+ def ==(o)
349
+ return true if self.equal?(o)
350
+ self.class == o.class &&
351
+ id == o.id &&
352
+ name == o.name &&
353
+ slug == o.slug &&
354
+ wallet_address == o.wallet_address &&
355
+ description == o.description &&
356
+ category == o.category &&
357
+ visibility == o.visibility &&
358
+ verified == o.verified &&
359
+ claimed == o.claimed &&
360
+ stats == o.stats &&
361
+ created_at == o.created_at
362
+ end
363
+
364
+ # @see the `==` method
365
+ # @param [Object] Object to be compared
366
+ def eql?(o)
367
+ self == o
368
+ end
369
+
370
+ # Calculates hash code according to all attributes.
371
+ # @return [Integer] Hash code
372
+ def hash
373
+ [id, name, slug, wallet_address, description, category, visibility, verified, claimed, stats, created_at].hash
374
+ end
375
+
376
+ # Builds the object from hash
377
+ # @param [Hash] attributes Model attributes in the form of hash
378
+ # @return [Object] Returns the model itself
379
+ def self.build_from_hash(attributes)
380
+ return nil unless attributes.is_a?(Hash)
381
+ attributes = attributes.transform_keys(&:to_sym)
382
+ transformed_hash = {}
383
+ openapi_types.each_pair do |key, type|
384
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
385
+ transformed_hash["#{key}"] = nil
386
+ elsif type =~ /\AArray<(.*)>/i
387
+ # check to ensure the input is an array given that the attribute
388
+ # is documented as an array but the input is not
389
+ if attributes[attribute_map[key]].is_a?(Array)
390
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
391
+ end
392
+ elsif !attributes[attribute_map[key]].nil?
393
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
394
+ end
395
+ end
396
+ new(transformed_hash)
397
+ end
398
+
399
+ # Returns the object in the form of hash
400
+ # @return [Hash] Returns the object in the form of hash
401
+ def to_hash
402
+ hash = {}
403
+ self.class.attribute_map.each_pair do |attr, param|
404
+ value = self.send(attr)
405
+ if value.nil?
406
+ is_nullable = self.class.openapi_nullable.include?(attr)
407
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
408
+ end
409
+
410
+ hash[param] = _to_hash(value)
411
+ end
412
+ hash
413
+ end
414
+
415
+ end
416
+
417
+ end
@@ -0,0 +1,192 @@
1
+ =begin
2
+ #Weft API
3
+
4
+ #API for agent-first payments and discovery.
5
+
6
+ The version of the OpenAPI document: 0.2.1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Weft
17
+ class AgentListResponse < ApiModelBase
18
+ attr_accessor :data
19
+
20
+ attr_accessor :pagination
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'data' => :'data',
26
+ :'pagination' => :'pagination'
27
+ }
28
+ end
29
+
30
+ # Returns attribute mapping this model knows about
31
+ def self.acceptable_attribute_map
32
+ attribute_map
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ acceptable_attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'data' => :'Array<Agent>',
44
+ :'pagination' => :'Pagination'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::AgentListResponse` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ acceptable_attribute_map = self.class.acceptable_attribute_map
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!acceptable_attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::AgentListResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'data')
71
+ if (value = attributes[:'data']).is_a?(Array)
72
+ self.data = value
73
+ end
74
+ else
75
+ self.data = nil
76
+ end
77
+
78
+ if attributes.key?(:'pagination')
79
+ self.pagination = attributes[:'pagination']
80
+ else
81
+ self.pagination = nil
82
+ end
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properties with the reasons
87
+ def list_invalid_properties
88
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
89
+ invalid_properties = Array.new
90
+ if @data.nil?
91
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
92
+ end
93
+
94
+ if @pagination.nil?
95
+ invalid_properties.push('invalid value for "pagination", pagination cannot be nil.')
96
+ end
97
+
98
+ invalid_properties
99
+ end
100
+
101
+ # Check to see if the all the properties in the model are valid
102
+ # @return true if the model is valid
103
+ def valid?
104
+ warn '[DEPRECATED] the `valid?` method is obsolete'
105
+ return false if @data.nil?
106
+ return false if @pagination.nil?
107
+ true
108
+ end
109
+
110
+ # Custom attribute writer method with validation
111
+ # @param [Object] data Value to be assigned
112
+ def data=(data)
113
+ if data.nil?
114
+ fail ArgumentError, 'data cannot be nil'
115
+ end
116
+
117
+ @data = data
118
+ end
119
+
120
+ # Custom attribute writer method with validation
121
+ # @param [Object] pagination Value to be assigned
122
+ def pagination=(pagination)
123
+ if pagination.nil?
124
+ fail ArgumentError, 'pagination cannot be nil'
125
+ end
126
+
127
+ @pagination = pagination
128
+ end
129
+
130
+ # Checks equality by comparing each attribute.
131
+ # @param [Object] Object to be compared
132
+ def ==(o)
133
+ return true if self.equal?(o)
134
+ self.class == o.class &&
135
+ data == o.data &&
136
+ pagination == o.pagination
137
+ end
138
+
139
+ # @see the `==` method
140
+ # @param [Object] Object to be compared
141
+ def eql?(o)
142
+ self == o
143
+ end
144
+
145
+ # Calculates hash code according to all attributes.
146
+ # @return [Integer] Hash code
147
+ def hash
148
+ [data, pagination].hash
149
+ end
150
+
151
+ # Builds the object from hash
152
+ # @param [Hash] attributes Model attributes in the form of hash
153
+ # @return [Object] Returns the model itself
154
+ def self.build_from_hash(attributes)
155
+ return nil unless attributes.is_a?(Hash)
156
+ attributes = attributes.transform_keys(&:to_sym)
157
+ transformed_hash = {}
158
+ openapi_types.each_pair do |key, type|
159
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
160
+ transformed_hash["#{key}"] = nil
161
+ elsif type =~ /\AArray<(.*)>/i
162
+ # check to ensure the input is an array given that the attribute
163
+ # is documented as an array but the input is not
164
+ if attributes[attribute_map[key]].is_a?(Array)
165
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
166
+ end
167
+ elsif !attributes[attribute_map[key]].nil?
168
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
169
+ end
170
+ end
171
+ new(transformed_hash)
172
+ end
173
+
174
+ # Returns the object in the form of hash
175
+ # @return [Hash] Returns the object in the form of hash
176
+ def to_hash
177
+ hash = {}
178
+ self.class.attribute_map.each_pair do |attr, param|
179
+ value = self.send(attr)
180
+ if value.nil?
181
+ is_nullable = self.class.openapi_nullable.include?(attr)
182
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
183
+ end
184
+
185
+ hash[param] = _to_hash(value)
186
+ end
187
+ hash
188
+ end
189
+
190
+ end
191
+
192
+ end