wallee-ruby-sdk 2.2.4 → 2.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/lib/wallee-ruby-sdk.rb +23 -1
- data/lib/wallee-ruby-sdk/api/charge_bank_transaction_service_api.rb +213 -0
- data/lib/wallee-ruby-sdk/api/external_transfer_bank_transaction_service_api.rb +213 -0
- data/lib/wallee-ruby-sdk/api/internal_transfer_bank_transaction_service_api.rb +213 -0
- data/lib/wallee-ruby-sdk/api/refund_bank_transaction_service_api.rb +213 -0
- data/lib/wallee-ruby-sdk/api/refund_recovery_bank_transaction_service_api.rb +213 -0
- data/lib/wallee-ruby-sdk/api_client.rb +2 -1
- data/lib/wallee-ruby-sdk/models/abstract_payment_link_update.rb +15 -15
- data/lib/wallee-ruby-sdk/models/bank_account.rb +291 -0
- data/lib/wallee-ruby-sdk/models/bank_account_environment.rb +35 -0
- data/lib/wallee-ruby-sdk/models/bank_account_state.rb +37 -0
- data/lib/wallee-ruby-sdk/models/bank_account_type.rb +227 -0
- data/lib/wallee-ruby-sdk/models/bank_transaction.rb +387 -0
- data/lib/wallee-ruby-sdk/models/bank_transaction_flow_direction.rb +35 -0
- data/lib/wallee-ruby-sdk/models/bank_transaction_source.rb +215 -0
- data/lib/wallee-ruby-sdk/models/bank_transaction_state.rb +35 -0
- data/lib/wallee-ruby-sdk/models/bank_transaction_type.rb +215 -0
- data/lib/wallee-ruby-sdk/models/charge_bank_transaction.rb +291 -0
- data/lib/wallee-ruby-sdk/models/currency_bank_account.rb +241 -0
- data/lib/wallee-ruby-sdk/models/external_transfer_bank_transaction.rb +251 -0
- data/lib/wallee-ruby-sdk/models/internal_transfer_bank_transaction.rb +231 -0
- data/lib/wallee-ruby-sdk/models/payment_adjustment.rb +231 -0
- data/lib/wallee-ruby-sdk/models/payment_adjustment_type.rb +215 -0
- data/lib/wallee-ruby-sdk/models/payment_link.rb +15 -15
- data/lib/wallee-ruby-sdk/models/payment_link_active.rb +15 -15
- data/lib/wallee-ruby-sdk/models/payment_link_address_handling_mode.rb +36 -0
- data/lib/wallee-ruby-sdk/models/payment_link_create.rb +15 -15
- data/lib/wallee-ruby-sdk/models/payment_link_update.rb +15 -15
- data/lib/wallee-ruby-sdk/models/payment_terminal_address.rb +0 -60
- data/lib/wallee-ruby-sdk/models/payment_terminal_location.rb +2 -12
- data/lib/wallee-ruby-sdk/models/refund_bank_transaction.rb +281 -0
- data/lib/wallee-ruby-sdk/models/refund_recovery_bank_transaction.rb +293 -0
- data/lib/wallee-ruby-sdk/models/subscription_ledger_entry.rb +11 -1
- data/lib/wallee-ruby-sdk/models/transaction.rb +64 -4
- data/lib/wallee-ruby-sdk/version.rb +1 -1
- data/test/condition_type_service_test.rb +22 -0
- metadata +27 -3
- data/lib/wallee-ruby-sdk/models/payment_terminal_contact_address.rb +0 -396
@@ -0,0 +1,251 @@
|
|
1
|
+
=begin
|
2
|
+
The wallee API allows an easy interaction with the wallee web service.
|
3
|
+
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
you may not use this file except in compliance with the License.
|
6
|
+
You may obtain a copy of the License at
|
7
|
+
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
See the License for the specific language governing permissions and
|
14
|
+
limitations under the License.
|
15
|
+
|
16
|
+
=end
|
17
|
+
|
18
|
+
require 'date'
|
19
|
+
|
20
|
+
module Wallee
|
21
|
+
#
|
22
|
+
class ExternalTransferBankTransaction
|
23
|
+
#
|
24
|
+
attr_accessor :bank_transaction
|
25
|
+
|
26
|
+
#
|
27
|
+
attr_accessor :external_account_identifier
|
28
|
+
|
29
|
+
#
|
30
|
+
attr_accessor :external_account_type
|
31
|
+
|
32
|
+
#
|
33
|
+
attr_accessor :external_bank_name
|
34
|
+
|
35
|
+
# The ID is the primary key of the entity. The ID identifies the entity uniquely.
|
36
|
+
attr_accessor :id
|
37
|
+
|
38
|
+
# The linked space id holds the ID of the space to which the entity belongs to.
|
39
|
+
attr_accessor :linked_space_id
|
40
|
+
|
41
|
+
# The version number indicates the version of the entity. The version is incremented whenever the entity is changed.
|
42
|
+
attr_accessor :version
|
43
|
+
|
44
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
45
|
+
def self.attribute_map
|
46
|
+
{
|
47
|
+
:'bank_transaction' => :'bankTransaction',
|
48
|
+
:'external_account_identifier' => :'externalAccountIdentifier',
|
49
|
+
:'external_account_type' => :'externalAccountType',
|
50
|
+
:'external_bank_name' => :'externalBankName',
|
51
|
+
:'id' => :'id',
|
52
|
+
:'linked_space_id' => :'linkedSpaceId',
|
53
|
+
:'version' => :'version'
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
# Attribute type mapping.
|
58
|
+
def self.swagger_types
|
59
|
+
{
|
60
|
+
:'bank_transaction' => :'BankTransaction',
|
61
|
+
:'external_account_identifier' => :'String',
|
62
|
+
:'external_account_type' => :'String',
|
63
|
+
:'external_bank_name' => :'String',
|
64
|
+
:'id' => :'Integer',
|
65
|
+
:'linked_space_id' => :'Integer',
|
66
|
+
:'version' => :'Integer'
|
67
|
+
}
|
68
|
+
end
|
69
|
+
|
70
|
+
# Initializes the object
|
71
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
72
|
+
def initialize(attributes = {})
|
73
|
+
return unless attributes.is_a?(Hash)
|
74
|
+
|
75
|
+
# convert string to symbol for hash key
|
76
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
77
|
+
|
78
|
+
if attributes.has_key?(:'bankTransaction')
|
79
|
+
self.bank_transaction = attributes[:'bankTransaction']
|
80
|
+
end
|
81
|
+
|
82
|
+
if attributes.has_key?(:'externalAccountIdentifier')
|
83
|
+
self.external_account_identifier = attributes[:'externalAccountIdentifier']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.has_key?(:'externalAccountType')
|
87
|
+
self.external_account_type = attributes[:'externalAccountType']
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes.has_key?(:'externalBankName')
|
91
|
+
self.external_bank_name = attributes[:'externalBankName']
|
92
|
+
end
|
93
|
+
|
94
|
+
if attributes.has_key?(:'id')
|
95
|
+
self.id = attributes[:'id']
|
96
|
+
end
|
97
|
+
|
98
|
+
if attributes.has_key?(:'linkedSpaceId')
|
99
|
+
self.linked_space_id = attributes[:'linkedSpaceId']
|
100
|
+
end
|
101
|
+
|
102
|
+
if attributes.has_key?(:'version')
|
103
|
+
self.version = attributes[:'version']
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
108
|
+
# @return Array for valid properties with the reasons
|
109
|
+
def list_invalid_properties
|
110
|
+
invalid_properties = Array.new
|
111
|
+
invalid_properties
|
112
|
+
end
|
113
|
+
|
114
|
+
# Check to see if the all the properties in the model are valid
|
115
|
+
# @return true if the model is valid
|
116
|
+
def valid?
|
117
|
+
true
|
118
|
+
end
|
119
|
+
|
120
|
+
# Checks equality by comparing each attribute.
|
121
|
+
# @param [Object] Object to be compared
|
122
|
+
def ==(o)
|
123
|
+
return true if self.equal?(o)
|
124
|
+
self.class == o.class &&
|
125
|
+
bank_transaction == o.bank_transaction &&
|
126
|
+
external_account_identifier == o.external_account_identifier &&
|
127
|
+
external_account_type == o.external_account_type &&
|
128
|
+
external_bank_name == o.external_bank_name &&
|
129
|
+
id == o.id &&
|
130
|
+
linked_space_id == o.linked_space_id &&
|
131
|
+
version == o.version
|
132
|
+
end
|
133
|
+
|
134
|
+
# @see the `==` method
|
135
|
+
# @param [Object] Object to be compared
|
136
|
+
def eql?(o)
|
137
|
+
self == o
|
138
|
+
end
|
139
|
+
|
140
|
+
# Calculates hash code according to all attributes.
|
141
|
+
# @return [Fixnum] Hash code
|
142
|
+
def hash
|
143
|
+
[bank_transaction, external_account_identifier, external_account_type, external_bank_name, id, linked_space_id, version].hash
|
144
|
+
end
|
145
|
+
|
146
|
+
# Builds the object from hash
|
147
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
148
|
+
# @return [Object] Returns the model itself
|
149
|
+
def build_from_hash(attributes)
|
150
|
+
return nil unless attributes.is_a?(Hash)
|
151
|
+
self.class.swagger_types.each_pair do |key, type|
|
152
|
+
if type =~ /\AArray<(.*)>/i
|
153
|
+
# check to ensure the input is an array given that the attribute
|
154
|
+
# is documented as an array but the input is not
|
155
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
156
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
157
|
+
end
|
158
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
159
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
160
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
161
|
+
end
|
162
|
+
|
163
|
+
self
|
164
|
+
end
|
165
|
+
|
166
|
+
# Deserializes the data based on type
|
167
|
+
# @param string type Data type
|
168
|
+
# @param string value Value to be deserialized
|
169
|
+
# @return [Object] Deserialized data
|
170
|
+
def _deserialize(type, value)
|
171
|
+
case type.to_sym
|
172
|
+
when :DateTime
|
173
|
+
DateTime.parse(value)
|
174
|
+
when :Date
|
175
|
+
Date.parse(value)
|
176
|
+
when :String
|
177
|
+
value.to_s
|
178
|
+
when :Integer
|
179
|
+
value.to_i
|
180
|
+
when :Float
|
181
|
+
value.to_f
|
182
|
+
when :BOOLEAN
|
183
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
184
|
+
true
|
185
|
+
else
|
186
|
+
false
|
187
|
+
end
|
188
|
+
when :Object
|
189
|
+
# generic object (usually a Hash), return directly
|
190
|
+
value
|
191
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
192
|
+
inner_type = Regexp.last_match[:inner_type]
|
193
|
+
value.map { |v| _deserialize(inner_type, v) }
|
194
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
195
|
+
k_type = Regexp.last_match[:k_type]
|
196
|
+
v_type = Regexp.last_match[:v_type]
|
197
|
+
{}.tap do |hash|
|
198
|
+
value.each do |k, v|
|
199
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
200
|
+
end
|
201
|
+
end
|
202
|
+
else # model
|
203
|
+
temp_model = Wallee.const_get(type).new
|
204
|
+
temp_model.build_from_hash(value)
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
# Returns the string representation of the object
|
209
|
+
# @return [String] String presentation of the object
|
210
|
+
def to_s
|
211
|
+
to_hash.to_s
|
212
|
+
end
|
213
|
+
|
214
|
+
# to_body is an alias to to_hash (backward compatibility)
|
215
|
+
# @return [Hash] Returns the object in the form of hash
|
216
|
+
def to_body
|
217
|
+
to_hash
|
218
|
+
end
|
219
|
+
|
220
|
+
# Returns the object in the form of hash
|
221
|
+
# @return [Hash] Returns the object in the form of hash
|
222
|
+
def to_hash
|
223
|
+
hash = {}
|
224
|
+
self.class.attribute_map.each_pair do |attr, param|
|
225
|
+
value = self.send(attr)
|
226
|
+
next if value.nil?
|
227
|
+
hash[param] = _to_hash(value)
|
228
|
+
end
|
229
|
+
hash
|
230
|
+
end
|
231
|
+
|
232
|
+
# Outputs non-array value in the form of hash
|
233
|
+
# For object, use to_hash. Otherwise, just return the value
|
234
|
+
# @param [Object] value Any valid value
|
235
|
+
# @return [Hash] Returns the value in the form of hash
|
236
|
+
def _to_hash(value)
|
237
|
+
if value.is_a?(Array)
|
238
|
+
value.compact.map{ |v| _to_hash(v) }
|
239
|
+
elsif value.is_a?(Hash)
|
240
|
+
{}.tap do |hash|
|
241
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
242
|
+
end
|
243
|
+
elsif value.respond_to? :to_hash
|
244
|
+
value.to_hash
|
245
|
+
else
|
246
|
+
value
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
end
|
251
|
+
end
|
@@ -0,0 +1,231 @@
|
|
1
|
+
=begin
|
2
|
+
The wallee API allows an easy interaction with the wallee web service.
|
3
|
+
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
you may not use this file except in compliance with the License.
|
6
|
+
You may obtain a copy of the License at
|
7
|
+
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
See the License for the specific language governing permissions and
|
14
|
+
limitations under the License.
|
15
|
+
|
16
|
+
=end
|
17
|
+
|
18
|
+
require 'date'
|
19
|
+
|
20
|
+
module Wallee
|
21
|
+
#
|
22
|
+
class InternalTransferBankTransaction
|
23
|
+
# The ID is the primary key of the entity. The ID identifies the entity uniquely.
|
24
|
+
attr_accessor :id
|
25
|
+
|
26
|
+
# The linked space id holds the ID of the space to which the entity belongs to.
|
27
|
+
attr_accessor :linked_space_id
|
28
|
+
|
29
|
+
#
|
30
|
+
attr_accessor :source_bank_transaction
|
31
|
+
|
32
|
+
#
|
33
|
+
attr_accessor :target_bank_transaction
|
34
|
+
|
35
|
+
# The version number indicates the version of the entity. The version is incremented whenever the entity is changed.
|
36
|
+
attr_accessor :version
|
37
|
+
|
38
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
39
|
+
def self.attribute_map
|
40
|
+
{
|
41
|
+
:'id' => :'id',
|
42
|
+
:'linked_space_id' => :'linkedSpaceId',
|
43
|
+
:'source_bank_transaction' => :'sourceBankTransaction',
|
44
|
+
:'target_bank_transaction' => :'targetBankTransaction',
|
45
|
+
:'version' => :'version'
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
# Attribute type mapping.
|
50
|
+
def self.swagger_types
|
51
|
+
{
|
52
|
+
:'id' => :'Integer',
|
53
|
+
:'linked_space_id' => :'Integer',
|
54
|
+
:'source_bank_transaction' => :'BankTransaction',
|
55
|
+
:'target_bank_transaction' => :'BankTransaction',
|
56
|
+
:'version' => :'Integer'
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
# Initializes the object
|
61
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
62
|
+
def initialize(attributes = {})
|
63
|
+
return unless attributes.is_a?(Hash)
|
64
|
+
|
65
|
+
# convert string to symbol for hash key
|
66
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
67
|
+
|
68
|
+
if attributes.has_key?(:'id')
|
69
|
+
self.id = attributes[:'id']
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes.has_key?(:'linkedSpaceId')
|
73
|
+
self.linked_space_id = attributes[:'linkedSpaceId']
|
74
|
+
end
|
75
|
+
|
76
|
+
if attributes.has_key?(:'sourceBankTransaction')
|
77
|
+
self.source_bank_transaction = attributes[:'sourceBankTransaction']
|
78
|
+
end
|
79
|
+
|
80
|
+
if attributes.has_key?(:'targetBankTransaction')
|
81
|
+
self.target_bank_transaction = attributes[:'targetBankTransaction']
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.has_key?(:'version')
|
85
|
+
self.version = attributes[:'version']
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
90
|
+
# @return Array for valid properties with the reasons
|
91
|
+
def list_invalid_properties
|
92
|
+
invalid_properties = Array.new
|
93
|
+
invalid_properties
|
94
|
+
end
|
95
|
+
|
96
|
+
# Check to see if the all the properties in the model are valid
|
97
|
+
# @return true if the model is valid
|
98
|
+
def valid?
|
99
|
+
true
|
100
|
+
end
|
101
|
+
|
102
|
+
# Checks equality by comparing each attribute.
|
103
|
+
# @param [Object] Object to be compared
|
104
|
+
def ==(o)
|
105
|
+
return true if self.equal?(o)
|
106
|
+
self.class == o.class &&
|
107
|
+
id == o.id &&
|
108
|
+
linked_space_id == o.linked_space_id &&
|
109
|
+
source_bank_transaction == o.source_bank_transaction &&
|
110
|
+
target_bank_transaction == o.target_bank_transaction &&
|
111
|
+
version == o.version
|
112
|
+
end
|
113
|
+
|
114
|
+
# @see the `==` method
|
115
|
+
# @param [Object] Object to be compared
|
116
|
+
def eql?(o)
|
117
|
+
self == o
|
118
|
+
end
|
119
|
+
|
120
|
+
# Calculates hash code according to all attributes.
|
121
|
+
# @return [Fixnum] Hash code
|
122
|
+
def hash
|
123
|
+
[id, linked_space_id, source_bank_transaction, target_bank_transaction, version].hash
|
124
|
+
end
|
125
|
+
|
126
|
+
# Builds the object from hash
|
127
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
128
|
+
# @return [Object] Returns the model itself
|
129
|
+
def build_from_hash(attributes)
|
130
|
+
return nil unless attributes.is_a?(Hash)
|
131
|
+
self.class.swagger_types.each_pair do |key, type|
|
132
|
+
if type =~ /\AArray<(.*)>/i
|
133
|
+
# check to ensure the input is an array given that the attribute
|
134
|
+
# is documented as an array but the input is not
|
135
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
136
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
137
|
+
end
|
138
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
139
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
140
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
141
|
+
end
|
142
|
+
|
143
|
+
self
|
144
|
+
end
|
145
|
+
|
146
|
+
# Deserializes the data based on type
|
147
|
+
# @param string type Data type
|
148
|
+
# @param string value Value to be deserialized
|
149
|
+
# @return [Object] Deserialized data
|
150
|
+
def _deserialize(type, value)
|
151
|
+
case type.to_sym
|
152
|
+
when :DateTime
|
153
|
+
DateTime.parse(value)
|
154
|
+
when :Date
|
155
|
+
Date.parse(value)
|
156
|
+
when :String
|
157
|
+
value.to_s
|
158
|
+
when :Integer
|
159
|
+
value.to_i
|
160
|
+
when :Float
|
161
|
+
value.to_f
|
162
|
+
when :BOOLEAN
|
163
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
164
|
+
true
|
165
|
+
else
|
166
|
+
false
|
167
|
+
end
|
168
|
+
when :Object
|
169
|
+
# generic object (usually a Hash), return directly
|
170
|
+
value
|
171
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
172
|
+
inner_type = Regexp.last_match[:inner_type]
|
173
|
+
value.map { |v| _deserialize(inner_type, v) }
|
174
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
175
|
+
k_type = Regexp.last_match[:k_type]
|
176
|
+
v_type = Regexp.last_match[:v_type]
|
177
|
+
{}.tap do |hash|
|
178
|
+
value.each do |k, v|
|
179
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
else # model
|
183
|
+
temp_model = Wallee.const_get(type).new
|
184
|
+
temp_model.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
|
+
next if value.nil?
|
207
|
+
hash[param] = _to_hash(value)
|
208
|
+
end
|
209
|
+
hash
|
210
|
+
end
|
211
|
+
|
212
|
+
# Outputs non-array value in the form of hash
|
213
|
+
# For object, use to_hash. Otherwise, just return the value
|
214
|
+
# @param [Object] value Any valid value
|
215
|
+
# @return [Hash] Returns the value in the form of hash
|
216
|
+
def _to_hash(value)
|
217
|
+
if value.is_a?(Array)
|
218
|
+
value.compact.map{ |v| _to_hash(v) }
|
219
|
+
elsif value.is_a?(Hash)
|
220
|
+
{}.tap do |hash|
|
221
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
222
|
+
end
|
223
|
+
elsif value.respond_to? :to_hash
|
224
|
+
value.to_hash
|
225
|
+
else
|
226
|
+
value
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
end
|
231
|
+
end
|