mx-platform-ruby 0.4.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +5 -5
- data/README.md +1 -1
- data/docs/AccountResponse.md +15 -1
- data/docs/ManagedAccountCreateRequest.md +78 -0
- data/docs/ManagedAccountCreateRequestBody.md +18 -0
- data/docs/ManagedAccountUpdateRequest.md +78 -0
- data/docs/ManagedAccountUpdateRequestBody.md +18 -0
- data/docs/ManagedMemberCreateRequest.md +24 -0
- data/docs/ManagedMemberCreateRequestBody.md +18 -0
- data/docs/ManagedMemberUpdateRequest.md +22 -0
- data/docs/ManagedMemberUpdateRequestBody.md +18 -0
- data/docs/ManagedTransactionCreateRequest.md +56 -0
- data/docs/ManagedTransactionCreateRequestBody.md +18 -0
- data/docs/ManagedTransactionUpdateRequest.md +56 -0
- data/docs/ManagedTransactionUpdateRequestBody.md +18 -0
- data/docs/MemberResponse.md +5 -1
- data/docs/MerchantLocationResponse.md +40 -0
- data/docs/MerchantLocationResponseBody.md +18 -0
- data/docs/MxPlatformApi.md +1397 -119
- data/docs/TransactionResponse.md +11 -1
- data/lib/mx-platform-ruby/api/mx_platform_api.rb +1379 -125
- data/lib/mx-platform-ruby/models/account_response.rb +67 -4
- data/lib/mx-platform-ruby/models/managed_account_create_request.rb +503 -0
- data/lib/mx-platform-ruby/models/managed_account_create_request_body.rb +218 -0
- data/lib/mx-platform-ruby/models/managed_account_update_request.rb +488 -0
- data/lib/mx-platform-ruby/models/managed_account_update_request_body.rb +218 -0
- data/lib/mx-platform-ruby/models/managed_member_create_request.rb +250 -0
- data/lib/mx-platform-ruby/models/managed_member_create_request_body.rb +218 -0
- data/lib/mx-platform-ruby/models/managed_member_update_request.rb +236 -0
- data/lib/mx-platform-ruby/models/managed_member_update_request_body.rb +218 -0
- data/lib/mx-platform-ruby/models/managed_transaction_create_request.rb +414 -0
- data/lib/mx-platform-ruby/models/managed_transaction_create_request_body.rb +218 -0
- data/lib/mx-platform-ruby/models/managed_transaction_update_request.rb +389 -0
- data/lib/mx-platform-ruby/models/managed_transaction_update_request_body.rb +218 -0
- data/lib/mx-platform-ruby/models/member_response.rb +22 -4
- data/lib/mx-platform-ruby/models/merchant_location_response.rb +317 -0
- data/lib/mx-platform-ruby/models/merchant_location_response_body.rb +218 -0
- data/lib/mx-platform-ruby/models/transaction_response.rb +49 -4
- data/lib/mx-platform-ruby/version.rb +1 -1
- data/lib/mx-platform-ruby.rb +14 -0
- data/openapi/config.yml +1 -1
- data/spec/api/mx_platform_api_spec.rb +237 -0
- data/spec/models/account_response_spec.rb +42 -0
- data/spec/models/managed_account_create_request_body_spec.rb +34 -0
- data/spec/models/managed_account_create_request_spec.rb +214 -0
- data/spec/models/managed_account_update_request_body_spec.rb +34 -0
- data/spec/models/managed_account_update_request_spec.rb +214 -0
- data/spec/models/managed_member_create_request_body_spec.rb +34 -0
- data/spec/models/managed_member_create_request_spec.rb +52 -0
- data/spec/models/managed_member_update_request_body_spec.rb +34 -0
- data/spec/models/managed_member_update_request_spec.rb +46 -0
- data/spec/models/managed_transaction_create_request_body_spec.rb +34 -0
- data/spec/models/managed_transaction_create_request_spec.rb +148 -0
- data/spec/models/managed_transaction_update_request_body_spec.rb +34 -0
- data/spec/models/managed_transaction_update_request_spec.rb +148 -0
- data/spec/models/member_response_spec.rb +12 -0
- data/spec/models/merchant_location_response_body_spec.rb +34 -0
- data/spec/models/merchant_location_response_spec.rb +100 -0
- data/spec/models/transaction_response_spec.rb +30 -0
- metadata +136 -80
@@ -0,0 +1,317 @@
|
|
1
|
+
=begin
|
2
|
+
#MX Platform API
|
3
|
+
|
4
|
+
#The MX Platform API is a powerful, fully-featured API designed to make aggregating and enhancing financial data easy and reliable. It can seamlessly connect your app or website to tens of thousands of financial institutions.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 0.1.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.2.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module MxPlatformRuby
|
17
|
+
class MerchantLocationResponse
|
18
|
+
attr_accessor :city
|
19
|
+
|
20
|
+
attr_accessor :country
|
21
|
+
|
22
|
+
attr_accessor :created_at
|
23
|
+
|
24
|
+
attr_accessor :guid
|
25
|
+
|
26
|
+
attr_accessor :latitude
|
27
|
+
|
28
|
+
attr_accessor :longitude
|
29
|
+
|
30
|
+
attr_accessor :merchant_guid
|
31
|
+
|
32
|
+
attr_accessor :phone_number
|
33
|
+
|
34
|
+
attr_accessor :postal_code
|
35
|
+
|
36
|
+
attr_accessor :state
|
37
|
+
|
38
|
+
attr_accessor :street_address
|
39
|
+
|
40
|
+
attr_accessor :updated_at
|
41
|
+
|
42
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
43
|
+
def self.attribute_map
|
44
|
+
{
|
45
|
+
:'city' => :'city',
|
46
|
+
:'country' => :'country',
|
47
|
+
:'created_at' => :'created_at',
|
48
|
+
:'guid' => :'guid',
|
49
|
+
:'latitude' => :'latitude',
|
50
|
+
:'longitude' => :'longitude',
|
51
|
+
:'merchant_guid' => :'merchant_guid',
|
52
|
+
:'phone_number' => :'phone_number',
|
53
|
+
:'postal_code' => :'postal_code',
|
54
|
+
:'state' => :'state',
|
55
|
+
:'street_address' => :'street_address',
|
56
|
+
:'updated_at' => :'updated_at'
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
# Returns all the JSON keys this model knows about
|
61
|
+
def self.acceptable_attributes
|
62
|
+
attribute_map.values
|
63
|
+
end
|
64
|
+
|
65
|
+
# Attribute type mapping.
|
66
|
+
def self.openapi_types
|
67
|
+
{
|
68
|
+
:'city' => :'String',
|
69
|
+
:'country' => :'String',
|
70
|
+
:'created_at' => :'String',
|
71
|
+
:'guid' => :'String',
|
72
|
+
:'latitude' => :'Float',
|
73
|
+
:'longitude' => :'Float',
|
74
|
+
:'merchant_guid' => :'String',
|
75
|
+
:'phone_number' => :'String',
|
76
|
+
:'postal_code' => :'String',
|
77
|
+
:'state' => :'String',
|
78
|
+
:'street_address' => :'String',
|
79
|
+
:'updated_at' => :'String'
|
80
|
+
}
|
81
|
+
end
|
82
|
+
|
83
|
+
# List of attributes with nullable: true
|
84
|
+
def self.openapi_nullable
|
85
|
+
Set.new([
|
86
|
+
])
|
87
|
+
end
|
88
|
+
|
89
|
+
# Initializes the object
|
90
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
91
|
+
def initialize(attributes = {})
|
92
|
+
if (!attributes.is_a?(Hash))
|
93
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `MxPlatformRuby::MerchantLocationResponse` initialize method"
|
94
|
+
end
|
95
|
+
|
96
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
97
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
98
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
99
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `MxPlatformRuby::MerchantLocationResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
100
|
+
end
|
101
|
+
h[k.to_sym] = v
|
102
|
+
}
|
103
|
+
|
104
|
+
if attributes.key?(:'city')
|
105
|
+
self.city = attributes[:'city']
|
106
|
+
end
|
107
|
+
|
108
|
+
if attributes.key?(:'country')
|
109
|
+
self.country = attributes[:'country']
|
110
|
+
end
|
111
|
+
|
112
|
+
if attributes.key?(:'created_at')
|
113
|
+
self.created_at = attributes[:'created_at']
|
114
|
+
end
|
115
|
+
|
116
|
+
if attributes.key?(:'guid')
|
117
|
+
self.guid = attributes[:'guid']
|
118
|
+
end
|
119
|
+
|
120
|
+
if attributes.key?(:'latitude')
|
121
|
+
self.latitude = attributes[:'latitude']
|
122
|
+
end
|
123
|
+
|
124
|
+
if attributes.key?(:'longitude')
|
125
|
+
self.longitude = attributes[:'longitude']
|
126
|
+
end
|
127
|
+
|
128
|
+
if attributes.key?(:'merchant_guid')
|
129
|
+
self.merchant_guid = attributes[:'merchant_guid']
|
130
|
+
end
|
131
|
+
|
132
|
+
if attributes.key?(:'phone_number')
|
133
|
+
self.phone_number = attributes[:'phone_number']
|
134
|
+
end
|
135
|
+
|
136
|
+
if attributes.key?(:'postal_code')
|
137
|
+
self.postal_code = attributes[:'postal_code']
|
138
|
+
end
|
139
|
+
|
140
|
+
if attributes.key?(:'state')
|
141
|
+
self.state = attributes[:'state']
|
142
|
+
end
|
143
|
+
|
144
|
+
if attributes.key?(:'street_address')
|
145
|
+
self.street_address = attributes[:'street_address']
|
146
|
+
end
|
147
|
+
|
148
|
+
if attributes.key?(:'updated_at')
|
149
|
+
self.updated_at = attributes[:'updated_at']
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
154
|
+
# @return Array for valid properties with the reasons
|
155
|
+
def list_invalid_properties
|
156
|
+
invalid_properties = Array.new
|
157
|
+
invalid_properties
|
158
|
+
end
|
159
|
+
|
160
|
+
# Check to see if the all the properties in the model are valid
|
161
|
+
# @return true if the model is valid
|
162
|
+
def valid?
|
163
|
+
true
|
164
|
+
end
|
165
|
+
|
166
|
+
# Checks equality by comparing each attribute.
|
167
|
+
# @param [Object] Object to be compared
|
168
|
+
def ==(o)
|
169
|
+
return true if self.equal?(o)
|
170
|
+
self.class == o.class &&
|
171
|
+
city == o.city &&
|
172
|
+
country == o.country &&
|
173
|
+
created_at == o.created_at &&
|
174
|
+
guid == o.guid &&
|
175
|
+
latitude == o.latitude &&
|
176
|
+
longitude == o.longitude &&
|
177
|
+
merchant_guid == o.merchant_guid &&
|
178
|
+
phone_number == o.phone_number &&
|
179
|
+
postal_code == o.postal_code &&
|
180
|
+
state == o.state &&
|
181
|
+
street_address == o.street_address &&
|
182
|
+
updated_at == o.updated_at
|
183
|
+
end
|
184
|
+
|
185
|
+
# @see the `==` method
|
186
|
+
# @param [Object] Object to be compared
|
187
|
+
def eql?(o)
|
188
|
+
self == o
|
189
|
+
end
|
190
|
+
|
191
|
+
# Calculates hash code according to all attributes.
|
192
|
+
# @return [Integer] Hash code
|
193
|
+
def hash
|
194
|
+
[city, country, created_at, guid, latitude, longitude, merchant_guid, phone_number, postal_code, state, street_address, updated_at].hash
|
195
|
+
end
|
196
|
+
|
197
|
+
# Builds the object from hash
|
198
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
199
|
+
# @return [Object] Returns the model itself
|
200
|
+
def self.build_from_hash(attributes)
|
201
|
+
new.build_from_hash(attributes)
|
202
|
+
end
|
203
|
+
|
204
|
+
# Builds the object from hash
|
205
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
206
|
+
# @return [Object] Returns the model itself
|
207
|
+
def build_from_hash(attributes)
|
208
|
+
return nil unless attributes.is_a?(Hash)
|
209
|
+
self.class.openapi_types.each_pair do |key, type|
|
210
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
211
|
+
self.send("#{key}=", nil)
|
212
|
+
elsif type =~ /\AArray<(.*)>/i
|
213
|
+
# check to ensure the input is an array given that the attribute
|
214
|
+
# is documented as an array but the input is not
|
215
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
216
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
217
|
+
end
|
218
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
219
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
self
|
224
|
+
end
|
225
|
+
|
226
|
+
# Deserializes the data based on type
|
227
|
+
# @param string type Data type
|
228
|
+
# @param string value Value to be deserialized
|
229
|
+
# @return [Object] Deserialized data
|
230
|
+
def _deserialize(type, value)
|
231
|
+
case type.to_sym
|
232
|
+
when :Time
|
233
|
+
Time.parse(value)
|
234
|
+
when :Date
|
235
|
+
Date.parse(value)
|
236
|
+
when :String
|
237
|
+
value.to_s
|
238
|
+
when :Integer
|
239
|
+
value.to_i
|
240
|
+
when :Float
|
241
|
+
value.to_f
|
242
|
+
when :Boolean
|
243
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
244
|
+
true
|
245
|
+
else
|
246
|
+
false
|
247
|
+
end
|
248
|
+
when :Object
|
249
|
+
# generic object (usually a Hash), return directly
|
250
|
+
value
|
251
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
252
|
+
inner_type = Regexp.last_match[:inner_type]
|
253
|
+
value.map { |v| _deserialize(inner_type, v) }
|
254
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
255
|
+
k_type = Regexp.last_match[:k_type]
|
256
|
+
v_type = Regexp.last_match[:v_type]
|
257
|
+
{}.tap do |hash|
|
258
|
+
value.each do |k, v|
|
259
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
260
|
+
end
|
261
|
+
end
|
262
|
+
else # model
|
263
|
+
# models (e.g. Pet) or oneOf
|
264
|
+
klass = MxPlatformRuby.const_get(type)
|
265
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
# Returns the string representation of the object
|
270
|
+
# @return [String] String presentation of the object
|
271
|
+
def to_s
|
272
|
+
to_hash.to_s
|
273
|
+
end
|
274
|
+
|
275
|
+
# to_body is an alias to to_hash (backward compatibility)
|
276
|
+
# @return [Hash] Returns the object in the form of hash
|
277
|
+
def to_body
|
278
|
+
to_hash
|
279
|
+
end
|
280
|
+
|
281
|
+
# Returns the object in the form of hash
|
282
|
+
# @return [Hash] Returns the object in the form of hash
|
283
|
+
def to_hash
|
284
|
+
hash = {}
|
285
|
+
self.class.attribute_map.each_pair do |attr, param|
|
286
|
+
value = self.send(attr)
|
287
|
+
if value.nil?
|
288
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
289
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
290
|
+
end
|
291
|
+
|
292
|
+
hash[param] = _to_hash(value)
|
293
|
+
end
|
294
|
+
hash
|
295
|
+
end
|
296
|
+
|
297
|
+
# Outputs non-array value in the form of hash
|
298
|
+
# For object, use to_hash. Otherwise, just return the value
|
299
|
+
# @param [Object] value Any valid value
|
300
|
+
# @return [Hash] Returns the value in the form of hash
|
301
|
+
def _to_hash(value)
|
302
|
+
if value.is_a?(Array)
|
303
|
+
value.compact.map { |v| _to_hash(v) }
|
304
|
+
elsif value.is_a?(Hash)
|
305
|
+
{}.tap do |hash|
|
306
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
307
|
+
end
|
308
|
+
elsif value.respond_to? :to_hash
|
309
|
+
value.to_hash
|
310
|
+
else
|
311
|
+
value
|
312
|
+
end
|
313
|
+
end
|
314
|
+
|
315
|
+
end
|
316
|
+
|
317
|
+
end
|
@@ -0,0 +1,218 @@
|
|
1
|
+
=begin
|
2
|
+
#MX Platform API
|
3
|
+
|
4
|
+
#The MX Platform API is a powerful, fully-featured API designed to make aggregating and enhancing financial data easy and reliable. It can seamlessly connect your app or website to tens of thousands of financial institutions.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 0.1.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.2.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module MxPlatformRuby
|
17
|
+
class MerchantLocationResponseBody
|
18
|
+
attr_accessor :merchant_location
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'merchant_location' => :'merchant_location'
|
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
|
+
:'merchant_location' => :'MerchantLocationResponse'
|
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 `MxPlatformRuby::MerchantLocationResponseBody` 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 `MxPlatformRuby::MerchantLocationResponseBody`. 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?(:'merchant_location')
|
61
|
+
self.merchant_location = attributes[:'merchant_location']
|
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
|
+
merchant_location == o.merchant_location
|
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
|
+
[merchant_location].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
|
+
self.class.openapi_types.each_pair do |key, type|
|
111
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
112
|
+
self.send("#{key}=", nil)
|
113
|
+
elsif type =~ /\AArray<(.*)>/i
|
114
|
+
# check to ensure the input is an array given that the attribute
|
115
|
+
# is documented as an array but the input is not
|
116
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
117
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
118
|
+
end
|
119
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
120
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
self
|
125
|
+
end
|
126
|
+
|
127
|
+
# Deserializes the data based on type
|
128
|
+
# @param string type Data type
|
129
|
+
# @param string value Value to be deserialized
|
130
|
+
# @return [Object] Deserialized data
|
131
|
+
def _deserialize(type, value)
|
132
|
+
case type.to_sym
|
133
|
+
when :Time
|
134
|
+
Time.parse(value)
|
135
|
+
when :Date
|
136
|
+
Date.parse(value)
|
137
|
+
when :String
|
138
|
+
value.to_s
|
139
|
+
when :Integer
|
140
|
+
value.to_i
|
141
|
+
when :Float
|
142
|
+
value.to_f
|
143
|
+
when :Boolean
|
144
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
145
|
+
true
|
146
|
+
else
|
147
|
+
false
|
148
|
+
end
|
149
|
+
when :Object
|
150
|
+
# generic object (usually a Hash), return directly
|
151
|
+
value
|
152
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
153
|
+
inner_type = Regexp.last_match[:inner_type]
|
154
|
+
value.map { |v| _deserialize(inner_type, v) }
|
155
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
156
|
+
k_type = Regexp.last_match[:k_type]
|
157
|
+
v_type = Regexp.last_match[:v_type]
|
158
|
+
{}.tap do |hash|
|
159
|
+
value.each do |k, v|
|
160
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
else # model
|
164
|
+
# models (e.g. Pet) or oneOf
|
165
|
+
klass = MxPlatformRuby.const_get(type)
|
166
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
# Returns the string representation of the object
|
171
|
+
# @return [String] String presentation of the object
|
172
|
+
def to_s
|
173
|
+
to_hash.to_s
|
174
|
+
end
|
175
|
+
|
176
|
+
# to_body is an alias to to_hash (backward compatibility)
|
177
|
+
# @return [Hash] Returns the object in the form of hash
|
178
|
+
def to_body
|
179
|
+
to_hash
|
180
|
+
end
|
181
|
+
|
182
|
+
# Returns the object in the form of hash
|
183
|
+
# @return [Hash] Returns the object in the form of hash
|
184
|
+
def to_hash
|
185
|
+
hash = {}
|
186
|
+
self.class.attribute_map.each_pair do |attr, param|
|
187
|
+
value = self.send(attr)
|
188
|
+
if value.nil?
|
189
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
190
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
191
|
+
end
|
192
|
+
|
193
|
+
hash[param] = _to_hash(value)
|
194
|
+
end
|
195
|
+
hash
|
196
|
+
end
|
197
|
+
|
198
|
+
# Outputs non-array value in the form of hash
|
199
|
+
# For object, use to_hash. Otherwise, just return the value
|
200
|
+
# @param [Object] value Any valid value
|
201
|
+
# @return [Hash] Returns the value in the form of hash
|
202
|
+
def _to_hash(value)
|
203
|
+
if value.is_a?(Array)
|
204
|
+
value.compact.map { |v| _to_hash(v) }
|
205
|
+
elsif value.is_a?(Hash)
|
206
|
+
{}.tap do |hash|
|
207
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
208
|
+
end
|
209
|
+
elsif value.respond_to? :to_hash
|
210
|
+
value.to_hash
|
211
|
+
else
|
212
|
+
value
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
end
|
217
|
+
|
218
|
+
end
|