mx-platform-ruby 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +40 -41
  4. data/docs/AccountNumberResponse.md +32 -0
  5. data/docs/AccountNumbersResponseBody.md +2 -2
  6. data/docs/AccountOwnerResponse.md +40 -0
  7. data/docs/AccountOwnersResponseBody.md +2 -2
  8. data/docs/AccountResponse.md +96 -0
  9. data/docs/AccountResponseBody.md +1 -1
  10. data/docs/AccountsResponseBody.md +2 -2
  11. data/docs/CategoriesResponseBody.md +2 -2
  12. data/docs/CategoryResponse.md +32 -0
  13. data/docs/CategoryResponseBody.md +1 -1
  14. data/docs/ChallengeResponse.md +30 -0
  15. data/docs/ChallengeResponseImageOptions.md +22 -0
  16. data/docs/ChallengeResponseOptions.md +20 -0
  17. data/docs/ChallengesResponseBody.md +2 -2
  18. data/docs/ConnectWidgetResponse.md +20 -0
  19. data/docs/ConnectWidgetResponseBody.md +1 -1
  20. data/docs/CredentialResponse.md +26 -0
  21. data/docs/CredentialsResponseBody.md +2 -2
  22. data/docs/EnhanceTransactionResponse.md +48 -0
  23. data/docs/EnhanceTransactionsResponseBody.md +1 -1
  24. data/docs/HoldingResponse.md +52 -0
  25. data/docs/HoldingResponseBody.md +1 -1
  26. data/docs/HoldingsResponseBody.md +2 -2
  27. data/docs/InstitutionResponse.md +36 -0
  28. data/docs/InstitutionResponseBody.md +1 -1
  29. data/docs/InstitutionsResponseBody.md +2 -2
  30. data/docs/MemberResponse.md +40 -0
  31. data/docs/MemberResponseBody.md +1 -1
  32. data/docs/MemberStatusResponse.md +34 -0
  33. data/docs/MemberStatusResponseBody.md +1 -1
  34. data/docs/MembersResponseBody.md +2 -2
  35. data/docs/MerchantResponse.md +28 -0
  36. data/docs/MerchantResponseBody.md +1 -1
  37. data/docs/MerchantsResponseBody.md +2 -2
  38. data/docs/MxPlatformApi.md +196 -196
  39. data/docs/OAuthWindowResponse.md +20 -0
  40. data/docs/OAuthWindowResponseBody.md +1 -1
  41. data/docs/PaginationResponse.md +24 -0
  42. data/docs/StatementResponse.md +32 -0
  43. data/docs/StatementResponseBody.md +1 -1
  44. data/docs/StatementsResponseBody.md +2 -2
  45. data/docs/TagResponse.md +22 -0
  46. data/docs/TagResponseBody.md +1 -1
  47. data/docs/TaggingResponse.md +26 -0
  48. data/docs/TaggingResponseBody.md +1 -1
  49. data/docs/TaggingsResponseBody.md +2 -2
  50. data/docs/TagsResponseBody.md +2 -2
  51. data/docs/TransactionResponse.md +88 -0
  52. data/docs/TransactionResponseBody.md +1 -1
  53. data/docs/TransactionRuleResponse.md +30 -0
  54. data/docs/TransactionRuleResponseBody.md +1 -1
  55. data/docs/TransactionRulesResponseBody.md +2 -2
  56. data/docs/TransactionsResponseBody.md +2 -2
  57. data/docs/UserResponse.md +26 -0
  58. data/docs/UserResponseBody.md +1 -1
  59. data/docs/UsersResponseBody.md +2 -2
  60. data/docs/WidgetResponse.md +22 -0
  61. data/docs/WidgetResponseBody.md +1 -1
  62. data/lib/mx-platform-ruby.rb +24 -25
  63. data/lib/mx-platform-ruby/api/mx_platform_api.rb +185 -185
  64. data/lib/mx-platform-ruby/models/account_number_response.rb +281 -0
  65. data/lib/mx-platform-ruby/models/account_numbers_response_body.rb +2 -2
  66. data/lib/mx-platform-ruby/models/account_owner_response.rb +317 -0
  67. data/lib/mx-platform-ruby/models/account_owners_response_body.rb +2 -2
  68. data/lib/mx-platform-ruby/models/account_response.rb +569 -0
  69. data/lib/mx-platform-ruby/models/account_response_body.rb +1 -1
  70. data/lib/mx-platform-ruby/models/accounts_response_body.rb +2 -2
  71. data/lib/mx-platform-ruby/models/categories_response_body.rb +2 -2
  72. data/lib/mx-platform-ruby/models/category_response.rb +281 -0
  73. data/lib/mx-platform-ruby/models/category_response_body.rb +1 -1
  74. data/lib/mx-platform-ruby/models/challenge_response.rb +276 -0
  75. data/lib/mx-platform-ruby/models/challenge_response_image_options.rb +236 -0
  76. data/lib/mx-platform-ruby/models/challenge_response_options.rb +227 -0
  77. data/lib/mx-platform-ruby/models/challenges_response_body.rb +2 -2
  78. data/lib/mx-platform-ruby/models/connect_widget_response.rb +227 -0
  79. data/lib/mx-platform-ruby/models/connect_widget_response_body.rb +1 -1
  80. data/lib/mx-platform-ruby/models/credential_response.rb +254 -0
  81. data/lib/mx-platform-ruby/models/credentials_response_body.rb +2 -2
  82. data/lib/mx-platform-ruby/models/enhance_transaction_response.rb +353 -0
  83. data/lib/mx-platform-ruby/models/enhance_transactions_response_body.rb +1 -1
  84. data/lib/mx-platform-ruby/models/holding_response.rb +371 -0
  85. data/lib/mx-platform-ruby/models/holding_response_body.rb +1 -1
  86. data/lib/mx-platform-ruby/models/holdings_response_body.rb +2 -2
  87. data/lib/mx-platform-ruby/models/institution_response.rb +299 -0
  88. data/lib/mx-platform-ruby/models/institution_response_body.rb +1 -1
  89. data/lib/mx-platform-ruby/models/institutions_response_body.rb +2 -2
  90. data/lib/mx-platform-ruby/models/member_response.rb +317 -0
  91. data/lib/mx-platform-ruby/models/member_response_body.rb +1 -1
  92. data/lib/mx-platform-ruby/models/member_status_response.rb +292 -0
  93. data/lib/mx-platform-ruby/models/member_status_response_body.rb +1 -1
  94. data/lib/mx-platform-ruby/models/members_response_body.rb +2 -2
  95. data/lib/mx-platform-ruby/models/merchant_response.rb +263 -0
  96. data/lib/mx-platform-ruby/models/merchant_response_body.rb +1 -1
  97. data/lib/mx-platform-ruby/models/merchants_response_body.rb +2 -2
  98. data/lib/mx-platform-ruby/models/o_auth_window_response.rb +227 -0
  99. data/lib/mx-platform-ruby/models/o_auth_window_response_body.rb +1 -1
  100. data/lib/mx-platform-ruby/models/pagination_response.rb +245 -0
  101. data/lib/mx-platform-ruby/models/statement_response.rb +281 -0
  102. data/lib/mx-platform-ruby/models/statement_response_body.rb +1 -1
  103. data/lib/mx-platform-ruby/models/statements_response_body.rb +2 -2
  104. data/lib/mx-platform-ruby/models/tag_response.rb +236 -0
  105. data/lib/mx-platform-ruby/models/tag_response_body.rb +1 -1
  106. data/lib/mx-platform-ruby/models/tagging_response.rb +254 -0
  107. data/lib/mx-platform-ruby/models/tagging_response_body.rb +1 -1
  108. data/lib/mx-platform-ruby/models/taggings_response_body.rb +2 -2
  109. data/lib/mx-platform-ruby/models/tags_response_body.rb +2 -2
  110. data/lib/mx-platform-ruby/models/transaction_response.rb +533 -0
  111. data/lib/mx-platform-ruby/models/transaction_response_body.rb +1 -1
  112. data/lib/mx-platform-ruby/models/transaction_rule_response.rb +272 -0
  113. data/lib/mx-platform-ruby/models/transaction_rule_response_body.rb +1 -1
  114. data/lib/mx-platform-ruby/models/transaction_rules_response_body.rb +2 -2
  115. data/lib/mx-platform-ruby/models/transactions_response_body.rb +2 -2
  116. data/lib/mx-platform-ruby/models/user_response.rb +254 -0
  117. data/lib/mx-platform-ruby/models/user_response_body.rb +1 -1
  118. data/lib/mx-platform-ruby/models/users_response_body.rb +2 -2
  119. data/lib/mx-platform-ruby/models/widget_response.rb +236 -0
  120. data/lib/mx-platform-ruby/models/widget_response_body.rb +1 -1
  121. data/lib/mx-platform-ruby/version.rb +1 -1
  122. data/openapi/config.yml +11 -0
  123. data/pkg/mx-platform-ruby-0.2.1.gem +0 -0
  124. data/spec/api/mx_platform_api_spec.rb +51 -51
  125. data/spec/models/account_number_response_spec.rb +76 -0
  126. data/spec/models/account_owner_response_spec.rb +100 -0
  127. data/spec/models/account_response_spec.rb +268 -0
  128. data/spec/models/category_response_spec.rb +76 -0
  129. data/spec/models/challenge_response_image_options_spec.rb +46 -0
  130. data/spec/models/challenge_response_options_spec.rb +40 -0
  131. data/spec/models/challenge_response_spec.rb +70 -0
  132. data/spec/models/connect_widget_response_spec.rb +40 -0
  133. data/spec/models/credential_response_spec.rb +58 -0
  134. data/spec/models/enhance_transaction_response_spec.rb +124 -0
  135. data/spec/models/holding_response_spec.rb +136 -0
  136. data/spec/models/institution_response_spec.rb +88 -0
  137. data/spec/models/member_response_spec.rb +100 -0
  138. data/spec/models/member_status_response_spec.rb +82 -0
  139. data/spec/models/merchant_response_spec.rb +64 -0
  140. data/spec/models/o_auth_window_response_spec.rb +40 -0
  141. data/spec/models/pagination_response_spec.rb +52 -0
  142. data/spec/models/statement_response_spec.rb +76 -0
  143. data/spec/models/tag_response_spec.rb +46 -0
  144. data/spec/models/tagging_response_spec.rb +58 -0
  145. data/spec/models/transaction_response_spec.rb +244 -0
  146. data/spec/models/transaction_rule_response_spec.rb +70 -0
  147. data/spec/models/user_response_spec.rb +58 -0
  148. data/spec/models/widget_response_spec.rb +46 -0
  149. metadata +100 -2
