mx-platform-ruby 0.39.0 → 0.41.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +4 -4
  3. data/docs/BudgetCreateRequest.md +26 -0
  4. data/docs/BudgetCreateRequestBody.md +18 -0
  5. data/docs/BudgetResponse.md +48 -0
  6. data/docs/BudgetResponseBody.md +18 -0
  7. data/docs/BudgetUpdateRequest.md +22 -0
  8. data/docs/BudgetUpdateRequestBody.md +18 -0
  9. data/docs/BudgetsApi.md +444 -0
  10. data/docs/CreditCardProduct.md +8 -8
  11. data/docs/CreditCardProductResponse.md +2 -2
  12. data/docs/GoalRequest.md +38 -0
  13. data/docs/GoalRequestBody.md +18 -0
  14. data/docs/GoalResponse.md +48 -0
  15. data/docs/GoalResponseBody.md +18 -0
  16. data/docs/GoalsApi.md +450 -0
  17. data/docs/GoalsResponse.md +48 -0
  18. data/docs/GoalsResponseBody.md +20 -0
  19. data/docs/MonthlyCashFlowProfileRequest.md +20 -0
  20. data/docs/MonthlyCashFlowProfileRequestBody.md +18 -0
  21. data/docs/MonthlyCashFlowResponse.md +30 -0
  22. data/docs/MonthlyCashFlowResponseBody.md +18 -0
  23. data/docs/MxPlatformApi.md +294 -3
  24. data/docs/RepositionRequest.md +20 -0
  25. data/docs/RepositionRequestBody.md +18 -0
  26. data/docs/RepositionResponseBody.md +18 -0
  27. data/docs/RewardResponse.md +2 -0
  28. data/docs/RewardsResponse.md +2 -0
  29. data/docs/SplitTransactionRequest.md +24 -0
  30. data/docs/SplitTransactionRequestBody.md +18 -0
  31. data/docs/SplitTransactionsResponseBody.md +18 -0
  32. data/docs/UpdateGoalRequest.md +38 -0
  33. data/docs/UpdateGoalRequestBody.md +18 -0
  34. data/lib/mx-platform-ruby/api/budgets_api.rb +434 -0
  35. data/lib/mx-platform-ruby/api/goals_api.rb +455 -0
  36. data/lib/mx-platform-ruby/api/mx_platform_api.rb +282 -4
  37. data/lib/mx-platform-ruby/models/budget_create_request.rb +269 -0
  38. data/lib/mx-platform-ruby/models/budget_create_request_body.rb +214 -0
  39. data/lib/mx-platform-ruby/models/budget_response.rb +373 -0
  40. data/lib/mx-platform-ruby/models/budget_response_body.rb +214 -0
  41. data/lib/mx-platform-ruby/models/budget_update_request.rb +235 -0
  42. data/lib/mx-platform-ruby/models/budget_update_request_body.rb +214 -0
  43. data/lib/mx-platform-ruby/models/credit_card_product.rb +17 -21
  44. data/lib/mx-platform-ruby/models/credit_card_product_response.rb +7 -7
  45. data/lib/mx-platform-ruby/models/goal_request.rb +350 -0
  46. data/lib/mx-platform-ruby/models/goal_request_body.rb +214 -0
  47. data/lib/mx-platform-ruby/models/goal_response.rb +364 -0
  48. data/lib/mx-platform-ruby/models/goal_response_body.rb +214 -0
  49. data/lib/mx-platform-ruby/models/goals_response.rb +363 -0
  50. data/lib/mx-platform-ruby/models/goals_response_body.rb +225 -0
  51. data/lib/mx-platform-ruby/models/monthly_cash_flow_profile_request.rb +225 -0
  52. data/lib/mx-platform-ruby/models/monthly_cash_flow_profile_request_body.rb +214 -0
  53. data/lib/mx-platform-ruby/models/monthly_cash_flow_response.rb +274 -0
  54. data/lib/mx-platform-ruby/models/monthly_cash_flow_response_body.rb +214 -0
  55. data/lib/mx-platform-ruby/models/reposition_request.rb +239 -0
  56. data/lib/mx-platform-ruby/models/reposition_request_body.rb +216 -0
  57. data/lib/mx-platform-ruby/models/reposition_response_body.rb +216 -0
  58. data/lib/mx-platform-ruby/models/reward_response.rb +10 -1
  59. data/lib/mx-platform-ruby/models/rewards_response.rb +10 -1
  60. data/lib/mx-platform-ruby/models/split_transaction_request.rb +252 -0
  61. data/lib/mx-platform-ruby/models/split_transaction_request_body.rb +221 -0
  62. data/lib/mx-platform-ruby/models/split_transactions_response_body.rb +216 -0
  63. data/lib/mx-platform-ruby/models/update_goal_request.rb +315 -0
  64. data/lib/mx-platform-ruby/models/update_goal_request_body.rb +214 -0
  65. data/lib/mx-platform-ruby/version.rb +1 -1
  66. data/lib/mx-platform-ruby.rb +26 -0
  67. data/openapi/config.yml +1 -1
  68. data/spec/api/budgets_api_spec.rb +112 -0
  69. data/spec/api/goals_api_spec.rb +115 -0
  70. data/spec/api/mx_platform_api_spec.rb +53 -2
  71. data/spec/models/budget_create_request_body_spec.rb +34 -0
  72. data/spec/models/budget_create_request_spec.rb +58 -0
  73. data/spec/models/budget_response_body_spec.rb +34 -0
  74. data/spec/models/budget_response_spec.rb +124 -0
  75. data/spec/models/budget_update_request_body_spec.rb +34 -0
  76. data/spec/models/budget_update_request_spec.rb +46 -0
  77. data/spec/models/credit_card_product_response_spec.rb +1 -1
  78. data/spec/models/credit_card_product_spec.rb +2 -2
  79. data/spec/models/goal_request_body_spec.rb +34 -0
  80. data/spec/models/goal_request_spec.rb +94 -0
  81. data/spec/models/goal_response_body_spec.rb +34 -0
  82. data/spec/models/goal_response_spec.rb +124 -0
  83. data/spec/models/goals_response_body_spec.rb +40 -0
  84. data/spec/models/goals_response_spec.rb +124 -0
  85. data/spec/models/monthly_cash_flow_profile_request_body_spec.rb +34 -0
  86. data/spec/models/monthly_cash_flow_profile_request_spec.rb +40 -0
  87. data/spec/models/monthly_cash_flow_response_body_spec.rb +34 -0
  88. data/spec/models/monthly_cash_flow_response_spec.rb +70 -0
  89. data/spec/models/reposition_request_body_spec.rb +34 -0
  90. data/spec/models/reposition_request_spec.rb +40 -0
  91. data/spec/models/reposition_response_body_spec.rb +34 -0
  92. data/spec/models/reward_response_spec.rb +6 -0
  93. data/spec/models/rewards_response_spec.rb +6 -0
  94. data/spec/models/split_transaction_request_body_spec.rb +34 -0
  95. data/spec/models/split_transaction_request_spec.rb +52 -0
  96. data/spec/models/split_transactions_response_body_spec.rb +34 -0
  97. data/spec/models/update_goal_request_body_spec.rb +34 -0
  98. data/spec/models/update_goal_request_spec.rb +94 -0
  99. metadata +228 -124
