fountain_partner_api_client 0.0.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 (97) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +128 -0
  4. data/Rakefile +10 -0
  5. data/docs/DefaultApi.md +385 -0
  6. data/docs/V1PartnersIdApplicantsApplicantIdDetailsPostRequest.md +18 -0
  7. data/docs/V1PartnersIdApplicantsApplicantIdDetailsPostRequestApplicant.md +18 -0
  8. data/docs/V1PartnersIdApplicantsApplicantIdDetailsPostRequestApplicantPartnerDetails.md +26 -0
  9. data/docs/V1PartnersIdApplicantsApplicantIdPut200Response.md +20 -0
  10. data/docs/V1PartnersIdApplicantsApplicantIdPutRequest.md +18 -0
  11. data/docs/V1PartnersIdApplicantsApplicantIdPutRequestApplicant.md +18 -0
  12. data/docs/V1PartnersIdApplicantsApplicantIdPutRequestApplicantLabelsInner.md +18 -0
  13. data/docs/V1PartnersIdApplicantsApplicantIdStatusPostRequest.md +18 -0
  14. data/docs/V1PartnersIdApplicantsApplicantIdStatusPostRequestApplicant.md +18 -0
  15. data/docs/V1PartnersIdApplicantsApplicantIdStatusPostRequestApplicantPartnerStatus.md +26 -0
  16. data/docs/V1PartnersIdGet200Response.md +18 -0
  17. data/docs/V1PartnersIdGet200Response1.md +18 -0
  18. data/docs/V1PartnersIdGet200Response1Data.md +22 -0
  19. data/docs/V1PartnersIdGet200Response1DataAttributes.md +42 -0
  20. data/docs/V1PartnersIdGet200ResponseData.md +22 -0
  21. data/docs/V1PartnersIdGet200ResponseDataAttributes.md +38 -0
  22. data/docs/V1PartnersIdGetRequest.md +18 -0
  23. data/docs/V1PartnersIdGetRequestPartner.md +38 -0
  24. data/fountain_partner_api_client.gemspec +38 -0
  25. data/git_push.sh +57 -0
  26. data/lib/fountain_partner_api_client/api/default_api.rb +379 -0
  27. data/lib/fountain_partner_api_client/api_client.rb +392 -0
  28. data/lib/fountain_partner_api_client/api_error.rb +57 -0
  29. data/lib/fountain_partner_api_client/configuration.rb +279 -0
  30. data/lib/fountain_partner_api_client/models/v1_partners_id_applicants_applicant_id_details_post_request.rb +219 -0
  31. data/lib/fountain_partner_api_client/models/v1_partners_id_applicants_applicant_id_details_post_request_applicant.rb +219 -0
  32. data/lib/fountain_partner_api_client/models/v1_partners_id_applicants_applicant_id_details_post_request_applicant_partner_details.rb +255 -0
  33. data/lib/fountain_partner_api_client/models/v1_partners_id_applicants_applicant_id_put200_response.rb +230 -0
  34. data/lib/fountain_partner_api_client/models/v1_partners_id_applicants_applicant_id_put_request.rb +219 -0
  35. data/lib/fountain_partner_api_client/models/v1_partners_id_applicants_applicant_id_put_request_applicant.rb +221 -0
  36. data/lib/fountain_partner_api_client/models/v1_partners_id_applicants_applicant_id_put_request_applicant_labels_inner.rb +219 -0
  37. data/lib/fountain_partner_api_client/models/v1_partners_id_applicants_applicant_id_status_post_request.rb +219 -0
  38. data/lib/fountain_partner_api_client/models/v1_partners_id_applicants_applicant_id_status_post_request_applicant.rb +219 -0
  39. data/lib/fountain_partner_api_client/models/v1_partners_id_applicants_applicant_id_status_post_request_applicant_partner_status.rb +255 -0
  40. data/lib/fountain_partner_api_client/models/v1_partners_id_get200_response.rb +219 -0
  41. data/lib/fountain_partner_api_client/models/v1_partners_id_get200_response1.rb +219 -0
  42. data/lib/fountain_partner_api_client/models/v1_partners_id_get200_response1_data.rb +237 -0
  43. data/lib/fountain_partner_api_client/models/v1_partners_id_get200_response1_data_attributes.rb +327 -0
  44. data/lib/fountain_partner_api_client/models/v1_partners_id_get200_response_data.rb +237 -0
  45. data/lib/fountain_partner_api_client/models/v1_partners_id_get200_response_data_attributes.rb +309 -0
  46. data/lib/fountain_partner_api_client/models/v1_partners_id_get_request.rb +219 -0
  47. data/lib/fountain_partner_api_client/models/v1_partners_id_get_request_partner.rb +309 -0
  48. data/lib/fountain_partner_api_client/version.rb +15 -0
  49. data/lib/fountain_partner_api_client.rb +58 -0
  50. data/lib/openapi_client/api/default_api.rb +379 -0
  51. data/lib/openapi_client/api_client.rb +392 -0
  52. data/lib/openapi_client/api_error.rb +57 -0
  53. data/lib/openapi_client/configuration.rb +279 -0
  54. data/lib/openapi_client/models/v1_partners_id_applicants_applicant_id_details_post_request.rb +219 -0
  55. data/lib/openapi_client/models/v1_partners_id_applicants_applicant_id_details_post_request_applicant.rb +219 -0
  56. data/lib/openapi_client/models/v1_partners_id_applicants_applicant_id_details_post_request_applicant_partner_details.rb +255 -0
  57. data/lib/openapi_client/models/v1_partners_id_applicants_applicant_id_put200_response.rb +230 -0
  58. data/lib/openapi_client/models/v1_partners_id_applicants_applicant_id_put_request.rb +219 -0
  59. data/lib/openapi_client/models/v1_partners_id_applicants_applicant_id_put_request_applicant.rb +221 -0
  60. data/lib/openapi_client/models/v1_partners_id_applicants_applicant_id_put_request_applicant_labels_inner.rb +219 -0
  61. data/lib/openapi_client/models/v1_partners_id_applicants_applicant_id_status_post_request.rb +219 -0
  62. data/lib/openapi_client/models/v1_partners_id_applicants_applicant_id_status_post_request_applicant.rb +219 -0
  63. data/lib/openapi_client/models/v1_partners_id_applicants_applicant_id_status_post_request_applicant_partner_status.rb +255 -0
  64. data/lib/openapi_client/models/v1_partners_id_get200_response.rb +219 -0
  65. data/lib/openapi_client/models/v1_partners_id_get200_response1.rb +219 -0
  66. data/lib/openapi_client/models/v1_partners_id_get200_response1_data.rb +237 -0
  67. data/lib/openapi_client/models/v1_partners_id_get200_response1_data_attributes.rb +327 -0
  68. data/lib/openapi_client/models/v1_partners_id_get200_response_data.rb +237 -0
  69. data/lib/openapi_client/models/v1_partners_id_get200_response_data_attributes.rb +309 -0
  70. data/lib/openapi_client/models/v1_partners_id_get_request.rb +219 -0
  71. data/lib/openapi_client/models/v1_partners_id_get_request_partner.rb +309 -0
  72. data/lib/openapi_client/version.rb +15 -0
  73. data/lib/openapi_client.rb +58 -0
  74. data/openapi_client.gemspec +38 -0
  75. data/spec/api/default_api_spec.rb +99 -0
  76. data/spec/api_client_spec.rb +226 -0
  77. data/spec/configuration_spec.rb +42 -0
  78. data/spec/models/v1_partners_id_applicants_applicant_id_details_post_request_applicant_partner_details_spec.rb +58 -0
  79. data/spec/models/v1_partners_id_applicants_applicant_id_details_post_request_applicant_spec.rb +34 -0
  80. data/spec/models/v1_partners_id_applicants_applicant_id_details_post_request_spec.rb +34 -0
  81. data/spec/models/v1_partners_id_applicants_applicant_id_put200_response_spec.rb +40 -0
  82. data/spec/models/v1_partners_id_applicants_applicant_id_put_request_applicant_labels_inner_spec.rb +34 -0
  83. data/spec/models/v1_partners_id_applicants_applicant_id_put_request_applicant_spec.rb +34 -0
  84. data/spec/models/v1_partners_id_applicants_applicant_id_put_request_spec.rb +34 -0
  85. data/spec/models/v1_partners_id_applicants_applicant_id_status_post_request_applicant_partner_status_spec.rb +58 -0
  86. data/spec/models/v1_partners_id_applicants_applicant_id_status_post_request_applicant_spec.rb +34 -0
  87. data/spec/models/v1_partners_id_applicants_applicant_id_status_post_request_spec.rb +34 -0
  88. data/spec/models/v1_partners_id_get200_response1_data_attributes_spec.rb +106 -0
  89. data/spec/models/v1_partners_id_get200_response1_data_spec.rb +46 -0
  90. data/spec/models/v1_partners_id_get200_response1_spec.rb +34 -0
  91. data/spec/models/v1_partners_id_get200_response_data_attributes_spec.rb +94 -0
  92. data/spec/models/v1_partners_id_get200_response_data_spec.rb +46 -0
  93. data/spec/models/v1_partners_id_get200_response_spec.rb +34 -0
  94. data/spec/models/v1_partners_id_get_request_partner_spec.rb +94 -0
  95. data/spec/models/v1_partners_id_get_request_spec.rb +34 -0
  96. data/spec/spec_helper.rb +111 -0
  97. metadata +200 -0
