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