@@ -35,9 +35,9 @@ module MxPlatformRuby
35
35
 
36
36
  attr_accessor :has_zero_percent_introductory_rate_on_balance_transfer
37
37
 
38
- attr_accessor :financial_institution
38
+ attr_accessor :is_accepting_applicants
39
39
 
40
- attr_accessor :is_accepting_applications
40
+ attr_accessor :is_active_credit_card_product
41
41
 
42
42
  attr_accessor :is_small_business_card
43
43
 
@@ -56,8 +56,8 @@ module MxPlatformRuby
56
56
  :'has_zero_introductory_annual_fee' => :'has_zero_introductory_annual_fee',
57
57
  :'has_zero_percent_introductory_rate' => :'has_zero_percent_introductory_rate',
58
58
  :'has_zero_percent_introductory_rate_on_balance_transfer' => :'has_zero_percent_introductory_rate_on_balance_transfer',
59
- :'financial_institution' => :'financial_institution',
60
- :'is_accepting_applications' => :'is_accepting_applications',
59
+ :'is_accepting_applicants' => :'is_accepting_applicants',
60
+ :'is_active_credit_card_product' => :'is_active_credit_card_product',
61
61
  :'is_small_business_card' => :'is_small_business_card',
62
62
  :'name' => :'name'
63
63
  }
@@ -71,18 +71,18 @@ module MxPlatformRuby
71
71
  # Attribute type mapping.
72
72
  def self.openapi_types
