mx-platform-ruby 0.3.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +3 -3
  3. data/README.md +29 -222
  4. data/docs/ChallengeResponse.md +2 -2
  5. data/docs/{ChallengeImageOptions.md → ImageOptionResponse.md} +2 -2
  6. data/docs/{ChallengeOptions.md → OptionResponse.md} +2 -2
  7. data/lib/mx-platform-ruby/models/challenge_response.rb +2 -2
  8. data/lib/mx-platform-ruby/models/{challenge_image_options.rb → image_option_response.rb} +3 -3
  9. data/lib/mx-platform-ruby/models/{challenge_options.rb → option_response.rb} +3 -3
  10. data/lib/mx-platform-ruby/version.rb +1 -1
  11. data/lib/mx-platform-ruby.rb +2 -2
  12. data/openapi/config.yml +1 -1
  13. data/openapi/templates/README.mustache +71 -0
  14. data/spec/models/{challenge_image_options_spec.rb → image_option_response_spec.rb} +6 -6
  15. data/spec/models/{challenge_options_spec.rb → option_response_spec.rb} +6 -6
  16. metadata +88 -190
  17. data/docs/Account.md +0 -96
  18. data/docs/AccountNumber.md +0 -32
  19. data/docs/AccountOwner.md +0 -40
  20. data/docs/Category.md +0 -32
  21. data/docs/Challenge.md +0 -30
  22. data/docs/ChallengeResponseImageOptions.md +0 -22
  23. data/docs/ChallengeResponseOptions.md +0 -20
  24. data/docs/ConnectWidget.md +0 -20
  25. data/docs/Credential.md +0 -26
  26. data/docs/EnhanceTransaction.md +0 -48
  27. data/docs/Holding.md +0 -52
  28. data/docs/InlineResponse200.md +0 -18
  29. data/docs/Institution.md +0 -36
  30. data/docs/Member.md +0 -40
  31. data/docs/MemberStatus.md +0 -34
  32. data/docs/Merchant.md +0 -28
  33. data/docs/OAuthWindow.md +0 -20
  34. data/docs/Pagination.md +0 -24
  35. data/docs/Statement.md +0 -32
  36. data/docs/Tag.md +0 -22
  37. data/docs/Tagging.md +0 -26
  38. data/docs/Transaction.md +0 -88
  39. data/docs/TransactionRule.md +0 -30
  40. data/docs/User.md +0 -26
  41. data/docs/Widget.md +0 -22
  42. data/lib/mx-platform-ruby/models/account.rb +0 -569
  43. data/lib/mx-platform-ruby/models/account_number.rb +0 -281
  44. data/lib/mx-platform-ruby/models/account_owner.rb +0 -317
  45. data/lib/mx-platform-ruby/models/category.rb +0 -281
  46. data/lib/mx-platform-ruby/models/challenge.rb +0 -276
  47. data/lib/mx-platform-ruby/models/challenge_response_image_options.rb +0 -236
  48. data/lib/mx-platform-ruby/models/challenge_response_options.rb +0 -227
  49. data/lib/mx-platform-ruby/models/connect_widget.rb +0 -227
  50. data/lib/mx-platform-ruby/models/credential.rb +0 -254
  51. data/lib/mx-platform-ruby/models/enhance_transaction.rb +0 -353
  52. data/lib/mx-platform-ruby/models/holding.rb +0 -371
  53. data/lib/mx-platform-ruby/models/inline_response200.rb +0 -218
  54. data/lib/mx-platform-ruby/models/institution.rb +0 -299
  55. data/lib/mx-platform-ruby/models/member.rb +0 -317
  56. data/lib/mx-platform-ruby/models/member_status.rb +0 -292
  57. data/lib/mx-platform-ruby/models/merchant.rb +0 -263
  58. data/lib/mx-platform-ruby/models/o_auth_window.rb +0 -227
  59. data/lib/mx-platform-ruby/models/pagination.rb +0 -245
  60. data/lib/mx-platform-ruby/models/statement.rb +0 -281
  61. data/lib/mx-platform-ruby/models/tag.rb +0 -236
  62. data/lib/mx-platform-ruby/models/tagging.rb +0 -254
  63. data/lib/mx-platform-ruby/models/transaction.rb +0 -533
  64. data/lib/mx-platform-ruby/models/transaction_rule.rb +0 -272
  65. data/lib/mx-platform-ruby/models/user.rb +0 -254
  66. data/lib/mx-platform-ruby/models/widget.rb +0 -236
  67. data/openapi/mx_platform_ruby.yml +0 -11
  68. data/pkg/mx-platform-ruby-0.2.0.gem +0 -0
  69. data/pkg/mx-platform-ruby-0.2.1.gem +0 -0
  70. data/spec/models/account_number_spec.rb +0 -76
  71. data/spec/models/account_owner_spec.rb +0 -100
  72. data/spec/models/account_spec.rb +0 -268
  73. data/spec/models/category_spec.rb +0 -76
  74. data/spec/models/challenge_response_image_options_spec.rb +0 -46
  75. data/spec/models/challenge_response_options_spec.rb +0 -40
  76. data/spec/models/challenge_spec.rb +0 -70
  77. data/spec/models/connect_widget_spec.rb +0 -40
  78. data/spec/models/credential_spec.rb +0 -58
  79. data/spec/models/enhance_transaction_spec.rb +0 -124
  80. data/spec/models/holding_spec.rb +0 -136
  81. data/spec/models/inline_response200_spec.rb +0 -34
  82. data/spec/models/institution_spec.rb +0 -88
  83. data/spec/models/member_spec.rb +0 -100
  84. data/spec/models/member_status_spec.rb +0 -82
  85. data/spec/models/merchant_spec.rb +0 -64
  86. data/spec/models/o_auth_window_spec.rb +0 -40
  87. data/spec/models/pagination_spec.rb +0 -52
  88. data/spec/models/statement_spec.rb +0 -76
  89. data/spec/models/tag_spec.rb +0 -46
  90. data/spec/models/tagging_spec.rb +0 -58
  91. data/spec/models/transaction_rule_spec.rb +0 -70
  92. data/spec/models/transaction_spec.rb +0 -244
  93. data/spec/models/user_spec.rb +0 -58
  94. data/spec/models/widget_spec.rb +0 -46