@@ -0,0 +1,236 @@
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 ChallengeResponseImageOptions
18
+ attr_accessor :data_uri
19
+
20
+ attr_accessor :label
21
+
22
+ attr_accessor :value
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'data_uri' => :'data_uri',
28
+ :'label' => :'label',
29
+ :'value' => :'value'
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
+ :'data_uri' => :'String',
42
+ :'label' => :'String',
43
+ :'value' => :'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 `MxPlatformRuby::ChallengeResponseImageOptions` 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 `MxPlatformRuby::ChallengeResponseImageOptions`. 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?(:'data_uri')
69
+ self.data_uri = attributes[:'data_uri']
70
+ end
71
+
72
+ if attributes.key?(:'label')
73
+ self.label = attributes[:'label']
74
+ end
75
+
76
+ if attributes.key?(:'value')
77
+ self.value = attributes[:'value']
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
+ data_uri == o.data_uri &&
100
+ label == o.label &&
101
+ value == o.value
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
+ [data_uri, label, value].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
+ self.class.openapi_types.each_pair do |key, type|
129
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
130
+ self.send("#{key}=", nil)
131
+ elsif type =~ /\AArray<(.*)>/i
132
+ # check to ensure the input is an array given that the attribute
133
+ # is documented as an array but the input is not
134
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
135
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
136
+ end
137
+ elsif !attributes[self.class.attribute_map[key]].nil?
138
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
139
+ end
140
+ end
141
+
142
+ self
143
+ end
144
+
145
+ # Deserializes the data based on type
146
+ # @param string type Data type
147
+ # @param string value Value to be deserialized
148
+ # @return [Object] Deserialized data
149
+ def _deserialize(type, value)
150
+ case type.to_sym
151
+ when :Time
152
+ Time.parse(value)
153
+ when :Date
154
+ Date.parse(value)
155
+ when :String
156
+ value.to_s
157
+ when :Integer
158
+ value.to_i
159
+ when :Float
160
+ value.to_f
161
+ when :Boolean
162
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
163
+ true
164
+ else
165
+ false
166
+ end
167
+ when :Object
168
+ # generic object (usually a Hash), return directly
169
+ value
170
+ when /\AArray<(?<inner_type>.+)>\z/
171
+ inner_type = Regexp.last_match[:inner_type]
172
+ value.map { |v| _deserialize(inner_type, v) }
173
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
174
+ k_type = Regexp.last_match[:k_type]
175
+ v_type = Regexp.last_match[:v_type]
176
+ {}.tap do |hash|
177
+ value.each do |k, v|
178
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
179
+ end
180
+ end
181
+ else # model
182
+ # models (e.g. Pet) or oneOf
183
+ klass = MxPlatformRuby.const_get(type)
184
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
185
+ end
186
+ end
187
+
188
+ # Returns the string representation of the object
189
+ # @return [String] String presentation of the object
190
+ def to_s
191
+ to_hash.to_s
192
+ end
193
+
194
+ # to_body is an alias to to_hash (backward compatibility)
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_body
197
+ to_hash
198
+ end
199
+
200
+ # Returns the object in the form of hash
201
+ # @return [Hash] Returns the object in the form of hash
202
+ def to_hash
203
+ hash = {}
204
+ self.class.attribute_map.each_pair do |attr, param|
205
+ value = self.send(attr)
206
+ if value.nil?
207
+ is_nullable = self.class.openapi_nullable.include?(attr)
208
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
209
+ end
210
+
211
+ hash[param] = _to_hash(value)
212
+ end
213
+ hash
214
+ end
215
+
216
+ # Outputs non-array value in the form of hash
217
+ # For object, use to_hash. Otherwise, just return the value
218
+ # @param [Object] value Any valid value
219
+ # @return [Hash] Returns the value in the form of hash
220
+ def _to_hash(value)
221
+ if value.is_a?(Array)
222
+ value.compact.map { |v| _to_hash(v) }
223
+ elsif value.is_a?(Hash)
224
+ {}.tap do |hash|
225
+ value.each { |k, v| hash[k] = _to_hash(v) }
226
+ end
227
+ elsif value.respond_to? :to_hash
228
+ value.to_hash
229
+ else
230
+ value
231
+ end
232
+ end
233
+
234
+ end
235
+
236
+ end
@@ -0,0 +1,227 @@
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 ChallengeResponseOptions
18
+ attr_accessor :label
19
+
20
+ attr_accessor :value
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'label' => :'label',
26
+ :'value' => :'value'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'label' => :'String',
39
+ :'value' => :'String'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MxPlatformRuby::ChallengeResponseOptions` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MxPlatformRuby::ChallengeResponseOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'label')
65
+ self.label = attributes[:'label']
66
+ end
67
+
68
+ if attributes.key?(:'value')
69
+ self.value = attributes[:'value']
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ invalid_properties = Array.new
77
+ invalid_properties
78
+ end
79
+
80
+ # Check to see if the all the properties in the model are valid
81
+ # @return true if the model is valid
82
+ def valid?
83
+ true
84
+ end
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] Object to be compared
88
+ def ==(o)
89
+ return true if self.equal?(o)
90
+ self.class == o.class &&
91
+ label == o.label &&
92
+ value == o.value
93
+ end
94
+
95
+ # @see the `==` method
96
+ # @param [Object] Object to be compared
97
+ def eql?(o)
98
+ self == o
99
+ end
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Integer] Hash code
103
+ def hash
104
+ [label, value].hash
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def self.build_from_hash(attributes)
111
+ new.build_from_hash(attributes)
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def build_from_hash(attributes)
118
+ return nil unless attributes.is_a?(Hash)
119
+ self.class.openapi_types.each_pair do |key, type|
120
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
121
+ self.send("#{key}=", nil)
122
+ elsif type =~ /\AArray<(.*)>/i
123
+ # check to ensure the input is an array given that the attribute
124
+ # is documented as an array but the input is not
125
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
126
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
127
+ end
128
+ elsif !attributes[self.class.attribute_map[key]].nil?
129
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
130
+ end
131
+ end
132
+
133
+ self
134
+ end
135
+
136
+ # Deserializes the data based on type
137
+ # @param string type Data type
138
+ # @param string value Value to be deserialized
139
+ # @return [Object] Deserialized data
140
+ def _deserialize(type, value)
141
+ case type.to_sym
142
+ when :Time
143
+ Time.parse(value)
144
+ when :Date
145
+ Date.parse(value)
146
+ when :String
147
+ value.to_s
148
+ when :Integer
149
+ value.to_i
150
+ when :Float
151
+ value.to_f
152
+ when :Boolean
153
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
154
+ true
155
+ else
156
+ false
157
+ end
158
+ when :Object
159
+ # generic object (usually a Hash), return directly
160
+ value
161
+ when /\AArray<(?<inner_type>.+)>\z/
162
+ inner_type = Regexp.last_match[:inner_type]
163
+ value.map { |v| _deserialize(inner_type, v) }
164
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
165
+ k_type = Regexp.last_match[:k_type]
166
+ v_type = Regexp.last_match[:v_type]
167
+ {}.tap do |hash|
168
+ value.each do |k, v|
169
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
170
+ end
171
+ end
172
+ else # model
173
+ # models (e.g. Pet) or oneOf
174
+ klass = MxPlatformRuby.const_get(type)
175
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
176
+ end
177
+ end
178
+
179
+ # Returns the string representation of the object
180
+ # @return [String] String presentation of the object
181
+ def to_s
182
+ to_hash.to_s
183
+ end
184
+
185
+ # to_body is an alias to to_hash (backward compatibility)
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_body
188
+ to_hash
189
+ end
190
+
191
+ # Returns the object in the form of hash
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_hash
194
+ hash = {}
195
+ self.class.attribute_map.each_pair do |attr, param|
196
+ value = self.send(attr)
197
+ if value.nil?
198
+ is_nullable = self.class.openapi_nullable.include?(attr)
199
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
200
+ end
201
+
202
+ hash[param] = _to_hash(value)
203
+ end
204
+ hash
205
+ end
206
+
207
+ # Outputs non-array value in the form of hash
208
+ # For object, use to_hash. Otherwise, just return the value
209
+ # @param [Object] value Any valid value
210
+ # @return [Hash] Returns the value in the form of hash
211
+ def _to_hash(value)
212
+ if value.is_a?(Array)
213
+ value.compact.map { |v| _to_hash(v) }
214
+ elsif value.is_a?(Hash)
215
+ {}.tap do |hash|
216
+ value.each { |k, v| hash[k] = _to_hash(v) }
217
+ end
218
+ elsif value.respond_to? :to_hash
219
+ value.to_hash
220
+ else
221
+ value
222
+ end
223
+ end
224
+
225
+ end
226
+
227
+ end