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