mx-platform-ruby 0.42.0 → 0.44.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/docs/MicrodepositRequest.md +30 -0
- data/docs/MicrodepositRequestBody.md +18 -0
- data/docs/MicrodepositResponse.md +44 -0
- data/docs/MicrodepositResponseBody.md +18 -0
- data/docs/MicrodepositVerifyRequest.md +20 -0
- data/docs/MicrodepositVerifyRequestBody.md +18 -0
- data/docs/MicrodepositsApi.md +371 -0
- data/docs/MicrodepositsResponseBody.md +20 -0
- data/docs/TransactionCreateRequest.md +40 -0
- data/docs/TransactionCreateRequestBody.md +18 -0
- data/docs/TransactionCreateResponseBody.md +104 -0
- data/docs/TransactionsApi.md +82 -0
- data/lib/mx-platform-ruby/api/microdeposits_api.rb +365 -0
- data/lib/mx-platform-ruby/api/transactions_api.rb +102 -0
- data/lib/mx-platform-ruby/models/microdeposit_request.rb +289 -0
- data/lib/mx-platform-ruby/models/microdeposit_request_body.rb +214 -0
- data/lib/mx-platform-ruby/models/microdeposit_response.rb +331 -0
- data/lib/mx-platform-ruby/models/microdeposit_response_body.rb +214 -0
- data/lib/mx-platform-ruby/models/microdeposit_verify_request.rb +223 -0
- data/lib/mx-platform-ruby/models/microdeposit_verify_request_body.rb +214 -0
- data/lib/mx-platform-ruby/models/microdeposits_response_body.rb +225 -0
- data/lib/mx-platform-ruby/models/transaction_create_request.rb +344 -0
- data/lib/mx-platform-ruby/models/transaction_create_request_body.rb +214 -0
- data/lib/mx-platform-ruby/models/transaction_create_response_body.rb +642 -0
- data/lib/mx-platform-ruby/version.rb +1 -1
- data/lib/mx-platform-ruby.rb +12 -0
- data/openapi/config.yml +1 -1
- data/spec/api/microdeposits_api_spec.rb +99 -0
- data/spec/api/transactions_api_spec.rb +49 -0
- data/spec/models/microdeposit_request_body_spec.rb +34 -0
- data/spec/models/microdeposit_request_spec.rb +70 -0
- data/spec/models/microdeposit_response_body_spec.rb +34 -0
- data/spec/models/microdeposit_response_spec.rb +112 -0
- data/spec/models/microdeposit_verify_request_body_spec.rb +34 -0
- data/spec/models/microdeposit_verify_request_spec.rb +40 -0
- data/spec/models/microdeposits_response_body_spec.rb +40 -0
- data/spec/models/transaction_create_request_body_spec.rb +34 -0
- data/spec/models/transaction_create_request_spec.rb +100 -0
- data/spec/models/transaction_create_response_body_spec.rb +292 -0
- metadata +195 -147
@@ -0,0 +1,289 @@
|
|
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: 7.0.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module MxPlatformRuby
|
17
|
+
class MicrodepositRequest
|
18
|
+
attr_accessor :account_number
|
19
|
+
|
20
|
+
attr_accessor :account_type
|
21
|
+
|
22
|
+
attr_accessor :routing_number
|
23
|
+
|
24
|
+
attr_accessor :account_name
|
25
|
+
|
26
|
+
attr_accessor :email
|
27
|
+
|
28
|
+
attr_accessor :first_name
|
29
|
+
|
30
|
+
attr_accessor :last_name
|
31
|
+
|
32
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
33
|
+
def self.attribute_map
|
34
|
+
{
|
35
|
+
:'account_number' => :'account_number',
|
36
|
+
:'account_type' => :'account_type',
|
37
|
+
:'routing_number' => :'routing_number',
|
38
|
+
:'account_name' => :'account_name',
|
39
|
+
:'email' => :'email',
|
40
|
+
:'first_name' => :'first_name',
|
41
|
+
:'last_name' => :'last_name'
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
# Returns all the JSON keys this model knows about
|
46
|
+
def self.acceptable_attributes
|
47
|
+
attribute_map.values
|
48
|
+
end
|
49
|
+
|
50
|
+
# Attribute type mapping.
|
51
|
+
def self.openapi_types
|
52
|
+
{
|
53
|
+
:'account_number' => :'String',
|
54
|
+
:'account_type' => :'String',
|
55
|
+
:'routing_number' => :'String',
|
56
|
+
:'account_name' => :'String',
|
57
|
+
:'email' => :'String',
|
58
|
+
:'first_name' => :'String',
|
59
|
+
:'last_name' => :'String'
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
# List of attributes with nullable: true
|
64
|
+
def self.openapi_nullable
|
65
|
+
Set.new([
|
66
|
+
])
|
67
|
+
end
|
68
|
+
|
69
|
+
# Initializes the object
|
70
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
71
|
+
def initialize(attributes = {})
|
72
|
+
if (!attributes.is_a?(Hash))
|
73
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `MxPlatformRuby::MicrodepositRequest` initialize method"
|
74
|
+
end
|
75
|
+
|
76
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
77
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
78
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
79
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `MxPlatformRuby::MicrodepositRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
80
|
+
end
|
81
|
+
h[k.to_sym] = v
|
82
|
+
}
|
83
|
+
|
84
|
+
if attributes.key?(:'account_number')
|
85
|
+
self.account_number = attributes[:'account_number']
|
86
|
+
else
|
87
|
+
self.account_number = nil
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes.key?(:'account_type')
|
91
|
+
self.account_type = attributes[:'account_type']
|
92
|
+
else
|
93
|
+
self.account_type = nil
|
94
|
+
end
|
95
|
+
|
96
|
+
if attributes.key?(:'routing_number')
|
97
|
+
self.routing_number = attributes[:'routing_number']
|
98
|
+
else
|
99
|
+
self.routing_number = nil
|
100
|
+
end
|
101
|
+
|
102
|
+
if attributes.key?(:'account_name')
|
103
|
+
self.account_name = attributes[:'account_name']
|
104
|
+
end
|
105
|
+
|
106
|
+
if attributes.key?(:'email')
|
107
|
+
self.email = attributes[:'email']
|
108
|
+
end
|
109
|
+
|
110
|
+
if attributes.key?(:'first_name')
|
111
|
+
self.first_name = attributes[:'first_name']
|
112
|
+
end
|
113
|
+
|
114
|
+
if attributes.key?(:'last_name')
|
115
|
+
self.last_name = attributes[:'last_name']
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
120
|
+
# @return Array for valid properties with the reasons
|
121
|
+
def list_invalid_properties
|
122
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
123
|
+
invalid_properties = Array.new
|
124
|
+
if @account_number.nil?
|
125
|
+
invalid_properties.push('invalid value for "account_number", account_number cannot be nil.')
|
126
|
+
end
|
127
|
+
|
128
|
+
if @account_type.nil?
|
129
|
+
invalid_properties.push('invalid value for "account_type", account_type cannot be nil.')
|
130
|
+
end
|
131
|
+
|
132
|
+
if @routing_number.nil?
|
133
|
+
invalid_properties.push('invalid value for "routing_number", routing_number cannot be nil.')
|
134
|
+
end
|
135
|
+
|
136
|
+
invalid_properties
|
137
|
+
end
|
138
|
+
|
139
|
+
# Check to see if the all the properties in the model are valid
|
140
|
+
# @return true if the model is valid
|
141
|
+
def valid?
|
142
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
143
|
+
return false if @account_number.nil?
|
144
|
+
return false if @account_type.nil?
|
145
|
+
return false if @routing_number.nil?
|
146
|
+
true
|
147
|
+
end
|
148
|
+
|
149
|
+
# Checks equality by comparing each attribute.
|
150
|
+
# @param [Object] Object to be compared
|
151
|
+
def ==(o)
|
152
|
+
return true if self.equal?(o)
|
153
|
+
self.class == o.class &&
|
154
|
+
account_number == o.account_number &&
|
155
|
+
account_type == o.account_type &&
|
156
|
+
routing_number == o.routing_number &&
|
157
|
+
account_name == o.account_name &&
|
158
|
+
email == o.email &&
|
159
|
+
first_name == o.first_name &&
|
160
|
+
last_name == o.last_name
|
161
|
+
end
|
162
|
+
|
163
|
+
# @see the `==` method
|
164
|
+
# @param [Object] Object to be compared
|
165
|
+
def eql?(o)
|
166
|
+
self == o
|
167
|
+
end
|
168
|
+
|
169
|
+
# Calculates hash code according to all attributes.
|
170
|
+
# @return [Integer] Hash code
|
171
|
+
def hash
|
172
|
+
[account_number, account_type, routing_number, account_name, email, first_name, last_name].hash
|
173
|
+
end
|
174
|
+
|
175
|
+
# Builds the object from hash
|
176
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
177
|
+
# @return [Object] Returns the model itself
|
178
|
+
def self.build_from_hash(attributes)
|
179
|
+
return nil unless attributes.is_a?(Hash)
|
180
|
+
attributes = attributes.transform_keys(&:to_sym)
|
181
|
+
transformed_hash = {}
|
182
|
+
openapi_types.each_pair do |key, type|
|
183
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
184
|
+
transformed_hash["#{key}"] = nil
|
185
|
+
elsif type =~ /\AArray<(.*)>/i
|
186
|
+
# check to ensure the input is an array given that the attribute
|
187
|
+
# is documented as an array but the input is not
|
188
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
189
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
190
|
+
end
|
191
|
+
elsif !attributes[attribute_map[key]].nil?
|
192
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
193
|
+
end
|
194
|
+
end
|
195
|
+
new(transformed_hash)
|
196
|
+
end
|
197
|
+
|
198
|
+
# Deserializes the data based on type
|
199
|
+
# @param string type Data type
|
200
|
+
# @param string value Value to be deserialized
|
201
|
+
# @return [Object] Deserialized data
|
202
|
+
def self._deserialize(type, value)
|
203
|
+
case type.to_sym
|
204
|
+
when :Time
|
205
|
+
Time.parse(value)
|
206
|
+
when :Date
|
207
|
+
Date.parse(value)
|
208
|
+
when :String
|
209
|
+
value.to_s
|
210
|
+
when :Integer
|
211
|
+
value.to_i
|
212
|
+
when :Float
|
213
|
+
value.to_f
|
214
|
+
when :Boolean
|
215
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
216
|
+
true
|
217
|
+
else
|
218
|
+
false
|
219
|
+
end
|
220
|
+
when :Object
|
221
|
+
# generic object (usually a Hash), return directly
|
222
|
+
value
|
223
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
224
|
+
inner_type = Regexp.last_match[:inner_type]
|
225
|
+
value.map { |v| _deserialize(inner_type, v) }
|
226
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
227
|
+
k_type = Regexp.last_match[:k_type]
|
228
|
+
v_type = Regexp.last_match[:v_type]
|
229
|
+
{}.tap do |hash|
|
230
|
+
value.each do |k, v|
|
231
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
232
|
+
end
|
233
|
+
end
|
234
|
+
else # model
|
235
|
+
# models (e.g. Pet) or oneOf
|
236
|
+
klass = MxPlatformRuby.const_get(type)
|
237
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
# Returns the string representation of the object
|
242
|
+
# @return [String] String presentation of the object
|
243
|
+
def to_s
|
244
|
+
to_hash.to_s
|
245
|
+
end
|
246
|
+
|
247
|
+
# to_body is an alias to to_hash (backward compatibility)
|
248
|
+
# @return [Hash] Returns the object in the form of hash
|
249
|
+
def to_body
|
250
|
+
to_hash
|
251
|
+
end
|
252
|
+
|
253
|
+
# Returns the object in the form of hash
|
254
|
+
# @return [Hash] Returns the object in the form of hash
|
255
|
+
def to_hash
|
256
|
+
hash = {}
|
257
|
+
self.class.attribute_map.each_pair do |attr, param|
|
258
|
+
value = self.send(attr)
|
259
|
+
if value.nil?
|
260
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
261
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
262
|
+
end
|
263
|
+
|
264
|
+
hash[param] = _to_hash(value)
|
265
|
+
end
|
266
|
+
hash
|
267
|
+
end
|
268
|
+
|
269
|
+
# Outputs non-array value in the form of hash
|
270
|
+
# For object, use to_hash. Otherwise, just return the value
|
271
|
+
# @param [Object] value Any valid value
|
272
|
+
# @return [Hash] Returns the value in the form of hash
|
273
|
+
def _to_hash(value)
|
274
|
+
if value.is_a?(Array)
|
275
|
+
value.compact.map { |v| _to_hash(v) }
|
276
|
+
elsif value.is_a?(Hash)
|
277
|
+
{}.tap do |hash|
|
278
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
279
|
+
end
|
280
|
+
elsif value.respond_to? :to_hash
|
281
|
+
value.to_hash
|
282
|
+
else
|
283
|
+
value
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
end
|
288
|
+
|
289
|
+
end
|
@@ -0,0 +1,214 @@
|
|
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: 7.0.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module MxPlatformRuby
|
17
|
+
class MicrodepositRequestBody
|
18
|
+
attr_accessor :micro_deposit
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'micro_deposit' => :'micro_deposit'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Returns all the JSON keys this model knows about
|
28
|
+
def self.acceptable_attributes
|
29
|
+
attribute_map.values
|
30
|
+
end
|
31
|
+
|
32
|
+
# Attribute type mapping.
|
33
|
+
def self.openapi_types
|
34
|
+
{
|
35
|
+
:'micro_deposit' => :'MicrodepositRequest'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# List of attributes with nullable: true
|
40
|
+
def self.openapi_nullable
|
41
|
+
Set.new([
|
42
|
+
])
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
if (!attributes.is_a?(Hash))
|
49
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `MxPlatformRuby::MicrodepositRequestBody` initialize method"
|
50
|
+
end
|
51
|
+
|
52
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `MxPlatformRuby::MicrodepositRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
+
end
|
57
|
+
h[k.to_sym] = v
|
58
|
+
}
|
59
|
+
|
60
|
+
if attributes.key?(:'micro_deposit')
|
61
|
+
self.micro_deposit = attributes[:'micro_deposit']
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
66
|
+
# @return Array for valid properties with the reasons
|
67
|
+
def list_invalid_properties
|
68
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
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
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
77
|
+
true
|
78
|
+
end
|
79
|
+
|
80
|
+
# Checks equality by comparing each attribute.
|
81
|
+
# @param [Object] Object to be compared
|
82
|
+
def ==(o)
|
83
|
+
return true if self.equal?(o)
|
84
|
+
self.class == o.class &&
|
85
|
+
micro_deposit == o.micro_deposit
|
86
|
+
end
|
87
|
+
|
88
|
+
# @see the `==` method
|
89
|
+
# @param [Object] Object to be compared
|
90
|
+
def eql?(o)
|
91
|
+
self == o
|
92
|
+
end
|
93
|
+
|
94
|
+
# Calculates hash code according to all attributes.
|
95
|
+
# @return [Integer] Hash code
|
96
|
+
def hash
|
97
|
+
[micro_deposit].hash
|
98
|
+
end
|
99
|
+
|
100
|
+
# Builds the object from hash
|
101
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
102
|
+
# @return [Object] Returns the model itself
|
103
|
+
def self.build_from_hash(attributes)
|
104
|
+
return nil unless attributes.is_a?(Hash)
|
105
|
+
attributes = attributes.transform_keys(&:to_sym)
|
106
|
+
transformed_hash = {}
|
107
|
+
openapi_types.each_pair do |key, type|
|
108
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
109
|
+
transformed_hash["#{key}"] = nil
|
110
|
+
elsif type =~ /\AArray<(.*)>/i
|
111
|
+
# check to ensure the input is an array given that the attribute
|
112
|
+
# is documented as an array but the input is not
|
113
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
114
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
115
|
+
end
|
116
|
+
elsif !attributes[attribute_map[key]].nil?
|
117
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
118
|
+
end
|
119
|
+
end
|
120
|
+
new(transformed_hash)
|
121
|
+
end
|
122
|
+
|
123
|
+
# Deserializes the data based on type
|
124
|
+
# @param string type Data type
|
125
|
+
# @param string value Value to be deserialized
|
126
|
+
# @return [Object] Deserialized data
|
127
|
+
def self._deserialize(type, value)
|
128
|
+
case type.to_sym
|
129
|
+
when :Time
|
130
|
+
Time.parse(value)
|
131
|
+
when :Date
|
132
|
+
Date.parse(value)
|
133
|
+
when :String
|
134
|
+
value.to_s
|
135
|
+
when :Integer
|
136
|
+
value.to_i
|
137
|
+
when :Float
|
138
|
+
value.to_f
|
139
|
+
when :Boolean
|
140
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
141
|
+
true
|
142
|
+
else
|
143
|
+
false
|
144
|
+
end
|
145
|
+
when :Object
|
146
|
+
# generic object (usually a Hash), return directly
|
147
|
+
value
|
148
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
149
|
+
inner_type = Regexp.last_match[:inner_type]
|
150
|
+
value.map { |v| _deserialize(inner_type, v) }
|
151
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
152
|
+
k_type = Regexp.last_match[:k_type]
|
153
|
+
v_type = Regexp.last_match[:v_type]
|
154
|
+
{}.tap do |hash|
|
155
|
+
value.each do |k, v|
|
156
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
else # model
|
160
|
+
# models (e.g. Pet) or oneOf
|
161
|
+
klass = MxPlatformRuby.const_get(type)
|
162
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
# Returns the string representation of the object
|
167
|
+
# @return [String] String presentation of the object
|
168
|
+
def to_s
|
169
|
+
to_hash.to_s
|
170
|
+
end
|
171
|
+
|
172
|
+
# to_body is an alias to to_hash (backward compatibility)
|
173
|
+
# @return [Hash] Returns the object in the form of hash
|
174
|
+
def to_body
|
175
|
+
to_hash
|
176
|
+
end
|
177
|
+
|
178
|
+
# Returns the object in the form of hash
|
179
|
+
# @return [Hash] Returns the object in the form of hash
|
180
|
+
def to_hash
|
181
|
+
hash = {}
|
182
|
+
self.class.attribute_map.each_pair do |attr, param|
|
183
|
+
value = self.send(attr)
|
184
|
+
if value.nil?
|
185
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
186
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
187
|
+
end
|
188
|
+
|
189
|
+
hash[param] = _to_hash(value)
|
190
|
+
end
|
191
|
+
hash
|
192
|
+
end
|
193
|
+
|
194
|
+
# Outputs non-array value in the form of hash
|
195
|
+
# For object, use to_hash. Otherwise, just return the value
|
196
|
+
# @param [Object] value Any valid value
|
197
|
+
# @return [Hash] Returns the value in the form of hash
|
198
|
+
def _to_hash(value)
|
199
|
+
if value.is_a?(Array)
|
200
|
+
value.compact.map { |v| _to_hash(v) }
|
201
|
+
elsif value.is_a?(Hash)
|
202
|
+
{}.tap do |hash|
|
203
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
204
|
+
end
|
205
|
+
elsif value.respond_to? :to_hash
|
206
|
+
value.to_hash
|
207
|
+
else
|
208
|
+
value
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
end
|
213
|
+
|
214
|
+
end
|