73
73
  {
74
- :'annual_fee' => :'Object',
75
- :'duration_of_introductory_rate_on_balance_transfer' => :'Object',
76
- :'duration_of_introductory_rate_on_purchases' => :'Object',
77
- :'guid' => :'Object',
74
+ :'annual_fee' => :'Float',
75
+ :'duration_of_introductory_rate_on_balance_transfer' => :'Integer',
76
+ :'duration_of_introductory_rate_on_purchases' => :'Integer',
77
+ :'guid' => :'String',
78
78
  :'has_cashback_rewards' => :'Boolean',
79
79
  :'has_other_rewards' => :'Boolean',
80
80
  :'has_travel_rewards' => :'Boolean',
81
81
  :'has_zero_introductory_annual_fee' => :'Boolean',
82
82
  :'has_zero_percent_introductory_rate' => :'Boolean',
83
83
  :'has_zero_percent_introductory_rate_on_balance_transfer' => :'Boolean',
84
- :'financial_institution' => :'Boolean',
85
- :'is_accepting_applications' => :'Boolean',
84
+ :'is_accepting_applicants' => :'Boolean',
85
+ :'is_active_credit_card_product' => :'Boolean',
86
86
  :'is_small_business_card' => :'Boolean',
87
87
  :'name' => :'String'
88
88
  }
@@ -91,10 +91,6 @@ module MxPlatformRuby
91
91
  # List of attributes with nullable: true
92
92
  def self.openapi_nullable
93
93
  Set.new([
94
- :'annual_fee',
95
- :'duration_of_introductory_rate_on_balance_transfer',
96
- :'duration_of_introductory_rate_on_purchases',
97
- :'guid',
98
94
  ])
99
95
  end
100
96
 
@@ -153,12 +149,12 @@ module MxPlatformRuby
153
149
  self.has_zero_percent_introductory_rate_on_balance_transfer = attributes[:'has_zero_percent_introductory_rate_on_balance_transfer']
154
150
  end
155
151
 
156
- if attributes.key?(:'financial_institution')
157
- self.financial_institution = attributes[:'financial_institution']
152
+ if attributes.key?(:'is_accepting_applicants')
153
+ self.is_accepting_applicants = attributes[:'is_accepting_applicants']
158
154
  end
159
155
 
160
- if attributes.key?(:'is_accepting_applications')
161
- self.is_accepting_applications = attributes[:'is_accepting_applications']
156
+ if attributes.key?(:'is_active_credit_card_product')
157
+ self.is_active_credit_card_product = attributes[:'is_active_credit_card_product']
162
158
  end
163
159
 
164
160
  if attributes.key?(:'is_small_business_card')
@@ -200,8 +196,8 @@ module MxPlatformRuby
200
196
  has_zero_introductory_annual_fee == o.has_zero_introductory_annual_fee &&
201
197
  has_zero_percent_introductory_rate == o.has_zero_percent_introductory_rate &&
202
198
  has_zero_percent_introductory_rate_on_balance_transfer == o.has_zero_percent_introductory_rate_on_balance_transfer &&
203
- financial_institution == o.financial_institution &&
204
- is_accepting_applications == o.is_accepting_applications &&
199
+ is_accepting_applicants == o.is_accepting_applicants &&
200
+ is_active_credit_card_product == o.is_active_credit_card_product &&
205
201
  is_small_business_card == o.is_small_business_card &&
206
202
  name == o.name
207
203
  end
@@ -215,7 +211,7 @@ module MxPlatformRuby
215
211
  # Calculates hash code according to all attributes.
216
212
  # @return [Integer] Hash code
217
213
  def hash
218
- [annual_fee, duration_of_introductory_rate_on_balance_transfer, duration_of_introductory_rate_on_purchases, guid, has_cashback_rewards, has_other_rewards, has_travel_rewards, has_zero_introductory_annual_fee, has_zero_percent_introductory_rate, has_zero_percent_introductory_rate_on_balance_transfer, financial_institution, is_accepting_applications, is_small_business_card, name].hash
214
+ [annual_fee, duration_of_introductory_rate_on_balance_transfer, duration_of_introductory_rate_on_purchases, guid, has_cashback_rewards, has_other_rewards, has_travel_rewards, has_zero_introductory_annual_fee, has_zero_percent_introductory_rate, has_zero_percent_introductory_rate_on_balance_transfer, is_accepting_applicants, is_active_credit_card_product, is_small_business_card, name].hash
219
215
  end
220
216
 
221
217
  # Builds the object from hash
