atrium-ruby 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,74 @@
1
+ =begin
2
+ #MX API
3
+
4
+ #The MX Atrium API supports over 48,000 data connections to thousands of financial institutions. It provides secure access to your users' accounts and transactions with industry-leading cleansing, categorization, and classification. Atrium is designed according to resource-oriented REST architecture and responds with JSON bodies and HTTP response codes. Use Atrium's development environment, vestibule.mx.com, to quickly get up and running. The development environment limits are 100 users, 25 members per user, and access to the top 15 institutions. Contact MX to purchase production access.
5
+
6
+
7
+ =end
8
+
9
+ require 'uri'
10
+
11
+ module Atrium
12
+ class MerchantsApi
13
+ attr_accessor :api_client
14
+
15
+ def initialize(api_client = ApiClient.default)
16
+ @api_client = api_client
17
+ end
18
+ # Read merchant
19
+ # Returns information about a particular merchant, such as a logo, name, and website.
20
+ # @param merchant_guid The unique identifier for a `merchant`.
21
+ # @param [Hash] opts the optional parameters
22
+ # @return [MerchantResponseBody]
23
+ def read_merchant(merchant_guid, opts = {})
24
+ data, _status_code, _headers = read_merchant_with_http_info(merchant_guid, opts)
25
+ data
26
+ end
27
+
28
+
29
+ private
30
+
31
+ # Read merchant
32
+ # Returns information about a particular merchant, such as a logo, name, and website.
33
+ # @param merchant_guid The unique identifier for a `merchant`.
34
+ # @param [Hash] opts the optional parameters
35
+ # @return [Array<(MerchantResponseBody, Fixnum, Hash)>] MerchantResponseBody data, response status code and response headers
36
+ def read_merchant_with_http_info(merchant_guid, opts = {})
37
+ if @api_client.config.debugging
38
+ @api_client.config.logger.debug 'Calling API: MerchantsApi.read_merchant ...'
39
+ end
40
+ # verify the required parameter 'merchant_guid' is set
41
+ if @api_client.config.client_side_validation && merchant_guid.nil?
42
+ fail ArgumentError, "Missing the required parameter 'merchant_guid' when calling MerchantsApi.read_merchant"
43
+ end
44
+ # resource path
45
+ local_var_path = '/merchants/{merchant_guid}'.sub('{' + 'merchant_guid' + '}', merchant_guid.to_s)
46
+
47
+ # query parameters
48
+ query_params = {}
49
+
50
+ # header parameters
51
+ header_params = {}
52
+ # HTTP header 'Accept' (if needed)
53
+ header_params['Accept'] = @api_client.select_header_accept(['application/vnd.mx.atrium.v1+json'])
54
+
55
+ # form parameters
56
+ form_params = {}
57
+
58
+ # http body (model)
59
+ post_body = nil
60
+ auth_names = ['apiKey', 'clientID']
61
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
62
+ :header_params => header_params,
63
+ :query_params => query_params,
64
+ :form_params => form_params,
65
+ :body => post_body,
66
+ :auth_names => auth_names,
67
+ :return_type => 'MerchantResponseBody')
68
+ if @api_client.config.debugging
69
+ @api_client.config.logger.debug "API called: MerchantsApi#read_merchant\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
70
+ end
71
+ return data, status_code, headers
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,314 @@
1
+ =begin
2
+ #MX API
3
+
4
+ #The MX Atrium API supports over 48,000 data connections to thousands of financial institutions. It provides secure access to your users' accounts and transactions with industry-leading cleansing, categorization, and classification. Atrium is designed according to resource-oriented REST architecture and responds with JSON bodies and HTTP response codes. Use Atrium's development environment, vestibule.mx.com, to quickly get up and running. The development environment limits are 100 users, 25 members per user, and access to the top 15 institutions. Contact MX to purchase production access.
5
+
6
+
7
+ =end
8
+
9
+ require 'date'
10
+
11
+ module Atrium
12
+ class Holding
13
+ attr_accessor :account_guid
14
+
15
+ attr_accessor :cost_basis
16
+
17
+ attr_accessor :created_at
18
+
19
+ attr_accessor :currency_code
20
+
21
+ attr_accessor :cusip
22
+
23
+ attr_accessor :daily_change
24
+
25
+ attr_accessor :description
26
+
27
+ attr_accessor :guid
28
+
29
+ attr_accessor :holding_type
30
+
31
+ attr_accessor :market_value
32
+
33
+ attr_accessor :member_guid
34
+
35
+ attr_accessor :purchase_price
36
+
37
+ attr_accessor :shares
38
+
39
+ attr_accessor :symbol
40
+
41
+ attr_accessor :updated_at
42
+
43
+ attr_accessor :user_guid
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
46
+ def self.attribute_map
47
+ {
48
+ :'account_guid' => :'account_guid',
49
+ :'cost_basis' => :'cost_basis',
50
+ :'created_at' => :'created_at',
51
+ :'currency_code' => :'currency_code',
52
+ :'cusip' => :'cusip',
53
+ :'daily_change' => :'daily_change',
54
+ :'description' => :'description',
55
+ :'guid' => :'guid',
56
+ :'holding_type' => :'holding_type',
57
+ :'market_value' => :'market_value',
58
+ :'member_guid' => :'member_guid',
59
+ :'purchase_price' => :'purchase_price',
60
+ :'shares' => :'shares',
61
+ :'symbol' => :'symbol',
62
+ :'updated_at' => :'updated_at',
63
+ :'user_guid' => :'user_guid'
64
+ }
65
+ end
66
+
67
+ # Attribute type mapping.
68
+ def self.mx_types
69
+ {
70
+ :'account_guid' => :'String',
71
+ :'cost_basis' => :'Float',
72
+ :'created_at' => :'String',
73
+ :'currency_code' => :'String',
74
+ :'cusip' => :'String',
75
+ :'daily_change' => :'Float',
76
+ :'description' => :'String',
77
+ :'guid' => :'String',
78
+ :'holding_type' => :'String',
79
+ :'market_value' => :'Float',
80
+ :'member_guid' => :'String',
81
+ :'purchase_price' => :'Float',
82
+ :'shares' => :'Float',
83
+ :'symbol' => :'String',
84
+ :'updated_at' => :'String',
85
+ :'user_guid' => :'String'
86
+ }
87
+ end
88
+
89
+ # Initializes the object
90
+ # @param [Hash] attributes Model attributes in the form of hash
91
+ def initialize(attributes = {})
92
+ return unless attributes.is_a?(Hash)
93
+
94
+ # convert string to symbol for hash key
95
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
96
+
97
+ if attributes.has_key?(:'account_guid')
98
+ self.account_guid = attributes[:'account_guid']
99
+ end
100
+
101
+ if attributes.has_key?(:'cost_basis')
102
+ self.cost_basis = attributes[:'cost_basis']
103
+ end
104
+
105
+ if attributes.has_key?(:'created_at')
106
+ self.created_at = attributes[:'created_at']
107
+ end
108
+
109
+ if attributes.has_key?(:'currency_code')
110
+ self.currency_code = attributes[:'currency_code']
111
+ end
112
+
113
+ if attributes.has_key?(:'cusip')
114
+ self.cusip = attributes[:'cusip']
115
+ end
116
+
117
+ if attributes.has_key?(:'daily_change')
118
+ self.daily_change = attributes[:'daily_change']
119
+ end
120
+
121
+ if attributes.has_key?(:'description')
122
+ self.description = attributes[:'description']
123
+ end
124
+
125
+ if attributes.has_key?(:'guid')
126
+ self.guid = attributes[:'guid']
127
+ end
128
+
129
+ if attributes.has_key?(:'holding_type')
130
+ self.holding_type = attributes[:'holding_type']
131
+ end
132
+
133
+ if attributes.has_key?(:'market_value')
134
+ self.market_value = attributes[:'market_value']
135
+ end
136
+
137
+ if attributes.has_key?(:'member_guid')
138
+ self.member_guid = attributes[:'member_guid']
139
+ end
140
+
141
+ if attributes.has_key?(:'purchase_price')
142
+ self.purchase_price = attributes[:'purchase_price']
143
+ end
144
+
145
+ if attributes.has_key?(:'shares')
146
+ self.shares = attributes[:'shares']
147
+ end
148
+
149
+ if attributes.has_key?(:'symbol')
150
+ self.symbol = attributes[:'symbol']
151
+ end
152
+
153
+ if attributes.has_key?(:'updated_at')
154
+ self.updated_at = attributes[:'updated_at']
155
+ end
156
+
157
+ if attributes.has_key?(:'user_guid')
158
+ self.user_guid = attributes[:'user_guid']
159
+ end
160
+ end
161
+
162
+ # Show invalid properties with the reasons. Usually used together with valid?
163
+ # @return Array for valid properties with the reasons
164
+ def list_invalid_properties
165
+ invalid_properties = Array.new
166
+ invalid_properties
167
+ end
168
+
169
+ # Check to see if the all the properties in the model are valid
170
+ # @return true if the model is valid
171
+ def valid?
172
+ true
173
+ end
174
+
175
+ # Checks equality by comparing each attribute.
176
+ # @param [Object] Object to be compared
177
+ def ==(o)
178
+ return true if self.equal?(o)
179
+ self.class == o.class &&
180
+ account_guid == o.account_guid &&
181
+ cost_basis == o.cost_basis &&
182
+ created_at == o.created_at &&
183
+ currency_code == o.currency_code &&
184
+ cusip == o.cusip &&
185
+ daily_change == o.daily_change &&
186
+ description == o.description &&
187
+ guid == o.guid &&
188
+ holding_type == o.holding_type &&
189
+ market_value == o.market_value &&
190
+ member_guid == o.member_guid &&
191
+ purchase_price == o.purchase_price &&
192
+ shares == o.shares &&
193
+ symbol == o.symbol &&
194
+ updated_at == o.updated_at &&
195
+ user_guid == o.user_guid
196
+ end
197
+
198
+ # @see the `==` method
199
+ # @param [Object] Object to be compared
200
+ def eql?(o)
201
+ self == o
202
+ end
203
+
204
+ # Calculates hash code according to all attributes.
205
+ # @return [Fixnum] Hash code
206
+ def hash
207
+ [account_guid, cost_basis, created_at, currency_code, cusip, daily_change, description, guid, holding_type, market_value, member_guid, purchase_price, shares, symbol, updated_at, user_guid].hash
208
+ end
209
+
210
+ # Builds the object from hash
211
+ # @param [Hash] attributes Model attributes in the form of hash
212
+ # @return [Object] Returns the model itself
213
+ def build_from_hash(attributes)
214
+ return nil unless attributes.is_a?(Hash)
215
+ self.class.mx_types.each_pair do |key, type|
216
+ if type =~ /\AArray<(.*)>/i
217
+ # check to ensure the input is an array given that the the attribute
218
+ # is documented as an array but the input is not
219
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
220
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
221
+ end
222
+ elsif !attributes[self.class.attribute_map[key]].nil?
223
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
224
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
225
+ end
226
+
227
+ self
228
+ end
229
+
230
+ # Deserializes the data based on type
231
+ # @param string type Data type
232
+ # @param string value Value to be deserialized
233
+ # @return [Object] Deserialized data
234
+ def _deserialize(type, value)
235
+ case type.to_sym
236
+ when :DateTime
237
+ DateTime.parse(value)
238
+ when :Date
239
+ Date.parse(value)
240
+ when :String
241
+ value.to_s
242
+ when :Integer
243
+ value.to_i
244
+ when :Float
245
+ value.to_f
246
+ when :BOOLEAN
247
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
248
+ true
249
+ else
250
+ false
251
+ end
252
+ when :Object
253
+ # generic object (usually a Hash), return directly
254
+ value
255
+ when /\AArray<(?<inner_type>.+)>\z/
256
+ inner_type = Regexp.last_match[:inner_type]
257
+ value.map { |v| _deserialize(inner_type, v) }
258
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
259
+ k_type = Regexp.last_match[:k_type]
260
+ v_type = Regexp.last_match[:v_type]
261
+ {}.tap do |hash|
262
+ value.each do |k, v|
263
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
264
+ end
265
+ end
266
+ else # model
267
+ temp_model = Atrium.const_get(type).new
268
+ temp_model.build_from_hash(value)
269
+ end
270
+ end
271
+
272
+ # Returns the string representation of the object
273
+ # @return [String] String presentation of the object
274
+ def to_s
275
+ to_hash.to_s
276
+ end
277
+
278
+ # to_body is an alias to to_hash (backward compatibility)
279
+ # @return [Hash] Returns the object in the form of hash
280
+ def to_body
281
+ to_hash
282
+ end
283
+
284
+ # Returns the object in the form of hash
285
+ # @return [Hash] Returns the object in the form of hash
286
+ def to_hash
287
+ hash = {}
288
+ self.class.attribute_map.each_pair do |attr, param|
289
+ value = self.send(attr)
290
+ next if value.nil?
291
+ hash[param] = _to_hash(value)
292
+ end
293
+ hash
294
+ end
295
+
296
+ # Outputs non-array value in the form of hash
297
+ # For object, use to_hash. Otherwise, just return the value
298
+ # @param [Object] value Any valid value
299
+ # @return [Hash] Returns the value in the form of hash
300
+ def _to_hash(value)
301
+ if value.is_a?(Array)
302
+ value.compact.map { |v| _to_hash(v) }
303
+ elsif value.is_a?(Hash)
304
+ {}.tap do |hash|
305
+ value.each { |k, v| hash[k] = _to_hash(v) }
306
+ end
307
+ elsif value.respond_to? :to_hash
308
+ value.to_hash
309
+ else
310
+ value
311
+ end
312
+ end
313
+ end
314
+ end
@@ -0,0 +1,179 @@
1
+ =begin
2
+ #MX API
3
+
4
+ #The MX Atrium API supports over 48,000 data connections to thousands of financial institutions. It provides secure access to your users' accounts and transactions with industry-leading cleansing, categorization, and classification. Atrium is designed according to resource-oriented REST architecture and responds with JSON bodies and HTTP response codes. Use Atrium's development environment, vestibule.mx.com, to quickly get up and running. The development environment limits are 100 users, 25 members per user, and access to the top 15 institutions. Contact MX to purchase production access.
5
+
6
+
7
+ =end
8
+
9
+ require 'date'
10
+
11
+ module Atrium
12
+ class HoldingResponseBody
13
+ attr_accessor :holding
14
+
15
+ # Attribute mapping from ruby-style variable name to JSON key.
16
+ def self.attribute_map
17
+ {
18
+ :'holding' => :'holding'
19
+ }
20
+ end
21
+
22
+ # Attribute type mapping.
23
+ def self.mx_types
24
+ {
25
+ :'holding' => :'Holding'
26
+ }
27
+ end
28
+
29
+ # Initializes the object
30
+ # @param [Hash] attributes Model attributes in the form of hash
31
+ def initialize(attributes = {})
32
+ return unless attributes.is_a?(Hash)
33
+
34
+ # convert string to symbol for hash key
35
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
36
+
37
+ if attributes.has_key?(:'holding')
38
+ self.holding = attributes[:'holding']
39
+ end
40
+ end
41
+
42
+ # Show invalid properties with the reasons. Usually used together with valid?
43
+ # @return Array for valid properties with the reasons
44
+ def list_invalid_properties
45
+ invalid_properties = Array.new
46
+ invalid_properties
47
+ end
48
+
49
+ # Check to see if the all the properties in the model are valid
50
+ # @return true if the model is valid
51
+ def valid?
52
+ true
53
+ end
54
+
55
+ # Checks equality by comparing each attribute.
56
+ # @param [Object] Object to be compared
57
+ def ==(o)
58
+ return true if self.equal?(o)
59
+ self.class == o.class &&
60
+ holding == o.holding
61
+ end
62
+
63
+ # @see the `==` method
64
+ # @param [Object] Object to be compared
65
+ def eql?(o)
66
+ self == o
67
+ end
68
+
69
+ # Calculates hash code according to all attributes.
70
+ # @return [Fixnum] Hash code
71
+ def hash
72
+ [holding].hash
73
+ end
74
+
75
+ # Builds the object from hash
76
+ # @param [Hash] attributes Model attributes in the form of hash
77
+ # @return [Object] Returns the model itself
78
+ def build_from_hash(attributes)
79
+ return nil unless attributes.is_a?(Hash)
80
+ self.class.mx_types.each_pair do |key, type|
81
+ if type =~ /\AArray<(.*)>/i
82
+ # check to ensure the input is an array given that the the attribute
83
+ # is documented as an array but the input is not
84
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
85
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
86
+ end
87
+ elsif !attributes[self.class.attribute_map[key]].nil?
88
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
89
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
90
+ end
91
+
92
+ self
93
+ end
94
+
95
+ # Deserializes the data based on type
96
+ # @param string type Data type
97
+ # @param string value Value to be deserialized
98
+ # @return [Object] Deserialized data
99
+ def _deserialize(type, value)
100
+ case type.to_sym
101
+ when :DateTime
102
+ DateTime.parse(value)
103
+ when :Date
104
+ Date.parse(value)
105
+ when :String
106
+ value.to_s
107
+ when :Integer
108
+ value.to_i
109
+ when :Float
110
+ value.to_f
111
+ when :BOOLEAN
112
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
113
+ true
114
+ else
115
+ false
116
+ end
117
+ when :Object
118
+ # generic object (usually a Hash), return directly
119
+ value
120
+ when /\AArray<(?<inner_type>.+)>\z/
121
+ inner_type = Regexp.last_match[:inner_type]
122
+ value.map { |v| _deserialize(inner_type, v) }
123
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
124
+ k_type = Regexp.last_match[:k_type]
125
+ v_type = Regexp.last_match[:v_type]
126
+ {}.tap do |hash|
127
+ value.each do |k, v|
128
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
129
+ end
130
+ end
131
+ else # model
132
+ temp_model = Atrium.const_get(type).new
133
+ temp_model.build_from_hash(value)
134
+ end
135
+ end
136
+
137
+ # Returns the string representation of the object
138
+ # @return [String] String presentation of the object
139
+ def to_s
140
+ to_hash.to_s
141
+ end
142
+
143
+ # to_body is an alias to to_hash (backward compatibility)
144
+ # @return [Hash] Returns the object in the form of hash
145
+ def to_body
146
+ to_hash
147
+ end
148
+
149
+ # Returns the object in the form of hash
150
+ # @return [Hash] Returns the object in the form of hash
151
+ def to_hash
152
+ hash = {}
153
+ self.class.attribute_map.each_pair do |attr, param|
154
+ value = self.send(attr)
155
+ next if value.nil?
156
+ hash[param] = _to_hash(value)
157
+ end
158
+ hash
159
+ end
160
+
161
+ # Outputs non-array value in the form of hash
162
+ # For object, use to_hash. Otherwise, just return the value
163
+ # @param [Object] value Any valid value
164
+ # @return [Hash] Returns the value in the form of hash
165
+ def _to_hash(value)
166
+ if value.is_a?(Array)
167
+ value.compact.map { |v| _to_hash(v) }
168
+ elsif value.is_a?(Hash)
169
+ {}.tap do |hash|
170
+ value.each { |k, v| hash[k] = _to_hash(v) }
171
+ end
172
+ elsif value.respond_to? :to_hash
173
+ value.to_hash
174
+ else
175
+ value
176
+ end
177
+ end
178
+ end
179
+ end