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,327 @@
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 V1PartnersIdGet200Response1DataAttributes
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_password
37
+
38
+ attr_accessor :settings_username
39
+
40
+ attr_accessor :settings_webhook
41
+
42
+ attr_accessor :uninstall_webhook
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'api_key' => :'api_key',
48
+ :'applicant_redirect_url' => :'applicant_redirect_url',
49
+ :'applicant_webhook' => :'applicant_webhook',
50
+ :'install_webhook' => :'install_webhook',
51
+ :'label_keys' => :'label_keys',
52
+ :'name' => :'name',
53
+ :'requested_attributes' => :'requested_attributes',
54
+ :'settings_auth_header' => :'settings_auth_header',
55
+ :'settings_auth_method' => :'settings_auth_method',
56
+ :'settings_password' => :'settings_password',
57
+ :'settings_username' => :'settings_username',
58
+ :'settings_webhook' => :'settings_webhook',
59
+ :'uninstall_webhook' => :'uninstall_webhook'
60
+ }
61
+ end
62
+
63
+ # Returns all the JSON keys this model knows about
64
+ def self.acceptable_attributes
65
+ attribute_map.values
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.openapi_types
70
+ {
71
+ :'api_key' => :'String',
72
+ :'applicant_redirect_url' => :'String',
73
+ :'applicant_webhook' => :'String',
74
+ :'install_webhook' => :'String',
75
+ :'label_keys' => :'Array',
76
+ :'name' => :'String',
77
+ :'requested_attributes' => :'Array',
78
+ :'settings_auth_header' => :'String',
79
+ :'settings_auth_method' => :'String',
80
+ :'settings_password' => :'String',
81
+ :'settings_username' => :'String',
82
+ :'settings_webhook' => :'String',
83
+ :'uninstall_webhook' => :'String'
84
+ }
85
+ end
86
+
87
+ # List of attributes with nullable: true
88
+ def self.openapi_nullable
89
+ Set.new([
90
+ ])
91
+ end
92
+
93
+ # Initializes the object
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ def initialize(attributes = {})
96
+ if (!attributes.is_a?(Hash))
97
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::V1PartnersIdGet200Response1DataAttributes` initialize method"
98
+ end
99
+
100
+ # check to see if the attribute exists and convert string to symbol for hash key
101
+ attributes = attributes.each_with_object({}) { |(k, v), h|
102
+ if (!self.class.attribute_map.key?(k.to_sym))
103
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::V1PartnersIdGet200Response1DataAttributes`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
104
+ end
105
+ h[k.to_sym] = v
106
+ }
107
+
108
+ if attributes.key?(:'api_key')
109
+ self.api_key = attributes[:'api_key']
110
+ end
111
+
112
+ if attributes.key?(:'applicant_redirect_url')
113
+ self.applicant_redirect_url = attributes[:'applicant_redirect_url']
114
+ end
115
+
116
+ if attributes.key?(:'applicant_webhook')
117
+ self.applicant_webhook = attributes[:'applicant_webhook']
118
+ end
119
+
120
+ if attributes.key?(:'install_webhook')
121
+ self.install_webhook = attributes[:'install_webhook']
122
+ end
123
+
124
+ if attributes.key?(:'label_keys')
125
+ self.label_keys = attributes[:'label_keys']
126
+ end
127
+
128
+ if attributes.key?(:'name')
129
+ self.name = attributes[:'name']
130
+ end
131
+
132
+ if attributes.key?(:'requested_attributes')
133
+ self.requested_attributes = attributes[:'requested_attributes']
134
+ end
135
+
136
+ if attributes.key?(:'settings_auth_header')
137
+ self.settings_auth_header = attributes[:'settings_auth_header']
138
+ end
139
+
140
+ if attributes.key?(:'settings_auth_method')
141
+ self.settings_auth_method = attributes[:'settings_auth_method']
142
+ end
143
+
144
+ if attributes.key?(:'settings_password')
145
+ self.settings_password = attributes[:'settings_password']
146
+ end
147
+
148
+ if attributes.key?(:'settings_username')
149
+ self.settings_username = attributes[:'settings_username']
150
+ end
151
+
152
+ if attributes.key?(:'settings_webhook')
153
+ self.settings_webhook = attributes[:'settings_webhook']
154
+ end
155
+
156
+ if attributes.key?(:'uninstall_webhook')
157
+ self.uninstall_webhook = attributes[:'uninstall_webhook']
158
+ end
159
+ end
160
+
161
+ # Show invalid properties with the reasons. Usually used together with valid?
162
+ # @return Array for valid properties with the reasons
163
+ def list_invalid_properties
164
+ invalid_properties = Array.new
165
+ invalid_properties
166
+ end
167
+
168
+ # Check to see if the all the properties in the model are valid
169
+ # @return true if the model is valid
170
+ def valid?
171
+ true
172
+ end
173
+
174
+ # Checks equality by comparing each attribute.
175
+ # @param [Object] Object to be compared
176
+ def ==(o)
177
+ return true if self.equal?(o)
178
+ self.class == o.class &&
179
+ api_key == o.api_key &&
180
+ applicant_redirect_url == o.applicant_redirect_url &&
181
+ applicant_webhook == o.applicant_webhook &&
182
+ install_webhook == o.install_webhook &&
183
+ label_keys == o.label_keys &&
184
+ name == o.name &&
185
+ requested_attributes == o.requested_attributes &&
186
+ settings_auth_header == o.settings_auth_header &&
187
+ settings_auth_method == o.settings_auth_method &&
188
+ settings_password == o.settings_password &&
189
+ settings_username == o.settings_username &&
190
+ settings_webhook == o.settings_webhook &&
191
+ uninstall_webhook == o.uninstall_webhook
192
+ end
193
+
194
+ # @see the `==` method
195
+ # @param [Object] Object to be compared
196
+ def eql?(o)
197
+ self == o
198
+ end
199
+
200
+ # Calculates hash code according to all attributes.
201
+ # @return [Integer] Hash code
202
+ def hash
203
+ [api_key, applicant_redirect_url, applicant_webhook, install_webhook, label_keys, name, requested_attributes, settings_auth_header, settings_auth_method, settings_password, settings_username, settings_webhook, uninstall_webhook].hash
204
+ end
205
+
206
+ # Builds the object from hash
207
+ # @param [Hash] attributes Model attributes in the form of hash
208
+ # @return [Object] Returns the model itself
209
+ def self.build_from_hash(attributes)
210
+ new.build_from_hash(attributes)
211
+ end
212
+
213
+ # Builds the object from hash
214
+ # @param [Hash] attributes Model attributes in the form of hash
215
+ # @return [Object] Returns the model itself
216
+ def build_from_hash(attributes)
217
+ return nil unless attributes.is_a?(Hash)
218
+ attributes = attributes.transform_keys(&:to_sym)
219
+ self.class.openapi_types.each_pair do |key, type|
220
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
221
+ self.send("#{key}=", nil)
222
+ elsif type =~ /\AArray<(.*)>/i
223
+ # check to ensure the input is an array given that the attribute
224
+ # is documented as an array but the input is not
225
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
226
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
227
+ end
228
+ elsif !attributes[self.class.attribute_map[key]].nil?
229
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
230
+ end
231
+ end
232
+
233
+ self
234
+ end
235
+
236
+ # Deserializes the data based on type
237
+ # @param string type Data type
238
+ # @param string value Value to be deserialized
239
+ # @return [Object] Deserialized data
240
+ def _deserialize(type, value)
241
+ case type.to_sym
242
+ when :Time
243
+ Time.parse(value)
244
+ when :Date
245
+ Date.parse(value)
246
+ when :String
247
+ value.to_s
248
+ when :Integer
249
+ value.to_i
250
+ when :Float
251
+ value.to_f
252
+ when :Boolean
253
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
254
+ true
255
+ else
256
+ false
257
+ end
258
+ when :Object
259
+ # generic object (usually a Hash), return directly
260
+ value
261
+ when /\AArray<(?<inner_type>.+)>\z/
262
+ inner_type = Regexp.last_match[:inner_type]
263
+ value.map { |v| _deserialize(inner_type, v) }
264
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
265
+ k_type = Regexp.last_match[:k_type]
266
+ v_type = Regexp.last_match[:v_type]
267
+ {}.tap do |hash|
268
+ value.each do |k, v|
269
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
270
+ end
271
+ end
272
+ else # model
273
+ # models (e.g. Pet) or oneOf
274
+ klass = OpenapiClient.const_get(type)
275
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
276
+ end
277
+ end
278
+
279
+ # Returns the string representation of the object
280
+ # @return [String] String presentation of the object
281
+ def to_s
282
+ to_hash.to_s
283
+ end
284
+
285
+ # to_body is an alias to to_hash (backward compatibility)
286
+ # @return [Hash] Returns the object in the form of hash
287
+ def to_body
288
+ to_hash
289
+ end
290
+
291
+ # Returns the object in the form of hash
292
+ # @return [Hash] Returns the object in the form of hash
293
+ def to_hash
294
+ hash = {}
295
+ self.class.attribute_map.each_pair do |attr, param|
296
+ value = self.send(attr)
297
+ if value.nil?
298
+ is_nullable = self.class.openapi_nullable.include?(attr)
299
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
300
+ end
301
+
302
+ hash[param] = _to_hash(value)
303
+ end
304
+ hash
305
+ end
306
+
307
+ # Outputs non-array value in the form of hash
308
+ # For object, use to_hash. Otherwise, just return the value
309
+ # @param [Object] value Any valid value
310
+ # @return [Hash] Returns the value in the form of hash
311
+ def _to_hash(value)
312
+ if value.is_a?(Array)
313
+ value.compact.map { |v| _to_hash(v) }
314
+ elsif value.is_a?(Hash)
315
+ {}.tap do |hash|
316
+ value.each { |k, v| hash[k] = _to_hash(v) }
317
+ end
318
+ elsif value.respond_to? :to_hash
319
+ value.to_hash
320
+ else
321
+ value
322
+ end
323
+ end
324
+
325
+ end
326
+
327
+ end
@@ -0,0 +1,237 @@
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 V1PartnersIdGet200ResponseData
18
+ attr_accessor :attributes
19
+
20
+ attr_accessor :id
21
+
22
+ attr_accessor :type
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'attributes' => :'attributes',
28
+ :'id' => :'id',
29
+ :'type' => :'type'
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
+ :'attributes' => :'V1PartnersIdGet200ResponseDataAttributes',
42
+ :'id' => :'String',
43
+ :'type' => :'String'
44
+ }
45
+ end
46
+
47
+ # List of attributes with nullable: true
48
+ def self.openapi_nullable
49
+ Set.new([
50
+ ])
51
+ end
52
+
53
+ # Initializes the object
54
+ # @param [Hash] attributes Model attributes in the form of hash
55
+ def initialize(attributes = {})
56
+ if (!attributes.is_a?(Hash))
57
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::V1PartnersIdGet200ResponseData` initialize method"
58
+ end
59
+
60
+ # check to see if the attribute exists and convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}) { |(k, v), h|
62
+ if (!self.class.attribute_map.key?(k.to_sym))
63
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::V1PartnersIdGet200ResponseData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
64
+ end
65
+ h[k.to_sym] = v
66
+ }
67
+
68
+ if attributes.key?(:'attributes')
69
+ self.attributes = attributes[:'attributes']
70
+ end
71
+
72
+ if attributes.key?(:'id')
73
+ self.id = attributes[:'id']
74
+ end
75
+
76
+ if attributes.key?(:'type')
77
+ self.type = attributes[:'type']
78
+ end
79
+ end
80
+
81
+ # Show invalid properties with the reasons. Usually used together with valid?
82
+ # @return Array for valid properties with the reasons
83
+ def list_invalid_properties
84
+ invalid_properties = Array.new
85
+ invalid_properties
86
+ end
87
+
88
+ # Check to see if the all the properties in the model are valid
89
+ # @return true if the model is valid
90
+ def valid?
91
+ true
92
+ end
93
+
94
+ # Checks equality by comparing each attribute.
95
+ # @param [Object] Object to be compared
96
+ def ==(o)
97
+ return true if self.equal?(o)
98
+ self.class == o.class &&
99
+ attributes == o.attributes &&
100
+ id == o.id &&
101
+ type == o.type
102
+ end
103
+
104
+ # @see the `==` method
105
+ # @param [Object] Object to be compared
106
+ def eql?(o)
107
+ self == o
108
+ end
109
+
110
+ # Calculates hash code according to all attributes.
111
+ # @return [Integer] Hash code
112
+ def hash
113
+ [attributes, id, type].hash
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def self.build_from_hash(attributes)
120
+ new.build_from_hash(attributes)
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def build_from_hash(attributes)
127
+ return nil unless attributes.is_a?(Hash)
128
+ attributes = attributes.transform_keys(&:to_sym)
129
+ self.class.openapi_types.each_pair do |key, type|
130
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
131
+ self.send("#{key}=", nil)
132
+ elsif type =~ /\AArray<(.*)>/i
133
+ # check to ensure the input is an array given that the attribute
134
+ # is documented as an array but the input is not
135
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
136
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
137
+ end
138
+ elsif !attributes[self.class.attribute_map[key]].nil?
139
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
140
+ end
141
+ end
142
+
143
+ self
144
+ end
145
+
146
+ # Deserializes the data based on type
147
+ # @param string type Data type
148
+ # @param string value Value to be deserialized
149
+ # @return [Object] Deserialized data
150
+ def _deserialize(type, value)
151
+ case type.to_sym
152
+ when :Time
153
+ Time.parse(value)
154
+ when :Date
155
+ Date.parse(value)
156
+ when :String
157
+ value.to_s
158
+ when :Integer
159
+ value.to_i
160
+ when :Float
161
+ value.to_f
162
+ when :Boolean
163
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
164
+ true
165
+ else
166
+ false
167
+ end
168
+ when :Object
169
+ # generic object (usually a Hash), return directly
170
+ value
171
+ when /\AArray<(?<inner_type>.+)>\z/
172
+ inner_type = Regexp.last_match[:inner_type]
173
+ value.map { |v| _deserialize(inner_type, v) }
174
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
175
+ k_type = Regexp.last_match[:k_type]
176
+ v_type = Regexp.last_match[:v_type]
177
+ {}.tap do |hash|
178
+ value.each do |k, v|
179
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
180
+ end
181
+ end
182
+ else # model
183
+ # models (e.g. Pet) or oneOf
184
+ klass = OpenapiClient.const_get(type)
185
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
186
+ end
187
+ end
188
+
189
+ # Returns the string representation of the object
190
+ # @return [String] String presentation of the object
191
+ def to_s
192
+ to_hash.to_s
193
+ end
194
+
195
+ # to_body is an alias to to_hash (backward compatibility)
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_body
198
+ to_hash
199
+ end
200
+
201
+ # Returns the object in the form of hash
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_hash
204
+ hash = {}
205
+ self.class.attribute_map.each_pair do |attr, param|
206
+ value = self.send(attr)
207
+ if value.nil?
208
+ is_nullable = self.class.openapi_nullable.include?(attr)
209
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
210
+ end
211
+
212
+ hash[param] = _to_hash(value)
213
+ end
214
+ hash
215
+ end
216
+
217
+ # Outputs non-array value in the form of hash
218
+ # For object, use to_hash. Otherwise, just return the value
219
+ # @param [Object] value Any valid value
220
+ # @return [Hash] Returns the value in the form of hash
221
+ def _to_hash(value)
222
+ if value.is_a?(Array)
223
+ value.compact.map { |v| _to_hash(v) }
224
+ elsif value.is_a?(Hash)
225
+ {}.tap do |hash|
226
+ value.each { |k, v| hash[k] = _to_hash(v) }
227
+ end
228
+ elsif value.respond_to? :to_hash
229
+ value.to_hash
230
+ else
231
+ value
232
+ end
233
+ end
234
+
235
+ end
236
+
237
+ end