@@ -15,12 +15,12 @@ require 'time'
15
15
 
16
16
  module MxPlatformRuby
17
17
  class CreditCardProductResponse
18
- attr_accessor :reward
18
+ attr_accessor :credit_card_product
19
19
 
20
20
  # Attribute mapping from ruby-style variable name to JSON key.
21
21
  def self.attribute_map
22
22
  {
23
- :'reward' => :'reward'
23
+ :'credit_card_product' => :'credit_card_product'
24
24
  }
25
25
  end
26
26
 
@@ -32,7 +32,7 @@ module MxPlatformRuby
32
32
  # Attribute type mapping.
33
33
  def self.openapi_types
34
34
  {
35
- :'reward' => :'CreditCardProduct'
35
+ :'credit_card_product' => :'CreditCardProduct'
36
36
  }
37
37
  end
38
38
 
@@ -57,8 +57,8 @@ module MxPlatformRuby
57
57
  h[k.to_sym] = v
58
58
  }
59
59
 
60
- if attributes.key?(:'reward')
61
- self.reward = attributes[:'reward']
60
+ if attributes.key?(:'credit_card_product')
61
+ self.credit_card_product = attributes[:'credit_card_product']
62
62
  end
63
63
  end
64
64
 
@@ -82,7 +82,7 @@ module MxPlatformRuby
82
82
  def ==(o)
83
83
  return true if self.equal?(o)
84
84
  self.class == o.class &&
85
- reward == o.reward
85
+ credit_card_product == o.credit_card_product
86
86
  end
87
87
 
88
88
  # @see the `==` method
@@ -94,7 +94,7 @@ module MxPlatformRuby
94
94
  # Calculates hash code according to all attributes.
95
95
  # @return [Integer] Hash code
96
96
  def hash
97
- [reward].hash
97
+ [credit_card_product].hash
98
98
  end
99
99
 
100
100
  # Builds the object from hash