@@ -1,317 +0,0 @@
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.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module MxPlatformRuby
17
- class Member
18
- attr_accessor :aggregated_at
19
-
20
- attr_accessor :connection_status
21
-
22
- attr_accessor :guid
23
-
24
- attr_accessor :id
25
-
26
- attr_accessor :institution_code
27
-
28
- attr_accessor :is_being_aggregated
29
-
30
- attr_accessor :is_oauth
31
-
32
- attr_accessor :metadata
33
-
34
- attr_accessor :name
35
-
36
- attr_accessor :oauth_window_uri
37
-
38
- attr_accessor :successfully_aggregated_at
39
-
40
- attr_accessor :user_guid
41
-
42
- # Attribute mapping from ruby-style variable name to JSON key.
43
- def self.attribute_map
44
- {
45
- :'aggregated_at' => :'aggregated_at',
46
- :'connection_status' => :'connection_status',
47
- :'guid' => :'guid',
48
- :'id' => :'id',
49
- :'institution_code' => :'institution_code',
50
- :'is_being_aggregated' => :'is_being_aggregated',
51
- :'is_oauth' => :'is_oauth',
52
- :'metadata' => :'metadata',
53
- :'name' => :'name',
54
- :'oauth_window_uri' => :'oauth_window_uri',
55
- :'successfully_aggregated_at' => :'successfully_aggregated_at',
56
- :'user_guid' => :'user_guid'
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
- :'aggregated_at' => :'String',
69
- :'connection_status' => :'String',
70
- :'guid' => :'String',
71
- :'id' => :'String',
72
- :'institution_code' => :'String',
73
- :'is_being_aggregated' => :'Boolean',
74
- :'is_oauth' => :'Boolean',
75
- :'metadata' => :'String',
76
- :'name' => :'String',
77
- :'oauth_window_uri' => :'String',
78
- :'successfully_aggregated_at' => :'String',
79
- :'user_guid' => :'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::Member` 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::Member`. 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?(:'aggregated_at')
105
- self.aggregated_at = attributes[:'aggregated_at']
106
- end
107
-
108
- if attributes.key?(:'connection_status')
109
- self.connection_status = attributes[:'connection_status']
110
- end
111
-
112
- if attributes.key?(:'guid')
113
- self.guid = attributes[:'guid']
114
- end
115
-
116
- if attributes.key?(:'id')
117
- self.id = attributes[:'id']
118
- end
119
-
120
- if attributes.key?(:'institution_code')
121
- self.institution_code = attributes[:'institution_code']
122
- end
123
-
124
- if attributes.key?(:'is_being_aggregated')
125
- self.is_being_aggregated = attributes[:'is_being_aggregated']
126
- end
127
-
128
- if attributes.key?(:'is_oauth')
129
- self.is_oauth = attributes[:'is_oauth']
130
- end
131
-
132
- if attributes.key?(:'metadata')
133
- self.metadata = attributes[:'metadata']
134
- end
135
-
136
- if attributes.key?(:'name')
137
- self.name = attributes[:'name']
138
- end
139
-
140
- if attributes.key?(:'oauth_window_uri')
141
- self.oauth_window_uri = attributes[:'oauth_window_uri']
142
- end
143
-
144
- if attributes.key?(:'successfully_aggregated_at')
145
- self.successfully_aggregated_at = attributes[:'successfully_aggregated_at']
146
- end
147
-
148
- if attributes.key?(:'user_guid')
149
- self.user_guid = attributes[:'user_guid']
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
- aggregated_at == o.aggregated_at &&
172
- connection_status == o.connection_status &&
173
- guid == o.guid &&
174
- id == o.id &&
175
- institution_code == o.institution_code &&
176
- is_being_aggregated == o.is_being_aggregated &&
177
- is_oauth == o.is_oauth &&
178
- metadata == o.metadata &&
179
- name == o.name &&
180
- oauth_window_uri == o.oauth_window_uri &&
181
- successfully_aggregated_at == o.successfully_aggregated_at &&
182
- user_guid == o.user_guid
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
- [aggregated_at, connection_status, guid, id, institution_code, is_being_aggregated, is_oauth, metadata, name, oauth_window_uri, successfully_aggregated_at, user_guid].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
@@ -1,292 +0,0 @@
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.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module MxPlatformRuby
17
- class MemberStatus
18
- attr_accessor :aggregated_at
19
-
20
- attr_accessor :challenges
21
-
22
- attr_accessor :connection_status
23
-
24
- attr_accessor :guid
25
-
26
- attr_accessor :has_processed_accounts
27
-
28
- attr_accessor :has_processed_transactions
29
-
30
- attr_accessor :is_authenticated
31
-
32
- attr_accessor :is_being_aggregated
33
-
34
- attr_accessor :successfully_aggregated_at
35
-
36
- # Attribute mapping from ruby-style variable name to JSON key.
37
- def self.attribute_map
38
- {
39
- :'aggregated_at' => :'aggregated_at',
40
- :'challenges' => :'challenges',
41
- :'connection_status' => :'connection_status',
42
- :'guid' => :'guid',
43
- :'has_processed_accounts' => :'has_processed_accounts',
44
- :'has_processed_transactions' => :'has_processed_transactions',
45
- :'is_authenticated' => :'is_authenticated',
46
- :'is_being_aggregated' => :'is_being_aggregated',
47
- :'successfully_aggregated_at' => :'successfully_aggregated_at'
48
- }
49
- end
50
-
51
- # Returns all the JSON keys this model knows about
52
- def self.acceptable_attributes
53
- attribute_map.values
54
- end
55
-
56
- # Attribute type mapping.
57
- def self.openapi_types
58
- {
59
- :'aggregated_at' => :'String',
60
- :'challenges' => :'Array<Challenge>',
61
- :'connection_status' => :'String',
62
- :'guid' => :'String',
63
- :'has_processed_accounts' => :'Boolean',
64
- :'has_processed_transactions' => :'Boolean',
65
- :'is_authenticated' => :'Boolean',
66
- :'is_being_aggregated' => :'Boolean',
67
- :'successfully_aggregated_at' => :'String'
68
- }
69
- end
70
-
71
- # List of attributes with nullable: true
72
- def self.openapi_nullable
73
- Set.new([
74
- ])
75
- end
76
-
77
- # Initializes the object
78
- # @param [Hash] attributes Model attributes in the form of hash
79
- def initialize(attributes = {})
80
- if (!attributes.is_a?(Hash))
81
- fail ArgumentError, "The input argument (attributes) must be a hash in `MxPlatformRuby::MemberStatus` initialize method"
82
- end
83
-
84
- # check to see if the attribute exists and convert string to symbol for hash key
85
- attributes = attributes.each_with_object({}) { |(k, v), h|
86
- if (!self.class.attribute_map.key?(k.to_sym))
87
- fail ArgumentError, "`#{k}` is not a valid attribute in `MxPlatformRuby::MemberStatus`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
88
- end
89
- h[k.to_sym] = v
90
- }
91
-
92
- if attributes.key?(:'aggregated_at')
93
- self.aggregated_at = attributes[:'aggregated_at']
94
- end
95
-
96
- if attributes.key?(:'challenges')
97
- if (value = attributes[:'challenges']).is_a?(Array)
98
- self.challenges = value
99
- end
100
- end
101
-
102
- if attributes.key?(:'connection_status')
103
- self.connection_status = attributes[:'connection_status']
104
- end
105
-
106
- if attributes.key?(:'guid')
107
- self.guid = attributes[:'guid']
108
- end
109
-
110
- if attributes.key?(:'has_processed_accounts')
111
- self.has_processed_accounts = attributes[:'has_processed_accounts']
112
- end
113
-
114
- if attributes.key?(:'has_processed_transactions')
115
- self.has_processed_transactions = attributes[:'has_processed_transactions']
116
- end
117
-
118
- if attributes.key?(:'is_authenticated')
119
- self.is_authenticated = attributes[:'is_authenticated']
120
- end
121
-
122
- if attributes.key?(:'is_being_aggregated')
123
- self.is_being_aggregated = attributes[:'is_being_aggregated']
124
- end
125
-
126
- if attributes.key?(:'successfully_aggregated_at')
127
- self.successfully_aggregated_at = attributes[:'successfully_aggregated_at']
128
- end
129
- end
130
-
131
- # Show invalid properties with the reasons. Usually used together with valid?
132
- # @return Array for valid properties with the reasons
133
- def list_invalid_properties
134
- invalid_properties = Array.new
135
- invalid_properties
136
- end
137
-
138
- # Check to see if the all the properties in the model are valid
139
- # @return true if the model is valid
140
- def valid?
141
- true
142
- end
143
-
144
- # Checks equality by comparing each attribute.
145
- # @param [Object] Object to be compared
146
- def ==(o)
147
- return true if self.equal?(o)
148
- self.class == o.class &&
149
- aggregated_at == o.aggregated_at &&
150
- challenges == o.challenges &&
151
- connection_status == o.connection_status &&
152
- guid == o.guid &&
153
- has_processed_accounts == o.has_processed_accounts &&
154
- has_processed_transactions == o.has_processed_transactions &&
155
- is_authenticated == o.is_authenticated &&
156
- is_being_aggregated == o.is_being_aggregated &&
157
- successfully_aggregated_at == o.successfully_aggregated_at
158
- end
159
-
160
- # @see the `==` method
161
- # @param [Object] Object to be compared
162
- def eql?(o)
163
- self == o
164
- end
165
-
166
- # Calculates hash code according to all attributes.
167
- # @return [Integer] Hash code
168
- def hash
169
- [aggregated_at, challenges, connection_status, guid, has_processed_accounts, has_processed_transactions, is_authenticated, is_being_aggregated, successfully_aggregated_at].hash
170
- end
171
-
172
- # Builds the object from hash
173
- # @param [Hash] attributes Model attributes in the form of hash
174
- # @return [Object] Returns the model itself
175
- def self.build_from_hash(attributes)
176
- new.build_from_hash(attributes)
177
- end
178
-
179
- # Builds the object from hash
180
- # @param [Hash] attributes Model attributes in the form of hash
181
- # @return [Object] Returns the model itself
182
- def build_from_hash(attributes)
183
- return nil unless attributes.is_a?(Hash)
184
- self.class.openapi_types.each_pair do |key, type|
185
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
186
- self.send("#{key}=", nil)
187
- elsif type =~ /\AArray<(.*)>/i
188
- # check to ensure the input is an array given that the attribute
189
- # is documented as an array but the input is not
190
- if attributes[self.class.attribute_map[key]].is_a?(Array)
191
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
192
- end
193
- elsif !attributes[self.class.attribute_map[key]].nil?
194
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
195
- end
196
- end
197
-
198
- self
199
- end
200
-
201
- # Deserializes the data based on type
202
- # @param string type Data type
203
- # @param string value Value to be deserialized
204
- # @return [Object] Deserialized data
205
- def _deserialize(type, value)
206
- case type.to_sym
207
- when :Time
208
- Time.parse(value)
209
- when :Date
210
- Date.parse(value)
211
- when :String
212
- value.to_s
213
- when :Integer
214
- value.to_i
215
- when :Float
216
- value.to_f
217
- when :Boolean
218
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
219
- true
220
- else
221
- false
222
- end
223
- when :Object
224
- # generic object (usually a Hash), return directly
225
- value
226
- when /\AArray<(?<inner_type>.+)>\z/
227
- inner_type = Regexp.last_match[:inner_type]
228
- value.map { |v| _deserialize(inner_type, v) }
229
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
230
- k_type = Regexp.last_match[:k_type]
231
- v_type = Regexp.last_match[:v_type]
232
- {}.tap do |hash|
233
- value.each do |k, v|
234
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
235
- end
236
- end
237
- else # model
238
- # models (e.g. Pet) or oneOf
239
- klass = MxPlatformRuby.const_get(type)
240
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
241
- end
242
- end
243
-
244
- # Returns the string representation of the object
245
- # @return [String] String presentation of the object
246
- def to_s
247
- to_hash.to_s
248
- end
249
-
250
- # to_body is an alias to to_hash (backward compatibility)
251
- # @return [Hash] Returns the object in the form of hash
252
- def to_body
253
- to_hash
254
- end
255
-
256
- # Returns the object in the form of hash
257
- # @return [Hash] Returns the object in the form of hash
258
- def to_hash
259
- hash = {}
260
- self.class.attribute_map.each_pair do |attr, param|
261
- value = self.send(attr)
262
- if value.nil?
263
- is_nullable = self.class.openapi_nullable.include?(attr)
264
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
265
- end
266
-
267
- hash[param] = _to_hash(value)
268
- end
269
- hash
270
- end
271
-
272
- # Outputs non-array value in the form of hash
273
- # For object, use to_hash. Otherwise, just return the value
274
- # @param [Object] value Any valid value
275
- # @return [Hash] Returns the value in the form of hash
276
- def _to_hash(value)
277
- if value.is_a?(Array)
278
- value.compact.map { |v| _to_hash(v) }
279
- elsif value.is_a?(Hash)
280
- {}.tap do |hash|
281
- value.each { |k, v| hash[k] = _to_hash(v) }
282
- end
283
- elsif value.respond_to? :to_hash
284
- value.to_hash
285
- else
286
- value
287
- end
288
- end
289
-
290
- end
291
-
292
- end