@@ -0,0 +1,309 @@
1
+ =begin
2
+ #Fountain Partner Docs
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.2.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OpenapiClient
17
+ class V1PartnersIdGet200ResponseDataAttributes
18
+ attr_accessor :api_key
19
+
20
+ attr_accessor :applicant_redirect_url
21
+
22
+ attr_accessor :applicant_webhook
23
+
24
+ attr_accessor :install_webhook
25
+
26
+ attr_accessor :label_keys
27
+
28
+ attr_accessor :name
29
+
30
+ attr_accessor :requested_attributes
31
+
32
+ attr_accessor :settings_auth_header
33
+
34
+ attr_accessor :settings_auth_method
35
+
36
+ attr_accessor :settings_webhook
37
+
38
+ attr_accessor :uninstall_webhook
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'api_key' => :'api_key',
44
+ :'applicant_redirect_url' => :'applicant_redirect_url',
45
+ :'applicant_webhook' => :'applicant_webhook',
46
+ :'install_webhook' => :'install_webhook',
47
+ :'label_keys' => :'label_keys',
48
+ :'name' => :'name',
49
+ :'requested_attributes' => :'requested_attributes',
50
+ :'settings_auth_header' => :'settings_auth_header',
51
+ :'settings_auth_method' => :'settings_auth_method',
52
+ :'settings_webhook' => :'settings_webhook',
53
+ :'uninstall_webhook' => :'uninstall_webhook'
54
+ }
55
+ end
56
+
57
+ # Returns all the JSON keys this model knows about
58
+ def self.acceptable_attributes
59
+ attribute_map.values
60
+ end
61
+
62
+ # Attribute type mapping.
63
+ def self.openapi_types
64
+ {
65
+ :'api_key' => :'String',
66
+ :'applicant_redirect_url' => :'String',
67
+ :'applicant_webhook' => :'String',
68
+ :'install_webhook' => :'String',
69
+ :'label_keys' => :'Array',
70
+ :'name' => :'String',
71
+ :'requested_attributes' => :'Array',
72
+ :'settings_auth_header' => :'String',
73
+ :'settings_auth_method' => :'String',
74
+ :'settings_webhook' => :'String',
75
+ :'uninstall_webhook' => :'String'
76
+ }
77
+ end
78
+
79
+ # List of attributes with nullable: true
80
+ def self.openapi_nullable
81
+ Set.new([
82
+ ])
83
+ end
84
+
85
+ # Initializes the object
86
+ # @param [Hash] attributes Model attributes in the form of hash
87
+ def initialize(attributes = {})
88
+ if (!attributes.is_a?(Hash))
89
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::V1PartnersIdGet200ResponseDataAttributes` initialize method"
90
+ end
91
+
92
+ # check to see if the attribute exists and convert string to symbol for hash key
93
+ attributes = attributes.each_with_object({}) { |(k, v), h|
94
+ if (!self.class.attribute_map.key?(k.to_sym))
95
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::V1PartnersIdGet200ResponseDataAttributes`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
96
+ end
97
+ h[k.to_sym] = v
98
+ }
99
+
100
+ if attributes.key?(:'api_key')
101
+ self.api_key = attributes[:'api_key']
102
+ end
103
+
104
+ if attributes.key?(:'applicant_redirect_url')
105
+ self.applicant_redirect_url = attributes[:'applicant_redirect_url']
106
+ end
107
+
108
+ if attributes.key?(:'applicant_webhook')
109
+ self.applicant_webhook = attributes[:'applicant_webhook']
110
+ end
111
+
112
+ if attributes.key?(:'install_webhook')
113
+ self.install_webhook = attributes[:'install_webhook']
114
+ end
115
+
116
+ if attributes.key?(:'label_keys')
117
+ self.label_keys = attributes[:'label_keys']
118
+ end
119
+
120
+ if attributes.key?(:'name')
121
+ self.name = attributes[:'name']
122
+ end
123
+
124
+ if attributes.key?(:'requested_attributes')
125
+ self.requested_attributes = attributes[:'requested_attributes']
126
+ end
127
+
128
+ if attributes.key?(:'settings_auth_header')
129
+ self.settings_auth_header = attributes[:'settings_auth_header']
130
+ end
131
+
132
+ if attributes.key?(:'settings_auth_method')
133
+ self.settings_auth_method = attributes[:'settings_auth_method']
134
+ end
135
+
136
+ if attributes.key?(:'settings_webhook')
137
+ self.settings_webhook = attributes[:'settings_webhook']
138
+ end
139
+
140
+ if attributes.key?(:'uninstall_webhook')
141
+ self.uninstall_webhook = attributes[:'uninstall_webhook']
142
+ end
143
+ end
144
+
145
+ # Show invalid properties with the reasons. Usually used together with valid?
146
+ # @return Array for valid properties with the reasons
147
+ def list_invalid_properties
148
+ invalid_properties = Array.new
149
+ invalid_properties
150
+ end
151
+
152
+ # Check to see if the all the properties in the model are valid
153
+ # @return true if the model is valid
154
+ def valid?
155
+ true
156
+ end
157
+
158
+ # Checks equality by comparing each attribute.
159
+ # @param [Object] Object to be compared
160
+ def ==(o)
161
+ return true if self.equal?(o)
162
+ self.class == o.class &&
163
+ api_key == o.api_key &&
164
+ applicant_redirect_url == o.applicant_redirect_url &&
165
+ applicant_webhook == o.applicant_webhook &&
166
+ install_webhook == o.install_webhook &&
167
+ label_keys == o.label_keys &&
168
+ name == o.name &&
169
+ requested_attributes == o.requested_attributes &&
170
+ settings_auth_header == o.settings_auth_header &&
171
+ settings_auth_method == o.settings_auth_method &&
172
+ settings_webhook == o.settings_webhook &&
173
+ uninstall_webhook == o.uninstall_webhook
174
+ end
175
+
176
+ # @see the `==` method
177
+ # @param [Object] Object to be compared
178
+ def eql?(o)
179
+ self == o
180
+ end
181
+
182
+ # Calculates hash code according to all attributes.
183
+ # @return [Integer] Hash code
184
+ def hash
185
+ [api_key, applicant_redirect_url, applicant_webhook, install_webhook, label_keys, name, requested_attributes, settings_auth_header, settings_auth_method, settings_webhook, uninstall_webhook].hash
186
+ end
187
+
188
+ # Builds the object from hash
189
+ # @param [Hash] attributes Model attributes in the form of hash
190
+ # @return [Object] Returns the model itself
191
+ def self.build_from_hash(attributes)
192
+ new.build_from_hash(attributes)
193
+ end
194
+
195
+ # Builds the object from hash
196
+ # @param [Hash] attributes Model attributes in the form of hash
197
+ # @return [Object] Returns the model itself
198
+ def build_from_hash(attributes)
199
+ return nil unless attributes.is_a?(Hash)
200
+ attributes = attributes.transform_keys(&:to_sym)
201
+ self.class.openapi_types.each_pair do |key, type|
202
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
203
+ self.send("#{key}=", nil)
204
+ elsif type =~ /\AArray<(.*)>/i
205
+ # check to ensure the input is an array given that the attribute
206
+ # is documented as an array but the input is not
207
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
208
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
209
+ end
210
+ elsif !attributes[self.class.attribute_map[key]].nil?
211
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
212
+ end
213
+ end
214
+
215
+ self
216
+ end
217
+
218
+ # Deserializes the data based on type
219
+ # @param string type Data type
220
+ # @param string value Value to be deserialized
221
+ # @return [Object] Deserialized data
222
+ def _deserialize(type, value)
223
+ case type.to_sym
224
+ when :Time
225
+ Time.parse(value)
226
+ when :Date
227
+ Date.parse(value)
228
+ when :String
229
+ value.to_s
230
+ when :Integer
231
+ value.to_i
232
+ when :Float
233
+ value.to_f
234
+ when :Boolean
235
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
236
+ true
237
+ else
238
+ false
239
+ end
240
+ when :Object
241
+ # generic object (usually a Hash), return directly
242
+ value
243
+ when /\AArray<(?<inner_type>.+)>\z/
244
+ inner_type = Regexp.last_match[:inner_type]
245
+ value.map { |v| _deserialize(inner_type, v) }
246
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
247
+ k_type = Regexp.last_match[:k_type]
248
+ v_type = Regexp.last_match[:v_type]
249
+ {}.tap do |hash|
250
+ value.each do |k, v|
251
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
252
+ end
253
+ end
254
+ else # model
255
+ # models (e.g. Pet) or oneOf
256
+ klass = OpenapiClient.const_get(type)
257
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
258
+ end
259
+ end
260
+
261
+ # Returns the string representation of the object
262
+ # @return [String] String presentation of the object
263
+ def to_s
264
+ to_hash.to_s
265
+ end
266
+
267
+ # to_body is an alias to to_hash (backward compatibility)
268
+ # @return [Hash] Returns the object in the form of hash
269
+ def to_body
270
+ to_hash
271
+ end
272
+
273
+ # Returns the object in the form of hash
274
+ # @return [Hash] Returns the object in the form of hash
275
+ def to_hash
276
+ hash = {}
277
+ self.class.attribute_map.each_pair do |attr, param|
278
+ value = self.send(attr)
279
+ if value.nil?
280
+ is_nullable = self.class.openapi_nullable.include?(attr)
281
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
282
+ end
283
+
284
+ hash[param] = _to_hash(value)
285
+ end
286
+ hash
287
+ end
288
+
289
+ # Outputs non-array value in the form of hash
290
+ # For object, use to_hash. Otherwise, just return the value
291
+ # @param [Object] value Any valid value
292
+ # @return [Hash] Returns the value in the form of hash
293
+ def _to_hash(value)
294
+ if value.is_a?(Array)
295
+ value.compact.map { |v| _to_hash(v) }
296
+ elsif value.is_a?(Hash)
297
+ {}.tap do |hash|
298
+ value.each { |k, v| hash[k] = _to_hash(v) }
299
+ end
300
+ elsif value.respond_to? :to_hash
301
+ value.to_hash
302
+ else
303
+ value
304
+ end
305
+ end
306
+
307
+ end
308
+
309
+ end
@@ -0,0 +1,219 @@
1
+ =begin
2
+ #Fountain Partner Docs
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.2.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OpenapiClient
17
+ class V1PartnersIdGetRequest
18
+ attr_accessor :partner
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'partner' => :'partner'
24
+ }
25
+ end
26
+
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'partner' => :'V1PartnersIdGetRequestPartner'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::V1PartnersIdGetRequest` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::V1PartnersIdGetRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'partner')
61
+ self.partner = attributes[:'partner']
62
+ end
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properties with the reasons
67
+ def list_invalid_properties
68
+ invalid_properties = Array.new
69
+ invalid_properties
70
+ end
71
+
72
+ # Check to see if the all the properties in the model are valid
73
+ # @return true if the model is valid
74
+ def valid?
75
+ true
76
+ end
77
+
78
+ # Checks equality by comparing each attribute.
79
+ # @param [Object] Object to be compared
80
+ def ==(o)
81
+ return true if self.equal?(o)
82
+ self.class == o.class &&
83
+ partner == o.partner
84
+ end
85
+
86
+ # @see the `==` method
87
+ # @param [Object] Object to be compared
88
+ def eql?(o)
89
+ self == o
90
+ end
91
+
92
+ # Calculates hash code according to all attributes.
93
+ # @return [Integer] Hash code
94
+ def hash
95
+ [partner].hash
96
+ end
97
+
98
+ # Builds the object from hash
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ # @return [Object] Returns the model itself
101
+ def self.build_from_hash(attributes)
102
+ new.build_from_hash(attributes)
103
+ end
104
+
105
+ # Builds the object from hash
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ # @return [Object] Returns the model itself
108
+ def build_from_hash(attributes)
109
+ return nil unless attributes.is_a?(Hash)
110
+ attributes = attributes.transform_keys(&:to_sym)
111
+ self.class.openapi_types.each_pair do |key, type|
112
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
113
+ self.send("#{key}=", nil)
114
+ elsif type =~ /\AArray<(.*)>/i
115
+ # check to ensure the input is an array given that the attribute
116
+ # is documented as an array but the input is not
117
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
118
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
119
+ end
120
+ elsif !attributes[self.class.attribute_map[key]].nil?
121
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
122
+ end
123
+ end
124
+
125
+ self
126
+ end
127
+
128
+ # Deserializes the data based on type
129
+ # @param string type Data type
130
+ # @param string value Value to be deserialized
131
+ # @return [Object] Deserialized data
132
+ def _deserialize(type, value)
133
+ case type.to_sym
134
+ when :Time
135
+ Time.parse(value)
136
+ when :Date
137
+ Date.parse(value)
138
+ when :String
139
+ value.to_s
140
+ when :Integer
141
+ value.to_i
142
+ when :Float
143
+ value.to_f
144
+ when :Boolean
145
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
146
+ true
147
+ else
148
+ false
149
+ end
150
+ when :Object
151
+ # generic object (usually a Hash), return directly
152
+ value
153
+ when /\AArray<(?<inner_type>.+)>\z/
154
+ inner_type = Regexp.last_match[:inner_type]
155
+ value.map { |v| _deserialize(inner_type, v) }
156
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
157
+ k_type = Regexp.last_match[:k_type]
158
+ v_type = Regexp.last_match[:v_type]
159
+ {}.tap do |hash|
160
+ value.each do |k, v|
161
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
162
+ end
163
+ end
164
+ else # model
165
+ # models (e.g. Pet) or oneOf
166
+ klass = OpenapiClient.const_get(type)
167
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
168
+ end
169
+ end
170
+
171
+ # Returns the string representation of the object
172
+ # @return [String] String presentation of the object
173
+ def to_s
174
+ to_hash.to_s
175
+ end
176
+
177
+ # to_body is an alias to to_hash (backward compatibility)
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_body
180
+ to_hash
181
+ end
182
+
183
+ # Returns the object in the form of hash
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_hash
186
+ hash = {}
187
+ self.class.attribute_map.each_pair do |attr, param|
188
+ value = self.send(attr)
189
+ if value.nil?
190
+ is_nullable = self.class.openapi_nullable.include?(attr)
191
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
192
+ end
193
+
194
+ hash[param] = _to_hash(value)
195
+ end
196
+ hash
197
+ end
198
+
199
+ # Outputs non-array value in the form of hash
200
+ # For object, use to_hash. Otherwise, just return the value
201
+ # @param [Object] value Any valid value
202
+ # @return [Hash] Returns the value in the form of hash
203
+ def _to_hash(value)
204
+ if value.is_a?(Array)
205
+ value.compact.map { |v| _to_hash(v) }
206
+ elsif value.is_a?(Hash)
207
+ {}.tap do |hash|
208
+ value.each { |k, v| hash[k] = _to_hash(v) }
209
+ end
210
+ elsif value.respond_to? :to_hash
211
+ value.to_hash
212
+ else
213
+ value
214
+ end
215
+ end
216
+
217
+ end
218
+
219
+ end