atrium-ruby 1.3.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +5 -2
- data/README.md +132 -66
- data/Rakefile +7 -4
- data/atrium-ruby.gemspec +40 -32
- data/docs/Account.md +35 -0
- data/docs/AccountNumber.md +12 -0
- data/docs/AccountNumbersResponseBody.md +8 -0
- data/docs/AccountOwner.md +18 -0
- data/docs/AccountOwnersResponseBody.md +8 -0
- data/docs/AccountResponseBody.md +8 -0
- data/docs/AccountsApi.md +174 -0
- data/docs/AccountsResponseBody.md +9 -0
- data/docs/Challenge.md +13 -0
- data/docs/ChallengeOption.md +10 -0
- data/docs/ChallengesResponseBody.md +8 -0
- data/docs/ConnectWidget.md +9 -0
- data/docs/ConnectWidgetApi.md +44 -0
- data/docs/ConnectWidgetRequestBody.md +11 -0
- data/docs/ConnectWidgetResponseBody.md +8 -0
- data/docs/CredentialOption.md +9 -0
- data/docs/CredentialRequest.md +9 -0
- data/docs/CredentialResponse.md +12 -0
- data/docs/CredentialsResponseBody.md +8 -0
- data/docs/IdentityApi.md +82 -0
- data/docs/Institution.md +14 -0
- data/docs/InstitutionResponseBody.md +8 -0
- data/docs/InstitutionsApi.md +120 -0
- data/docs/InstitutionsResponseBody.md +9 -0
- data/docs/Member.md +18 -0
- data/docs/MemberConnectionStatus.md +16 -0
- data/docs/MemberConnectionStatusResponseBody.md +8 -0
- data/docs/MemberCreateRequest.md +11 -0
- data/docs/MemberCreateRequestBody.md +8 -0
- data/docs/MemberResponseBody.md +8 -0
- data/docs/MemberResumeRequest.md +8 -0
- data/docs/MemberResumeRequestBody.md +8 -0
- data/docs/MemberUpdateRequest.md +10 -0
- data/docs/MemberUpdateRequestBody.md +8 -0
- data/docs/MembersApi.md +487 -0
- data/docs/MembersResponseBody.md +9 -0
- data/docs/Pagination.md +11 -0
- data/docs/Transaction.md +38 -0
- data/docs/TransactionCleanseAndCategorizeRequest.md +11 -0
- data/docs/TransactionCleanseAndCategorizeResponse.md +20 -0
- data/docs/TransactionResponseBody.md +8 -0
- data/docs/TransactionsApi.md +126 -0
- data/docs/TransactionsCleanseAndCategorizeRequestBody.md +8 -0
- data/docs/TransactionsCleanseAndCategorizeResponseBody.md +8 -0
- data/docs/TransactionsResponseBody.md +9 -0
- data/docs/User.md +11 -0
- data/docs/UserCreateRequestBody.md +8 -0
- data/docs/UserResponseBody.md +8 -0
- data/docs/UserUpdateRequestBody.md +8 -0
- data/docs/UsersApi.md +193 -0
- data/docs/UsersResponseBody.md +9 -0
- data/docs/VerificationApi.md +120 -0
- data/git_push.sh +49 -0
- data/lib/atrium-ruby.rb +88 -0
- data/lib/atrium-ruby/api/accounts_api.rb +272 -0
- data/lib/atrium-ruby/api/atrium_client.rb +28 -0
- data/lib/atrium-ruby/api/connect_widget_api.rb +82 -0
- data/lib/atrium-ruby/api/identity_api.rb +140 -0
- data/lib/atrium-ruby/api/institutions_api.rb +181 -0
- data/lib/atrium-ruby/api/members_api.rb +749 -0
- data/lib/atrium-ruby/api/transactions_api.rb +198 -0
- data/lib/atrium-ruby/api/users_api.rb +287 -0
- data/lib/atrium-ruby/api/verification_api.rb +198 -0
- data/lib/atrium-ruby/api_client.rb +384 -0
- data/lib/atrium-ruby/api_error.rb +34 -0
- data/lib/atrium-ruby/configuration.rb +212 -0
- data/lib/atrium-ruby/models/account.rb +422 -0
- data/lib/atrium-ruby/models/account_number.rb +215 -0
- data/lib/atrium-ruby/models/account_numbers_response_body.rb +181 -0
- data/lib/atrium-ruby/models/account_owner.rb +269 -0
- data/lib/atrium-ruby/models/account_owners_response_body.rb +181 -0
- data/lib/atrium-ruby/models/account_response_body.rb +179 -0
- data/lib/atrium-ruby/models/accounts_response_body.rb +190 -0
- data/lib/atrium-ruby/models/challenge.rb +226 -0
- data/lib/atrium-ruby/models/challenge_option.rb +197 -0
- data/lib/atrium-ruby/models/challenges_response_body.rb +181 -0
- data/lib/atrium-ruby/models/connect_widget.rb +188 -0
- data/lib/atrium-ruby/models/connect_widget_request_body.rb +206 -0
- data/lib/atrium-ruby/models/connect_widget_response_body.rb +179 -0
- data/lib/atrium-ruby/models/credential_option.rb +188 -0
- data/lib/atrium-ruby/models/credential_request.rb +188 -0
- data/lib/atrium-ruby/models/credential_response.rb +217 -0
- data/lib/atrium-ruby/models/credentials_response_body.rb +181 -0
- data/lib/atrium-ruby/models/institution.rb +233 -0
- data/lib/atrium-ruby/models/institution_response_body.rb +179 -0
- data/lib/atrium-ruby/models/institutions_response_body.rb +190 -0
- data/lib/atrium-ruby/models/member.rb +269 -0
- data/lib/atrium-ruby/models/member_connection_status.rb +253 -0
- data/lib/atrium-ruby/models/member_connection_status_response_body.rb +179 -0
- data/lib/atrium-ruby/models/member_create_request.rb +218 -0
- data/lib/atrium-ruby/models/member_create_request_body.rb +179 -0
- data/lib/atrium-ruby/models/member_response_body.rb +179 -0
- data/lib/atrium-ruby/models/member_resume_request.rb +181 -0
- data/lib/atrium-ruby/models/member_resume_request_body.rb +179 -0
- data/lib/atrium-ruby/models/member_update_request.rb +199 -0
- data/lib/atrium-ruby/models/member_update_request_body.rb +179 -0
- data/lib/atrium-ruby/models/members_response_body.rb +190 -0
- data/lib/atrium-ruby/models/pagination.rb +206 -0
- data/lib/atrium-ruby/models/transaction.rb +449 -0
- data/lib/atrium-ruby/models/transaction_cleanse_and_categorize_request.rb +206 -0
- data/lib/atrium-ruby/models/transaction_cleanse_and_categorize_response.rb +287 -0
- data/lib/atrium-ruby/models/transaction_response_body.rb +179 -0
- data/lib/atrium-ruby/models/transactions_cleanse_and_categorize_request_body.rb +181 -0
- data/lib/atrium-ruby/models/transactions_cleanse_and_categorize_response_body.rb +181 -0
- data/lib/atrium-ruby/models/transactions_response_body.rb +190 -0
- data/lib/atrium-ruby/models/user.rb +206 -0
- data/lib/atrium-ruby/models/user_create_request_body.rb +179 -0
- data/lib/atrium-ruby/models/user_response_body.rb +179 -0
- data/lib/atrium-ruby/models/user_update_request_body.rb +179 -0
- data/lib/atrium-ruby/models/users_response_body.rb +190 -0
- data/lib/atrium-ruby/version.rb +11 -0
- data/spec/api/accounts_api_spec.rb +88 -0
- data/spec/api/connect_widget_api_spec.rb +43 -0
- data/spec/api/identity_api_spec.rb +56 -0
- data/spec/api/institutions_api_spec.rb +68 -0
- data/spec/api/members_api_spec.rb +195 -0
- data/spec/api/transactions_api_spec.rb +71 -0
- data/spec/api/users_api_spec.rb +92 -0
- data/spec/api/verification_api_spec.rb +69 -0
- data/spec/api_client_spec.rb +222 -0
- data/spec/configuration_spec.rb +38 -0
- data/spec/models/account_number_spec.rb +60 -0
- data/spec/models/account_numbers_response_body_spec.rb +36 -0
- data/spec/models/account_owner_spec.rb +96 -0
- data/spec/models/account_owners_response_body_spec.rb +36 -0
- data/spec/models/account_response_body_spec.rb +36 -0
- data/spec/models/account_spec.rb +198 -0
- data/spec/models/accounts_response_body_spec.rb +42 -0
- data/spec/models/challenge_option_spec.rb +48 -0
- data/spec/models/challenge_spec.rb +66 -0
- data/spec/models/challenges_response_body_spec.rb +36 -0
- data/spec/models/connect_widget_request_body_spec.rb +54 -0
- data/spec/models/connect_widget_response_body_spec.rb +36 -0
- data/spec/models/connect_widget_spec.rb +42 -0
- data/spec/models/credential_option_spec.rb +42 -0
- data/spec/models/credential_request_spec.rb +42 -0
- data/spec/models/credential_response_spec.rb +60 -0
- data/spec/models/credentials_response_body_spec.rb +36 -0
- data/spec/models/institution_response_body_spec.rb +36 -0
- data/spec/models/institution_spec.rb +72 -0
- data/spec/models/institutions_response_body_spec.rb +42 -0
- data/spec/models/member_connection_status_response_body_spec.rb +36 -0
- data/spec/models/member_connection_status_spec.rb +84 -0
- data/spec/models/member_create_request_body_spec.rb +36 -0
- data/spec/models/member_create_request_spec.rb +54 -0
- data/spec/models/member_response_body_spec.rb +36 -0
- data/spec/models/member_resume_request_body_spec.rb +36 -0
- data/spec/models/member_resume_request_spec.rb +36 -0
- data/spec/models/member_spec.rb +96 -0
- data/spec/models/member_update_request_body_spec.rb +36 -0
- data/spec/models/member_update_request_spec.rb +48 -0
- data/spec/models/members_response_body_spec.rb +42 -0
- data/spec/models/pagination_spec.rb +54 -0
- data/spec/models/transaction_cleanse_and_categorize_request_spec.rb +54 -0
- data/spec/models/transaction_cleanse_and_categorize_response_spec.rb +108 -0
- data/spec/models/transaction_response_body_spec.rb +36 -0
- data/spec/models/transaction_spec.rb +216 -0
- data/spec/models/transactions_cleanse_and_categorize_request_body_spec.rb +36 -0
- data/spec/models/transactions_cleanse_and_categorize_response_body_spec.rb +36 -0
- data/spec/models/transactions_response_body_spec.rb +42 -0
- data/spec/models/user_create_request_body_spec.rb +36 -0
- data/spec/models/user_response_body_spec.rb +36 -0
- data/spec/models/user_spec.rb +54 -0
- data/spec/models/user_update_request_body_spec.rb +36 -0
- data/spec/models/users_response_body_spec.rb +42 -0
- data/spec/spec_helper.rb +107 -0
- metadata +323 -91
- data/.gitignore +0 -10
- data/.rubocop.yml +0 -12
- data/.travis.yml +0 -12
- data/bin/console +0 -14
- data/bin/demo +0 -49
- data/bin/setup +0 -8
- data/examples/accounts_and_transactions.rb +0 -49
- data/examples/all_endpoints.rb +0 -226
- data/examples/example_workflow.rb +0 -176
- data/examples/multi_factor_authentication.rb +0 -57
- data/examples/update_credentials.rb +0 -58
- data/examples/user_and_member_creation.rb +0 -53
- data/lib/atrium.rb +0 -40
- data/lib/atrium/account.rb +0 -100
- data/lib/atrium/account_number.rb +0 -13
- data/lib/atrium/account_owner.rb +0 -19
- data/lib/atrium/challenge.rb +0 -13
- data/lib/atrium/client.rb +0 -51
- data/lib/atrium/connect.rb +0 -34
- data/lib/atrium/credential.rb +0 -11
- data/lib/atrium/error.rb +0 -4
- data/lib/atrium/institution.rb +0 -38
- data/lib/atrium/member.rb +0 -264
- data/lib/atrium/pageable.rb +0 -74
- data/lib/atrium/paginate.rb +0 -92
- data/lib/atrium/ruby.rb +0 -3
- data/lib/atrium/transaction.rb +0 -74
- data/lib/atrium/user.rb +0 -150
- data/lib/atrium/version.rb +0 -3
@@ -0,0 +1,190 @@
|
|
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 MembersResponseBody
|
13
|
+
attr_accessor :members
|
14
|
+
|
15
|
+
attr_accessor :pagination
|
16
|
+
|
17
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
18
|
+
def self.attribute_map
|
19
|
+
{
|
20
|
+
:'members' => :'members',
|
21
|
+
:'pagination' => :'pagination'
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
# Attribute type mapping.
|
26
|
+
def self.mx_types
|
27
|
+
{
|
28
|
+
:'members' => :'Array<Member>',
|
29
|
+
:'pagination' => :'Pagination'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Initializes the object
|
34
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
35
|
+
def initialize(attributes = {})
|
36
|
+
return unless attributes.is_a?(Hash)
|
37
|
+
|
38
|
+
# convert string to symbol for hash key
|
39
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
40
|
+
|
41
|
+
if attributes.has_key?(:'members')
|
42
|
+
if (value = attributes[:'members']).is_a?(Array)
|
43
|
+
self.members = value
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
if attributes.has_key?(:'pagination')
|
48
|
+
self.pagination = attributes[:'pagination']
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
53
|
+
# @return Array for valid properties with the reasons
|
54
|
+
def list_invalid_properties
|
55
|
+
invalid_properties = Array.new
|
56
|
+
invalid_properties
|
57
|
+
end
|
58
|
+
|
59
|
+
# Check to see if the all the properties in the model are valid
|
60
|
+
# @return true if the model is valid
|
61
|
+
def valid?
|
62
|
+
true
|
63
|
+
end
|
64
|
+
|
65
|
+
# Checks equality by comparing each attribute.
|
66
|
+
# @param [Object] Object to be compared
|
67
|
+
def ==(o)
|
68
|
+
return true if self.equal?(o)
|
69
|
+
self.class == o.class &&
|
70
|
+
members == o.members &&
|
71
|
+
pagination == o.pagination
|
72
|
+
end
|
73
|
+
|
74
|
+
# @see the `==` method
|
75
|
+
# @param [Object] Object to be compared
|
76
|
+
def eql?(o)
|
77
|
+
self == o
|
78
|
+
end
|
79
|
+
|
80
|
+
# Calculates hash code according to all attributes.
|
81
|
+
# @return [Fixnum] Hash code
|
82
|
+
def hash
|
83
|
+
[members, pagination].hash
|
84
|
+
end
|
85
|
+
|
86
|
+
# Builds the object from hash
|
87
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
88
|
+
# @return [Object] Returns the model itself
|
89
|
+
def build_from_hash(attributes)
|
90
|
+
return nil unless attributes.is_a?(Hash)
|
91
|
+
self.class.mx_types.each_pair do |key, type|
|
92
|
+
if type =~ /\AArray<(.*)>/i
|
93
|
+
# check to ensure the input is an array given that the the attribute
|
94
|
+
# is documented as an array but the input is not
|
95
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
96
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
97
|
+
end
|
98
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
99
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
100
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
101
|
+
end
|
102
|
+
|
103
|
+
self
|
104
|
+
end
|
105
|
+
|
106
|
+
# Deserializes the data based on type
|
107
|
+
# @param string type Data type
|
108
|
+
# @param string value Value to be deserialized
|
109
|
+
# @return [Object] Deserialized data
|
110
|
+
def _deserialize(type, value)
|
111
|
+
case type.to_sym
|
112
|
+
when :DateTime
|
113
|
+
DateTime.parse(value)
|
114
|
+
when :Date
|
115
|
+
Date.parse(value)
|
116
|
+
when :String
|
117
|
+
value.to_s
|
118
|
+
when :Integer
|
119
|
+
value.to_i
|
120
|
+
when :Float
|
121
|
+
value.to_f
|
122
|
+
when :BOOLEAN
|
123
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
124
|
+
true
|
125
|
+
else
|
126
|
+
false
|
127
|
+
end
|
128
|
+
when :Object
|
129
|
+
# generic object (usually a Hash), return directly
|
130
|
+
value
|
131
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
132
|
+
inner_type = Regexp.last_match[:inner_type]
|
133
|
+
value.map { |v| _deserialize(inner_type, v) }
|
134
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
135
|
+
k_type = Regexp.last_match[:k_type]
|
136
|
+
v_type = Regexp.last_match[:v_type]
|
137
|
+
{}.tap do |hash|
|
138
|
+
value.each do |k, v|
|
139
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
else # model
|
143
|
+
temp_model = Atrium.const_get(type).new
|
144
|
+
temp_model.build_from_hash(value)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
# Returns the string representation of the object
|
149
|
+
# @return [String] String presentation of the object
|
150
|
+
def to_s
|
151
|
+
to_hash.to_s
|
152
|
+
end
|
153
|
+
|
154
|
+
# to_body is an alias to to_hash (backward compatibility)
|
155
|
+
# @return [Hash] Returns the object in the form of hash
|
156
|
+
def to_body
|
157
|
+
to_hash
|
158
|
+
end
|
159
|
+
|
160
|
+
# Returns the object in the form of hash
|
161
|
+
# @return [Hash] Returns the object in the form of hash
|
162
|
+
def to_hash
|
163
|
+
hash = {}
|
164
|
+
self.class.attribute_map.each_pair do |attr, param|
|
165
|
+
value = self.send(attr)
|
166
|
+
next if value.nil?
|
167
|
+
hash[param] = _to_hash(value)
|
168
|
+
end
|
169
|
+
hash
|
170
|
+
end
|
171
|
+
|
172
|
+
# Outputs non-array value in the form of hash
|
173
|
+
# For object, use to_hash. Otherwise, just return the value
|
174
|
+
# @param [Object] value Any valid value
|
175
|
+
# @return [Hash] Returns the value in the form of hash
|
176
|
+
def _to_hash(value)
|
177
|
+
if value.is_a?(Array)
|
178
|
+
value.compact.map { |v| _to_hash(v) }
|
179
|
+
elsif value.is_a?(Hash)
|
180
|
+
{}.tap do |hash|
|
181
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
182
|
+
end
|
183
|
+
elsif value.respond_to? :to_hash
|
184
|
+
value.to_hash
|
185
|
+
else
|
186
|
+
value
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
@@ -0,0 +1,206 @@
|
|
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 Pagination
|
13
|
+
attr_accessor :current_page
|
14
|
+
|
15
|
+
attr_accessor :per_page
|
16
|
+
|
17
|
+
attr_accessor :total_entries
|
18
|
+
|
19
|
+
attr_accessor :total_pages
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:'current_page' => :'current_page',
|
25
|
+
:'per_page' => :'per_page',
|
26
|
+
:'total_entries' => :'total_entries',
|
27
|
+
:'total_pages' => :'total_pages'
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
# Attribute type mapping.
|
32
|
+
def self.mx_types
|
33
|
+
{
|
34
|
+
:'current_page' => :'Integer',
|
35
|
+
:'per_page' => :'Integer',
|
36
|
+
:'total_entries' => :'Integer',
|
37
|
+
:'total_pages' => :'Integer'
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
# Initializes the object
|
42
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
43
|
+
def initialize(attributes = {})
|
44
|
+
return unless attributes.is_a?(Hash)
|
45
|
+
|
46
|
+
# convert string to symbol for hash key
|
47
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
48
|
+
|
49
|
+
if attributes.has_key?(:'current_page')
|
50
|
+
self.current_page = attributes[:'current_page']
|
51
|
+
end
|
52
|
+
|
53
|
+
if attributes.has_key?(:'per_page')
|
54
|
+
self.per_page = attributes[:'per_page']
|
55
|
+
end
|
56
|
+
|
57
|
+
if attributes.has_key?(:'total_entries')
|
58
|
+
self.total_entries = attributes[:'total_entries']
|
59
|
+
end
|
60
|
+
|
61
|
+
if attributes.has_key?(:'total_pages')
|
62
|
+
self.total_pages = attributes[:'total_pages']
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
67
|
+
# @return Array for valid properties with the reasons
|
68
|
+
def list_invalid_properties
|
69
|
+
invalid_properties = Array.new
|
70
|
+
invalid_properties
|
71
|
+
end
|
72
|
+
|
73
|
+
# Check to see if the all the properties in the model are valid
|
74
|
+
# @return true if the model is valid
|
75
|
+
def valid?
|
76
|
+
true
|
77
|
+
end
|
78
|
+
|
79
|
+
# Checks equality by comparing each attribute.
|
80
|
+
# @param [Object] Object to be compared
|
81
|
+
def ==(o)
|
82
|
+
return true if self.equal?(o)
|
83
|
+
self.class == o.class &&
|
84
|
+
current_page == o.current_page &&
|
85
|
+
per_page == o.per_page &&
|
86
|
+
total_entries == o.total_entries &&
|
87
|
+
total_pages == o.total_pages
|
88
|
+
end
|
89
|
+
|
90
|
+
# @see the `==` method
|
91
|
+
# @param [Object] Object to be compared
|
92
|
+
def eql?(o)
|
93
|
+
self == o
|
94
|
+
end
|
95
|
+
|
96
|
+
# Calculates hash code according to all attributes.
|
97
|
+
# @return [Fixnum] Hash code
|
98
|
+
def hash
|
99
|
+
[current_page, per_page, total_entries, total_pages].hash
|
100
|
+
end
|
101
|
+
|
102
|
+
# Builds the object from hash
|
103
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
104
|
+
# @return [Object] Returns the model itself
|
105
|
+
def build_from_hash(attributes)
|
106
|
+
return nil unless attributes.is_a?(Hash)
|
107
|
+
self.class.mx_types.each_pair do |key, type|
|
108
|
+
if type =~ /\AArray<(.*)>/i
|
109
|
+
# check to ensure the input is an array given that the the attribute
|
110
|
+
# is documented as an array but the input is not
|
111
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
112
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
113
|
+
end
|
114
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
115
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
116
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
117
|
+
end
|
118
|
+
|
119
|
+
self
|
120
|
+
end
|
121
|
+
|
122
|
+
# Deserializes the data based on type
|
123
|
+
# @param string type Data type
|
124
|
+
# @param string value Value to be deserialized
|
125
|
+
# @return [Object] Deserialized data
|
126
|
+
def _deserialize(type, value)
|
127
|
+
case type.to_sym
|
128
|
+
when :DateTime
|
129
|
+
DateTime.parse(value)
|
130
|
+
when :Date
|
131
|
+
Date.parse(value)
|
132
|
+
when :String
|
133
|
+
value.to_s
|
134
|
+
when :Integer
|
135
|
+
value.to_i
|
136
|
+
when :Float
|
137
|
+
value.to_f
|
138
|
+
when :BOOLEAN
|
139
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
140
|
+
true
|
141
|
+
else
|
142
|
+
false
|
143
|
+
end
|
144
|
+
when :Object
|
145
|
+
# generic object (usually a Hash), return directly
|
146
|
+
value
|
147
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
148
|
+
inner_type = Regexp.last_match[:inner_type]
|
149
|
+
value.map { |v| _deserialize(inner_type, v) }
|
150
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
151
|
+
k_type = Regexp.last_match[:k_type]
|
152
|
+
v_type = Regexp.last_match[:v_type]
|
153
|
+
{}.tap do |hash|
|
154
|
+
value.each do |k, v|
|
155
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
else # model
|
159
|
+
temp_model = Atrium.const_get(type).new
|
160
|
+
temp_model.build_from_hash(value)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
# Returns the string representation of the object
|
165
|
+
# @return [String] String presentation of the object
|
166
|
+
def to_s
|
167
|
+
to_hash.to_s
|
168
|
+
end
|
169
|
+
|
170
|
+
# to_body is an alias to to_hash (backward compatibility)
|
171
|
+
# @return [Hash] Returns the object in the form of hash
|
172
|
+
def to_body
|
173
|
+
to_hash
|
174
|
+
end
|
175
|
+
|
176
|
+
# Returns the object in the form of hash
|
177
|
+
# @return [Hash] Returns the object in the form of hash
|
178
|
+
def to_hash
|
179
|
+
hash = {}
|
180
|
+
self.class.attribute_map.each_pair do |attr, param|
|
181
|
+
value = self.send(attr)
|
182
|
+
next if value.nil?
|
183
|
+
hash[param] = _to_hash(value)
|
184
|
+
end
|
185
|
+
hash
|
186
|
+
end
|
187
|
+
|
188
|
+
# Outputs non-array value in the form of hash
|
189
|
+
# For object, use to_hash. Otherwise, just return the value
|
190
|
+
# @param [Object] value Any valid value
|
191
|
+
# @return [Hash] Returns the value in the form of hash
|
192
|
+
def _to_hash(value)
|
193
|
+
if value.is_a?(Array)
|
194
|
+
value.compact.map { |v| _to_hash(v) }
|
195
|
+
elsif value.is_a?(Hash)
|
196
|
+
{}.tap do |hash|
|
197
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
198
|
+
end
|
199
|
+
elsif value.respond_to? :to_hash
|
200
|
+
value.to_hash
|
201
|
+
else
|
202
|
+
value
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
@@ -0,0 +1,449 @@
|
|
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 Transaction
|
13
|
+
attr_accessor :account_guid
|
14
|
+
|
15
|
+
attr_accessor :amount
|
16
|
+
|
17
|
+
attr_accessor :category
|
18
|
+
|
19
|
+
attr_accessor :check_number
|
20
|
+
|
21
|
+
attr_accessor :check_number_string
|
22
|
+
|
23
|
+
attr_accessor :created_at
|
24
|
+
|
25
|
+
attr_accessor :currency_code
|
26
|
+
|
27
|
+
attr_accessor :date
|
28
|
+
|
29
|
+
attr_accessor :description
|
30
|
+
|
31
|
+
attr_accessor :guid
|
32
|
+
|
33
|
+
attr_accessor :is_bill_pay
|
34
|
+
|
35
|
+
attr_accessor :is_direct_deposit
|
36
|
+
|
37
|
+
attr_accessor :is_expense
|
38
|
+
|
39
|
+
attr_accessor :is_fee
|
40
|
+
|
41
|
+
attr_accessor :is_income
|
42
|
+
|
43
|
+
attr_accessor :is_international
|
44
|
+
|
45
|
+
attr_accessor :is_overdraft_fee
|
46
|
+
|
47
|
+
attr_accessor :is_payroll_advance
|
48
|
+
|
49
|
+
attr_accessor :latitude
|
50
|
+
|
51
|
+
attr_accessor :longitude
|
52
|
+
|
53
|
+
attr_accessor :member_guid
|
54
|
+
|
55
|
+
attr_accessor :memo
|
56
|
+
|
57
|
+
attr_accessor :merchant_category_code
|
58
|
+
|
59
|
+
attr_accessor :original_description
|
60
|
+
|
61
|
+
attr_accessor :posted_at
|
62
|
+
|
63
|
+
attr_accessor :status
|
64
|
+
|
65
|
+
attr_accessor :top_level_category
|
66
|
+
|
67
|
+
attr_accessor :transacted_at
|
68
|
+
|
69
|
+
attr_accessor :type
|
70
|
+
|
71
|
+
attr_accessor :updated_at
|
72
|
+
|
73
|
+
attr_accessor :user_guid
|
74
|
+
|
75
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
76
|
+
def self.attribute_map
|
77
|
+
{
|
78
|
+
:'account_guid' => :'account_guid',
|
79
|
+
:'amount' => :'amount',
|
80
|
+
:'category' => :'category',
|
81
|
+
:'check_number' => :'check_number',
|
82
|
+
:'check_number_string' => :'check_number_string',
|
83
|
+
:'created_at' => :'created_at',
|
84
|
+
:'currency_code' => :'currency_code',
|
85
|
+
:'date' => :'date',
|
86
|
+
:'description' => :'description',
|
87
|
+
:'guid' => :'guid',
|
88
|
+
:'is_bill_pay' => :'is_bill_pay',
|
89
|
+
:'is_direct_deposit' => :'is_direct_deposit',
|
90
|
+
:'is_expense' => :'is_expense',
|
91
|
+
:'is_fee' => :'is_fee',
|
92
|
+
:'is_income' => :'is_income',
|
93
|
+
:'is_international' => :'is_international',
|
94
|
+
:'is_overdraft_fee' => :'is_overdraft_fee',
|
95
|
+
:'is_payroll_advance' => :'is_payroll_advance',
|
96
|
+
:'latitude' => :'latitude',
|
97
|
+
:'longitude' => :'longitude',
|
98
|
+
:'member_guid' => :'member_guid',
|
99
|
+
:'memo' => :'memo',
|
100
|
+
:'merchant_category_code' => :'merchant_category_code',
|
101
|
+
:'original_description' => :'original_description',
|
102
|
+
:'posted_at' => :'posted_at',
|
103
|
+
:'status' => :'status',
|
104
|
+
:'top_level_category' => :'top_level_category',
|
105
|
+
:'transacted_at' => :'transacted_at',
|
106
|
+
:'type' => :'type',
|
107
|
+
:'updated_at' => :'updated_at',
|
108
|
+
:'user_guid' => :'user_guid'
|
109
|
+
}
|
110
|
+
end
|
111
|
+
|
112
|
+
# Attribute type mapping.
|
113
|
+
def self.mx_types
|
114
|
+
{
|
115
|
+
:'account_guid' => :'String',
|
116
|
+
:'amount' => :'Float',
|
117
|
+
:'category' => :'String',
|
118
|
+
:'check_number' => :'Integer',
|
119
|
+
:'check_number_string' => :'String',
|
120
|
+
:'created_at' => :'String',
|
121
|
+
:'currency_code' => :'String',
|
122
|
+
:'date' => :'String',
|
123
|
+
:'description' => :'String',
|
124
|
+
:'guid' => :'String',
|
125
|
+
:'is_bill_pay' => :'BOOLEAN',
|
126
|
+
:'is_direct_deposit' => :'BOOLEAN',
|
127
|
+
:'is_expense' => :'BOOLEAN',
|
128
|
+
:'is_fee' => :'BOOLEAN',
|
129
|
+
:'is_income' => :'BOOLEAN',
|
130
|
+
:'is_international' => :'BOOLEAN',
|
131
|
+
:'is_overdraft_fee' => :'BOOLEAN',
|
132
|
+
:'is_payroll_advance' => :'BOOLEAN',
|
133
|
+
:'latitude' => :'Float',
|
134
|
+
:'longitude' => :'Float',
|
135
|
+
:'member_guid' => :'String',
|
136
|
+
:'memo' => :'String',
|
137
|
+
:'merchant_category_code' => :'Integer',
|
138
|
+
:'original_description' => :'String',
|
139
|
+
:'posted_at' => :'String',
|
140
|
+
:'status' => :'String',
|
141
|
+
:'top_level_category' => :'String',
|
142
|
+
:'transacted_at' => :'String',
|
143
|
+
:'type' => :'String',
|
144
|
+
:'updated_at' => :'String',
|
145
|
+
:'user_guid' => :'String'
|
146
|
+
}
|
147
|
+
end
|
148
|
+
|
149
|
+
# Initializes the object
|
150
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
151
|
+
def initialize(attributes = {})
|
152
|
+
return unless attributes.is_a?(Hash)
|
153
|
+
|
154
|
+
# convert string to symbol for hash key
|
155
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
156
|
+
|
157
|
+
if attributes.has_key?(:'account_guid')
|
158
|
+
self.account_guid = attributes[:'account_guid']
|
159
|
+
end
|
160
|
+
|
161
|
+
if attributes.has_key?(:'amount')
|
162
|
+
self.amount = attributes[:'amount']
|
163
|
+
end
|
164
|
+
|
165
|
+
if attributes.has_key?(:'category')
|
166
|
+
self.category = attributes[:'category']
|
167
|
+
end
|
168
|
+
|
169
|
+
if attributes.has_key?(:'check_number')
|
170
|
+
self.check_number = attributes[:'check_number']
|
171
|
+
end
|
172
|
+
|
173
|
+
if attributes.has_key?(:'check_number_string')
|
174
|
+
self.check_number_string = attributes[:'check_number_string']
|
175
|
+
end
|
176
|
+
|
177
|
+
if attributes.has_key?(:'created_at')
|
178
|
+
self.created_at = attributes[:'created_at']
|
179
|
+
end
|
180
|
+
|
181
|
+
if attributes.has_key?(:'currency_code')
|
182
|
+
self.currency_code = attributes[:'currency_code']
|
183
|
+
end
|
184
|
+
|
185
|
+
if attributes.has_key?(:'date')
|
186
|
+
self.date = attributes[:'date']
|
187
|
+
end
|
188
|
+
|
189
|
+
if attributes.has_key?(:'description')
|
190
|
+
self.description = attributes[:'description']
|
191
|
+
end
|
192
|
+
|
193
|
+
if attributes.has_key?(:'guid')
|
194
|
+
self.guid = attributes[:'guid']
|
195
|
+
end
|
196
|
+
|
197
|
+
if attributes.has_key?(:'is_bill_pay')
|
198
|
+
self.is_bill_pay = attributes[:'is_bill_pay']
|
199
|
+
end
|
200
|
+
|
201
|
+
if attributes.has_key?(:'is_direct_deposit')
|
202
|
+
self.is_direct_deposit = attributes[:'is_direct_deposit']
|
203
|
+
end
|
204
|
+
|
205
|
+
if attributes.has_key?(:'is_expense')
|
206
|
+
self.is_expense = attributes[:'is_expense']
|
207
|
+
end
|
208
|
+
|
209
|
+
if attributes.has_key?(:'is_fee')
|
210
|
+
self.is_fee = attributes[:'is_fee']
|
211
|
+
end
|
212
|
+
|
213
|
+
if attributes.has_key?(:'is_income')
|
214
|
+
self.is_income = attributes[:'is_income']
|
215
|
+
end
|
216
|
+
|
217
|
+
if attributes.has_key?(:'is_international')
|
218
|
+
self.is_international = attributes[:'is_international']
|
219
|
+
end
|
220
|
+
|
221
|
+
if attributes.has_key?(:'is_overdraft_fee')
|
222
|
+
self.is_overdraft_fee = attributes[:'is_overdraft_fee']
|
223
|
+
end
|
224
|
+
|
225
|
+
if attributes.has_key?(:'is_payroll_advance')
|
226
|
+
self.is_payroll_advance = attributes[:'is_payroll_advance']
|
227
|
+
end
|
228
|
+
|
229
|
+
if attributes.has_key?(:'latitude')
|
230
|
+
self.latitude = attributes[:'latitude']
|
231
|
+
end
|
232
|
+
|
233
|
+
if attributes.has_key?(:'longitude')
|
234
|
+
self.longitude = attributes[:'longitude']
|
235
|
+
end
|
236
|
+
|
237
|
+
if attributes.has_key?(:'member_guid')
|
238
|
+
self.member_guid = attributes[:'member_guid']
|
239
|
+
end
|
240
|
+
|
241
|
+
if attributes.has_key?(:'memo')
|
242
|
+
self.memo = attributes[:'memo']
|
243
|
+
end
|
244
|
+
|
245
|
+
if attributes.has_key?(:'merchant_category_code')
|
246
|
+
self.merchant_category_code = attributes[:'merchant_category_code']
|
247
|
+
end
|
248
|
+
|
249
|
+
if attributes.has_key?(:'original_description')
|
250
|
+
self.original_description = attributes[:'original_description']
|
251
|
+
end
|
252
|
+
|
253
|
+
if attributes.has_key?(:'posted_at')
|
254
|
+
self.posted_at = attributes[:'posted_at']
|
255
|
+
end
|
256
|
+
|
257
|
+
if attributes.has_key?(:'status')
|
258
|
+
self.status = attributes[:'status']
|
259
|
+
end
|
260
|
+
|
261
|
+
if attributes.has_key?(:'top_level_category')
|
262
|
+
self.top_level_category = attributes[:'top_level_category']
|
263
|
+
end
|
264
|
+
|
265
|
+
if attributes.has_key?(:'transacted_at')
|
266
|
+
self.transacted_at = attributes[:'transacted_at']
|
267
|
+
end
|
268
|
+
|
269
|
+
if attributes.has_key?(:'type')
|
270
|
+
self.type = attributes[:'type']
|
271
|
+
end
|
272
|
+
|
273
|
+
if attributes.has_key?(:'updated_at')
|
274
|
+
self.updated_at = attributes[:'updated_at']
|
275
|
+
end
|
276
|
+
|
277
|
+
if attributes.has_key?(:'user_guid')
|
278
|
+
self.user_guid = attributes[:'user_guid']
|
279
|
+
end
|
280
|
+
end
|
281
|
+
|
282
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
283
|
+
# @return Array for valid properties with the reasons
|
284
|
+
def list_invalid_properties
|
285
|
+
invalid_properties = Array.new
|
286
|
+
invalid_properties
|
287
|
+
end
|
288
|
+
|
289
|
+
# Check to see if the all the properties in the model are valid
|
290
|
+
# @return true if the model is valid
|
291
|
+
def valid?
|
292
|
+
true
|
293
|
+
end
|
294
|
+
|
295
|
+
# Checks equality by comparing each attribute.
|
296
|
+
# @param [Object] Object to be compared
|
297
|
+
def ==(o)
|
298
|
+
return true if self.equal?(o)
|
299
|
+
self.class == o.class &&
|
300
|
+
account_guid == o.account_guid &&
|
301
|
+
amount == o.amount &&
|
302
|
+
category == o.category &&
|
303
|
+
check_number == o.check_number &&
|
304
|
+
check_number_string == o.check_number_string &&
|
305
|
+
created_at == o.created_at &&
|
306
|
+
currency_code == o.currency_code &&
|
307
|
+
date == o.date &&
|
308
|
+
description == o.description &&
|
309
|
+
guid == o.guid &&
|
310
|
+
is_bill_pay == o.is_bill_pay &&
|
311
|
+
is_direct_deposit == o.is_direct_deposit &&
|
312
|
+
is_expense == o.is_expense &&
|
313
|
+
is_fee == o.is_fee &&
|
314
|
+
is_income == o.is_income &&
|
315
|
+
is_international == o.is_international &&
|
316
|
+
is_overdraft_fee == o.is_overdraft_fee &&
|
317
|
+
is_payroll_advance == o.is_payroll_advance &&
|
318
|
+
latitude == o.latitude &&
|
319
|
+
longitude == o.longitude &&
|
320
|
+
member_guid == o.member_guid &&
|
321
|
+
memo == o.memo &&
|
322
|
+
merchant_category_code == o.merchant_category_code &&
|
323
|
+
original_description == o.original_description &&
|
324
|
+
posted_at == o.posted_at &&
|
325
|
+
status == o.status &&
|
326
|
+
top_level_category == o.top_level_category &&
|
327
|
+
transacted_at == o.transacted_at &&
|
328
|
+
type == o.type &&
|
329
|
+
updated_at == o.updated_at &&
|
330
|
+
user_guid == o.user_guid
|
331
|
+
end
|
332
|
+
|
333
|
+
# @see the `==` method
|
334
|
+
# @param [Object] Object to be compared
|
335
|
+
def eql?(o)
|
336
|
+
self == o
|
337
|
+
end
|
338
|
+
|
339
|
+
# Calculates hash code according to all attributes.
|
340
|
+
# @return [Fixnum] Hash code
|
341
|
+
def hash
|
342
|
+
[account_guid, amount, category, check_number, check_number_string, created_at, currency_code, date, description, guid, is_bill_pay, is_direct_deposit, is_expense, is_fee, is_income, is_international, is_overdraft_fee, is_payroll_advance, latitude, longitude, member_guid, memo, merchant_category_code, original_description, posted_at, status, top_level_category, transacted_at, type, updated_at, user_guid].hash
|
343
|
+
end
|
344
|
+
|
345
|
+
# Builds the object from hash
|
346
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
347
|
+
# @return [Object] Returns the model itself
|
348
|
+
def build_from_hash(attributes)
|
349
|
+
return nil unless attributes.is_a?(Hash)
|
350
|
+
self.class.mx_types.each_pair do |key, type|
|
351
|
+
if type =~ /\AArray<(.*)>/i
|
352
|
+
# check to ensure the input is an array given that the the attribute
|
353
|
+
# is documented as an array but the input is not
|
354
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
355
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
356
|
+
end
|
357
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
358
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
359
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
360
|
+
end
|
361
|
+
|
362
|
+
self
|
363
|
+
end
|
364
|
+
|
365
|
+
# Deserializes the data based on type
|
366
|
+
# @param string type Data type
|
367
|
+
# @param string value Value to be deserialized
|
368
|
+
# @return [Object] Deserialized data
|
369
|
+
def _deserialize(type, value)
|
370
|
+
case type.to_sym
|
371
|
+
when :DateTime
|
372
|
+
DateTime.parse(value)
|
373
|
+
when :Date
|
374
|
+
Date.parse(value)
|
375
|
+
when :String
|
376
|
+
value.to_s
|
377
|
+
when :Integer
|
378
|
+
value.to_i
|
379
|
+
when :Float
|
380
|
+
value.to_f
|
381
|
+
when :BOOLEAN
|
382
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
383
|
+
true
|
384
|
+
else
|
385
|
+
false
|
386
|
+
end
|
387
|
+
when :Object
|
388
|
+
# generic object (usually a Hash), return directly
|
389
|
+
value
|
390
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
391
|
+
inner_type = Regexp.last_match[:inner_type]
|
392
|
+
value.map { |v| _deserialize(inner_type, v) }
|
393
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
394
|
+
k_type = Regexp.last_match[:k_type]
|
395
|
+
v_type = Regexp.last_match[:v_type]
|
396
|
+
{}.tap do |hash|
|
397
|
+
value.each do |k, v|
|
398
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
399
|
+
end
|
400
|
+
end
|
401
|
+
else # model
|
402
|
+
temp_model = Atrium.const_get(type).new
|
403
|
+
temp_model.build_from_hash(value)
|
404
|
+
end
|
405
|
+
end
|
406
|
+
|
407
|
+
# Returns the string representation of the object
|
408
|
+
# @return [String] String presentation of the object
|
409
|
+
def to_s
|
410
|
+
to_hash.to_s
|
411
|
+
end
|
412
|
+
|
413
|
+
# to_body is an alias to to_hash (backward compatibility)
|
414
|
+
# @return [Hash] Returns the object in the form of hash
|
415
|
+
def to_body
|
416
|
+
to_hash
|
417
|
+
end
|
418
|
+
|
419
|
+
# Returns the object in the form of hash
|
420
|
+
# @return [Hash] Returns the object in the form of hash
|
421
|
+
def to_hash
|
422
|
+
hash = {}
|
423
|
+
self.class.attribute_map.each_pair do |attr, param|
|
424
|
+
value = self.send(attr)
|
425
|
+
next if value.nil?
|
426
|
+
hash[param] = _to_hash(value)
|
427
|
+
end
|
428
|
+
hash
|
429
|
+
end
|
430
|
+
|
431
|
+
# Outputs non-array value in the form of hash
|
432
|
+
# For object, use to_hash. Otherwise, just return the value
|
433
|
+
# @param [Object] value Any valid value
|
434
|
+
# @return [Hash] Returns the value in the form of hash
|
435
|
+
def _to_hash(value)
|
436
|
+
if value.is_a?(Array)
|
437
|
+
value.compact.map { |v| _to_hash(v) }
|
438
|
+
elsif value.is_a?(Hash)
|
439
|
+
{}.tap do |hash|
|
440
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
441
|
+
end
|
442
|
+
elsif value.respond_to? :to_hash
|
443
|
+
value.to_hash
|
444
|
+
else
|
445
|
+
value
|
446
|
+
end
|
447
|
+
end
|
448
|
+
end
|
449
|
+
end
|