@@ -0,0 +1,350 @@
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: 7.0.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MxPlatformRuby
17
+ class GoalRequest
18
+ # Unique identifier of the account for the goal.
19
+ attr_accessor :account_guid
20
+
21
+ # Amount of the goal.
22
+ attr_accessor :amount
23
+
24
+ # The goal type.
25
+ attr_accessor :goal_type_name
26
+
27
+ # The category of the goal.
28
+ attr_accessor :meta_type_name
29
+
30
+ # The name of the goal.
31
+ attr_accessor :name
32
+
33
+ # Date and time the goal was completed.
34
+ attr_accessor :completed_at
35
+
36
+ # Determines if the goal has been spent.
37
+ attr_accessor :has_been_spent
38
+
39
+ # Determines if the goal is complete.
40
+ attr_accessor :is_complete
41
+
42
+ # Additional information a partner can store on the goal.
43
+ attr_accessor :metadata
44
+
45
+ # The priority of the goal in relation to multiple goals.
46
+ attr_accessor :position
47
+
48
+ # Date and time the goal is to complete. Intended for users to set their own goal completion dates.
49
+ attr_accessor :targeted_to_complete_at
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ :'account_guid' => :'account_guid',
55
+ :'amount' => :'amount',
56
+ :'goal_type_name' => :'goal_type_name',
57
+ :'meta_type_name' => :'meta_type_name',
58
+ :'name' => :'name',
59
+ :'completed_at' => :'completed_at',
60
+ :'has_been_spent' => :'has_been_spent',
61
+ :'is_complete' => :'is_complete',
62
+ :'metadata' => :'metadata',
63
+ :'position' => :'position',
64
+ :'targeted_to_complete_at' => :'targeted_to_complete_at'
65
+ }
66
+ end
67
+
68
+ # Returns all the JSON keys this model knows about
69
+ def self.acceptable_attributes
70
+ attribute_map.values
71
+ end
72
+
73
+ # Attribute type mapping.
74
+ def self.openapi_types
75
+ {
76
+ :'account_guid' => :'String',
77
+ :'amount' => :'Float',
78
+ :'goal_type_name' => :'String',
79
+ :'meta_type_name' => :'String',
80
+ :'name' => :'String',
81
+ :'completed_at' => :'String',
82
+ :'has_been_spent' => :'Boolean',
83
+ :'is_complete' => :'Boolean',
84
+ :'metadata' => :'String',
85
+ :'position' => :'Integer',
86
+ :'targeted_to_complete_at' => :'String'
87
+ }
88
+ end
89
+
90
+ # List of attributes with nullable: true
91
+ def self.openapi_nullable
92
+ Set.new([
93
+ ])
94
+ end
95
+
96
+ # Initializes the object
97
+ # @param [Hash] attributes Model attributes in the form of hash
98
+ def initialize(attributes = {})
99
+ if (!attributes.is_a?(Hash))
100
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MxPlatformRuby::GoalRequest` initialize method"
101
+ end
102
+
103
+ # check to see if the attribute exists and convert string to symbol for hash key
104
+ attributes = attributes.each_with_object({}) { |(k, v), h|
105
+ if (!self.class.attribute_map.key?(k.to_sym))
106
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MxPlatformRuby::GoalRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
107
+ end
108
+ h[k.to_sym] = v
109
+ }
110
+
111
+ if attributes.key?(:'account_guid')
112
+ self.account_guid = attributes[:'account_guid']
113
+ else
114
+ self.account_guid = nil
115
+ end
116
+
117
+ if attributes.key?(:'amount')
118
+ self.amount = attributes[:'amount']
119
+ else
120
+ self.amount = nil
121
+ end
122
+
123
+ if attributes.key?(:'goal_type_name')
124
+ self.goal_type_name = attributes[:'goal_type_name']
125
+ else
126
+ self.goal_type_name = nil
127
+ end
128
+
129
+ if attributes.key?(:'meta_type_name')
130
+ self.meta_type_name = attributes[:'meta_type_name']
131
+ else
132
+ self.meta_type_name = nil
133
+ end
134
+
135
+ if attributes.key?(:'name')
136
+ self.name = attributes[:'name']
137
+ else
138
+ self.name = nil
139
+ end
140
+
141
+ if attributes.key?(:'completed_at')
142
+ self.completed_at = attributes[:'completed_at']
143
+ end
144
+
145
+ if attributes.key?(:'has_been_spent')
146
+ self.has_been_spent = attributes[:'has_been_spent']
147
+ end
148
+
149
+ if attributes.key?(:'is_complete')
150
+ self.is_complete = attributes[:'is_complete']
151
+ end
152
+
153
+ if attributes.key?(:'metadata')
154
+ self.metadata = attributes[:'metadata']
155
+ end
156
+
157
+ if attributes.key?(:'position')
158
+ self.position = attributes[:'position']
159
+ end
160
+
161
+ if attributes.key?(:'targeted_to_complete_at')
162
+ self.targeted_to_complete_at = attributes[:'targeted_to_complete_at']
163
+ end
164
+ end
165
+
166
+ # Show invalid properties with the reasons. Usually used together with valid?
167
+ # @return Array for valid properties with the reasons
168
+ def list_invalid_properties
169
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
170
+ invalid_properties = Array.new
171
+ if @account_guid.nil?
172
+ invalid_properties.push('invalid value for "account_guid", account_guid cannot be nil.')
173
+ end
174
+
175
+ if @amount.nil?
176
+ invalid_properties.push('invalid value for "amount", amount cannot be nil.')
177
+ end
178
+
179
+ if @goal_type_name.nil?
180
+ invalid_properties.push('invalid value for "goal_type_name", goal_type_name cannot be nil.')
181
+ end
182
+
183
+ if @meta_type_name.nil?
184
+ invalid_properties.push('invalid value for "meta_type_name", meta_type_name cannot be nil.')
185
+ end
186
+
187
+ if @name.nil?
188
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
189
+ end
190
+
191
+ invalid_properties
192
+ end
193
+
194
+ # Check to see if the all the properties in the model are valid
195
+ # @return true if the model is valid
196
+ def valid?
197
+ warn '[DEPRECATED] the `valid?` method is obsolete'
198
+ return false if @account_guid.nil?
199
+ return false if @amount.nil?
200
+ return false if @goal_type_name.nil?
201
+ return false if @meta_type_name.nil?
202
+ return false if @name.nil?
203
+ true
204
+ end
205
+
206
+ # Checks equality by comparing each attribute.
207
+ # @param [Object] Object to be compared
208
+ def ==(o)
209
+ return true if self.equal?(o)
210
+ self.class == o.class &&
211
+ account_guid == o.account_guid &&
212
+ amount == o.amount &&
213
+ goal_type_name == o.goal_type_name &&
214
+ meta_type_name == o.meta_type_name &&
215
+ name == o.name &&
216
+ completed_at == o.completed_at &&
217
+ has_been_spent == o.has_been_spent &&
218
+ is_complete == o.is_complete &&
219
+ metadata == o.metadata &&
220
+ position == o.position &&
221
+ targeted_to_complete_at == o.targeted_to_complete_at
222
+ end
223
+
224
+ # @see the `==` method
225
+ # @param [Object] Object to be compared
226
+ def eql?(o)
227
+ self == o
228
+ end
229
+
230
+ # Calculates hash code according to all attributes.
231
+ # @return [Integer] Hash code
232
+ def hash
233
+ [account_guid, amount, goal_type_name, meta_type_name, name, completed_at, has_been_spent, is_complete, metadata, position, targeted_to_complete_at].hash
234
+ end
235
+
236
+ # Builds the object from hash
237
+ # @param [Hash] attributes Model attributes in the form of hash
238
+ # @return [Object] Returns the model itself
239
+ def self.build_from_hash(attributes)
240
+ return nil unless attributes.is_a?(Hash)
241
+ attributes = attributes.transform_keys(&:to_sym)
242
+ transformed_hash = {}
243
+ openapi_types.each_pair do |key, type|
244
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
245
+ transformed_hash["#{key}"] = nil
246
+ elsif type =~ /\AArray<(.*)>/i
247
+ # check to ensure the input is an array given that the attribute
248
+ # is documented as an array but the input is not
249
+ if attributes[attribute_map[key]].is_a?(Array)
250
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
251
+ end
252
+ elsif !attributes[attribute_map[key]].nil?
253
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
254
+ end
255
+ end
256
+ new(transformed_hash)
257
+ end
258
+
259
+ # Deserializes the data based on type
260
+ # @param string type Data type
261
+ # @param string value Value to be deserialized
262
+ # @return [Object] Deserialized data
263
+ def self._deserialize(type, value)
264
+ case type.to_sym
265
+ when :Time
266
+ Time.parse(value)
267
+ when :Date
268
+ Date.parse(value)
269
+ when :String
270
+ value.to_s
271
+ when :Integer
272
+ value.to_i
273
+ when :Float
274
+ value.to_f
275
+ when :Boolean
276
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
277
+ true
278
+ else
279
+ false
280
+ end
281
+ when :Object
282
+ # generic object (usually a Hash), return directly
283
+ value
284
+ when /\AArray<(?<inner_type>.+)>\z/
285
+ inner_type = Regexp.last_match[:inner_type]
286
+ value.map { |v| _deserialize(inner_type, v) }
287
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
288
+ k_type = Regexp.last_match[:k_type]
289
+ v_type = Regexp.last_match[:v_type]
290
+ {}.tap do |hash|
291
+ value.each do |k, v|
292
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
293
+ end
294
+ end
295
+ else # model
296
+ # models (e.g. Pet) or oneOf
297
+ klass = MxPlatformRuby.const_get(type)
298
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
299
+ end
300
+ end
301
+
302
+ # Returns the string representation of the object
303
+ # @return [String] String presentation of the object
304
+ def to_s
305
+ to_hash.to_s
306
+ end
307
+
308
+ # to_body is an alias to to_hash (backward compatibility)
309
+ # @return [Hash] Returns the object in the form of hash
310
+ def to_body
311
+ to_hash
312
+ end
313
+
314
+ # Returns the object in the form of hash
315
+ # @return [Hash] Returns the object in the form of hash
316
+ def to_hash
317
+ hash = {}
318
+ self.class.attribute_map.each_pair do |attr, param|
319
+ value = self.send(attr)
320
+ if value.nil?
321
+ is_nullable = self.class.openapi_nullable.include?(attr)
322
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
323
+ end
324
+
325
+ hash[param] = _to_hash(value)
326
+ end
327
+ hash
328
+ end
329
+
330
+ # Outputs non-array value in the form of hash
331
+ # For object, use to_hash. Otherwise, just return the value
332
+ # @param [Object] value Any valid value
333
+ # @return [Hash] Returns the value in the form of hash
334
+ def _to_hash(value)
335
+ if value.is_a?(Array)
336
+ value.compact.map { |v| _to_hash(v) }
337
+ elsif value.is_a?(Hash)
338
+ {}.tap do |hash|
339
+ value.each { |k, v| hash[k] = _to_hash(v) }
340
+ end
341
+ elsif value.respond_to? :to_hash
342
+ value.to_hash
343
+ else
344
+ value
345
+ end
346
+ end
347
+
348
+ end
349
+
350
+ end