wallee-ruby-sdk 2.2.4 → 3.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/lib/wallee-ruby-sdk.rb +46 -3
  4. data/lib/wallee-ruby-sdk/api/bank_account_service_api.rb +213 -0
  5. data/lib/wallee-ruby-sdk/api/bank_transaction_service_api.rb +213 -0
  6. data/lib/wallee-ruby-sdk/api/charge_bank_transaction_service_api.rb +213 -0
  7. data/lib/wallee-ruby-sdk/api/currency_bank_account_service_api.rb +213 -0
  8. data/lib/wallee-ruby-sdk/api/external_transfer_bank_transaction_service_api.rb +213 -0
  9. data/lib/wallee-ruby-sdk/api/internal_transfer_bank_transaction_service_api.rb +213 -0
  10. data/lib/wallee-ruby-sdk/api/payment_terminal_till_service_api.rb +71 -0
  11. data/lib/wallee-ruby-sdk/api/refund_bank_transaction_service_api.rb +213 -0
  12. data/lib/wallee-ruby-sdk/api/refund_recovery_bank_transaction_service_api.rb +213 -0
  13. data/lib/wallee-ruby-sdk/api/shopify_subscriber_service_api.rb +62 -0
  14. data/lib/wallee-ruby-sdk/api/token_service_api.rb +63 -0
  15. data/lib/wallee-ruby-sdk/api/transaction_terminal_service_api.rb +21 -32
  16. data/lib/wallee-ruby-sdk/api/web_app_service_api.rb +200 -0
  17. data/lib/wallee-ruby-sdk/api_client.rb +2 -1
  18. data/lib/wallee-ruby-sdk/models/abstract_payment_link_update.rb +15 -15
  19. data/lib/wallee-ruby-sdk/models/abstract_subscription_product_active.rb +11 -1
  20. data/lib/wallee-ruby-sdk/models/authenticated_card_data.rb +221 -0
  21. data/lib/wallee-ruby-sdk/models/{unencrypted_card_data.rb → authenticated_card_data_create.rb} +86 -12
  22. data/lib/wallee-ruby-sdk/models/bank_account.rb +291 -0
  23. data/lib/wallee-ruby-sdk/models/bank_account_environment.rb +35 -0
  24. data/lib/wallee-ruby-sdk/models/bank_account_state.rb +37 -0
  25. data/lib/wallee-ruby-sdk/models/bank_account_type.rb +227 -0
  26. data/lib/wallee-ruby-sdk/models/bank_transaction.rb +387 -0
  27. data/lib/wallee-ruby-sdk/models/bank_transaction_flow_direction.rb +35 -0
  28. data/lib/wallee-ruby-sdk/models/bank_transaction_source.rb +215 -0
  29. data/lib/wallee-ruby-sdk/models/bank_transaction_state.rb +35 -0
  30. data/lib/wallee-ruby-sdk/models/bank_transaction_type.rb +215 -0
  31. data/lib/wallee-ruby-sdk/models/card_authentication_response.rb +38 -0
  32. data/lib/wallee-ruby-sdk/models/card_authentication_version.rb +35 -0
  33. data/lib/wallee-ruby-sdk/models/card_cryptogram.rb +201 -0
  34. data/lib/wallee-ruby-sdk/models/card_cryptogram_create.rb +211 -0
  35. data/lib/wallee-ruby-sdk/models/card_cryptogram_type.rb +34 -0
  36. data/lib/wallee-ruby-sdk/models/cardholder_authentication.rb +231 -0
  37. data/lib/wallee-ruby-sdk/models/cardholder_authentication_create.rb +241 -0
  38. data/lib/wallee-ruby-sdk/models/charge_bank_transaction.rb +291 -0
  39. data/lib/wallee-ruby-sdk/models/currency_bank_account.rb +241 -0
  40. data/lib/wallee-ruby-sdk/models/debt_collection_case.rb +1 -1
  41. data/lib/wallee-ruby-sdk/models/debt_collection_case_create.rb +1 -1
  42. data/lib/wallee-ruby-sdk/models/external_transfer_bank_transaction.rb +251 -0
  43. data/lib/wallee-ruby-sdk/models/internal_transfer_bank_transaction.rb +231 -0
  44. data/lib/wallee-ruby-sdk/models/payment_adjustment.rb +231 -0
  45. data/lib/wallee-ruby-sdk/models/payment_adjustment_type.rb +215 -0
  46. data/lib/wallee-ruby-sdk/models/payment_contract.rb +1 -25
  47. data/lib/wallee-ruby-sdk/models/payment_link.rb +16 -40
  48. data/lib/wallee-ruby-sdk/models/payment_link_active.rb +15 -15
  49. data/lib/wallee-ruby-sdk/models/payment_link_address_handling_mode.rb +36 -0
  50. data/lib/wallee-ruby-sdk/models/payment_link_create.rb +16 -44
  51. data/lib/wallee-ruby-sdk/models/payment_link_update.rb +15 -15
  52. data/lib/wallee-ruby-sdk/models/payment_terminal.rb +11 -1
  53. data/lib/wallee-ruby-sdk/models/payment_terminal_address.rb +0 -60
  54. data/lib/wallee-ruby-sdk/models/payment_terminal_configuration_version.rb +11 -1
  55. data/lib/wallee-ruby-sdk/models/payment_terminal_location.rb +2 -22
  56. data/lib/wallee-ruby-sdk/models/payment_terminal_receipt_type.rb +215 -0
  57. data/lib/wallee-ruby-sdk/models/permission.rb +14 -4
  58. data/lib/wallee-ruby-sdk/models/recurring_indicator.rb +37 -0
  59. data/lib/wallee-ruby-sdk/models/refund_bank_transaction.rb +281 -0
  60. data/lib/wallee-ruby-sdk/models/refund_recovery_bank_transaction.rb +293 -0
  61. data/lib/wallee-ruby-sdk/models/rendered_terminal_receipt.rb +26 -6
  62. data/lib/wallee-ruby-sdk/models/role.rb +1 -1
  63. data/lib/wallee-ruby-sdk/models/role_state.rb +37 -0
  64. data/lib/wallee-ruby-sdk/models/shopify_subscriber.rb +1 -1
  65. data/lib/wallee-ruby-sdk/models/shopify_subscriber_active.rb +241 -0
  66. data/lib/wallee-ruby-sdk/models/shopify_subscription.rb +11 -1
  67. data/lib/wallee-ruby-sdk/models/shopify_subscription_creation_request.rb +12 -2
  68. data/lib/wallee-ruby-sdk/models/shopify_subscription_model_billing_configuration.rb +11 -1
  69. data/lib/wallee-ruby-sdk/models/shopify_subscription_version.rb +11 -1
  70. data/lib/wallee-ruby-sdk/models/subscriber.rb +1 -1
  71. data/lib/wallee-ruby-sdk/models/subscriber_create.rb +1 -1
  72. data/lib/wallee-ruby-sdk/models/subscription_affiliate.rb +1 -25
  73. data/lib/wallee-ruby-sdk/models/subscription_affiliate_create.rb +1 -29
  74. data/lib/wallee-ruby-sdk/models/subscription_affiliate_deleted.rb +1 -25
  75. data/lib/wallee-ruby-sdk/models/subscription_affiliate_deleting.rb +1 -25
  76. data/lib/wallee-ruby-sdk/models/subscription_charge.rb +1 -1
  77. data/lib/wallee-ruby-sdk/models/subscription_charge_create.rb +1 -1
  78. data/lib/wallee-ruby-sdk/models/subscription_ledger_entry.rb +12 -2
  79. data/lib/wallee-ruby-sdk/models/subscription_ledger_entry_create.rb +1 -1
  80. data/lib/wallee-ruby-sdk/models/subscription_product.rb +11 -1
  81. data/lib/wallee-ruby-sdk/models/subscription_product_active.rb +11 -1
  82. data/lib/wallee-ruby-sdk/models/subscription_product_component.rb +1 -1
  83. data/lib/wallee-ruby-sdk/models/subscription_product_component_update.rb +1 -1
  84. data/lib/wallee-ruby-sdk/models/subscription_product_create.rb +11 -1
  85. data/lib/wallee-ruby-sdk/models/tax_calculation.rb +2 -2
  86. data/lib/wallee-ruby-sdk/models/terminal_receipt_fetch_request.rb +221 -0
  87. data/lib/wallee-ruby-sdk/models/terminal_receipt_format.rb +35 -0
  88. data/lib/wallee-ruby-sdk/models/token.rb +1 -25
  89. data/lib/wallee-ruby-sdk/models/token_create.rb +1 -29
  90. data/lib/wallee-ruby-sdk/models/tokenized_card_data.rb +211 -0
  91. data/lib/wallee-ruby-sdk/models/{unencrypted_card_data_create.rb → tokenized_card_data_create.rb} +60 -5
  92. data/lib/wallee-ruby-sdk/models/transaction.rb +64 -4
  93. data/lib/wallee-ruby-sdk/models/web_app_confirmation_request.rb +206 -0
  94. data/lib/wallee-ruby-sdk/models/web_app_confirmation_response.rb +231 -0
  95. data/lib/wallee-ruby-sdk/models/webhook_url.rb +11 -1
  96. data/lib/wallee-ruby-sdk/version.rb +1 -1
  97. data/test/condition_type_service_test.rb +22 -0
  98. metadata +50 -5
  99. data/lib/wallee-ruby-sdk/models/payment_terminal_contact_address.rb +0 -396
@@ -0,0 +1,211 @@
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
+ # This model holds the additional card authentication.
22
+ class CardCryptogramCreate
23
+ #
24
+ attr_accessor :type
25
+
26
+ #
27
+ attr_accessor :value
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'type' => :'type',
33
+ :'value' => :'value'
34
+ }
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.swagger_types
39
+ {
40
+ :'type' => :'CardCryptogramType',
41
+ :'value' => :'String'
42
+ }
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ return unless attributes.is_a?(Hash)
49
+
50
+ # convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
52
+
53
+ if attributes.has_key?(:'type')
54
+ self.type = attributes[:'type']
55
+ end
56
+
57
+ if attributes.has_key?(:'value')
58
+ self.value = attributes[:'value']
59
+ end
60
+ end
61
+
62
+ # Show invalid properties with the reasons. Usually used together with valid?
63
+ # @return Array for valid properties with the reasons
64
+ def list_invalid_properties
65
+ invalid_properties = Array.new
66
+ if @type.nil?
67
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
68
+ end
69
+
70
+ if @value.nil?
71
+ invalid_properties.push('invalid value for "value", value cannot be nil.')
72
+ end
73
+
74
+ invalid_properties
75
+ end
76
+
77
+ # Check to see if the all the properties in the model are valid
78
+ # @return true if the model is valid
79
+ def valid?
80
+ return false if @type.nil?
81
+ return false if @value.nil?
82
+ true
83
+ end
84
+
85
+ # Checks equality by comparing each attribute.
86
+ # @param [Object] Object to be compared
87
+ def ==(o)
88
+ return true if self.equal?(o)
89
+ self.class == o.class &&
90
+ type == o.type &&
91
+ value == o.value
92
+ end
93
+
94
+ # @see the `==` method
95
+ # @param [Object] Object to be compared
96
+ def eql?(o)
97
+ self == o
98
+ end
99
+
100
+ # Calculates hash code according to all attributes.
101
+ # @return [Fixnum] Hash code
102
+ def hash
103
+ [type, value].hash
104
+ end
105
+
106
+ # Builds the object from hash
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ # @return [Object] Returns the model itself
109
+ def build_from_hash(attributes)
110
+ return nil unless attributes.is_a?(Hash)
111
+ self.class.swagger_types.each_pair do |key, type|
112
+ if type =~ /\AArray<(.*)>/i
113
+ # check to ensure the input is an array given that the attribute
114
+ # is documented as an array but the input is not
115
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
116
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
117
+ end
118
+ elsif !attributes[self.class.attribute_map[key]].nil?
119
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
120
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
121
+ end
122
+
123
+ self
124
+ end
125
+
126
+ # Deserializes the data based on type
127
+ # @param string type Data type
128
+ # @param string value Value to be deserialized
129
+ # @return [Object] Deserialized data
130
+ def _deserialize(type, value)
131
+ case type.to_sym
132
+ when :DateTime
133
+ DateTime.parse(value)
134
+ when :Date
135
+ Date.parse(value)
136
+ when :String
137
+ value.to_s
138
+ when :Integer
139
+ value.to_i
140
+ when :Float
141
+ value.to_f
142
+ when :BOOLEAN
143
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
144
+ true
145
+ else
146
+ false
147
+ end
148
+ when :Object
149
+ # generic object (usually a Hash), return directly
150
+ value
151
+ when /\AArray<(?<inner_type>.+)>\z/
152
+ inner_type = Regexp.last_match[:inner_type]
153
+ value.map { |v| _deserialize(inner_type, v) }
154
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
155
+ k_type = Regexp.last_match[:k_type]
156
+ v_type = Regexp.last_match[:v_type]
157
+ {}.tap do |hash|
158
+ value.each do |k, v|
159
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
160
+ end
161
+ end
162
+ else # model
163
+ temp_model = Wallee.const_get(type).new
164
+ temp_model.build_from_hash(value)
165
+ end
166
+ end
167
+
168
+ # Returns the string representation of the object
169
+ # @return [String] String presentation of the object
170
+ def to_s
171
+ to_hash.to_s
172
+ end
173
+
174
+ # to_body is an alias to to_hash (backward compatibility)
175
+ # @return [Hash] Returns the object in the form of hash
176
+ def to_body
177
+ to_hash
178
+ end
179
+
180
+ # Returns the object in the form of hash
181
+ # @return [Hash] Returns the object in the form of hash
182
+ def to_hash
183
+ hash = {}
184
+ self.class.attribute_map.each_pair do |attr, param|
185
+ value = self.send(attr)
186
+ next if value.nil?
187
+ hash[param] = _to_hash(value)
188
+ end
189
+ hash
190
+ end
191
+
192
+ # Outputs non-array value in the form of hash
193
+ # For object, use to_hash. Otherwise, just return the value
194
+ # @param [Object] value Any valid value
195
+ # @return [Hash] Returns the value in the form of hash
196
+ def _to_hash(value)
197
+ if value.is_a?(Array)
198
+ value.compact.map{ |v| _to_hash(v) }
199
+ elsif value.is_a?(Hash)
200
+ {}.tap do |hash|
201
+ value.each { |k, v| hash[k] = _to_hash(v) }
202
+ end
203
+ elsif value.respond_to? :to_hash
204
+ value.to_hash
205
+ else
206
+ value
207
+ end
208
+ end
209
+
210
+ end
211
+ end
@@ -0,0 +1,34 @@
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
+ class CardCryptogramType
22
+
23
+ SCHEME_TOKEN = 'SCHEME_TOKEN'.freeze
24
+
25
+ # Builds the enum from string
26
+ # @param [String] The enum value in the form of the string
27
+ # @return [String] The enum value
28
+ def build_from_hash(value)
29
+ constantValues = CardCryptogramType.constants.select { |c| CardCryptogramType::const_get(c) == value }
30
+ raise "Invalid ENUM value #{value} for class #CardCryptogramType" if constantValues.empty?
31
+ value
32
+ end
33
+ end
34
+ 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
+ # This model holds the cardholder authentication data (e.g. 3-D Secure authentication).
22
+ class CardholderAuthentication
23
+ # The authentication identifier as assigned by authentication system (e.g. XID or DSTransactionID).
24
+ attr_accessor :authentication_identifier
25
+
26
+ #
27
+ attr_accessor :authentication_response
28
+
29
+ # The cardholder authentication value. Also known as Cardholder Authentication Verification Value (CAVV).
30
+ attr_accessor :authentication_value
31
+
32
+ # The Electronic Commerce Indicator (ECI) value. The ECI is returned by authentication system and indicates the outcome/status of authentication.
33
+ attr_accessor :electronic_commerce_indicator
34
+
35
+ #
36
+ attr_accessor :version
37
+
38
+ # Attribute mapping from ruby-style variable name to JSON key.
39
+ def self.attribute_map
40
+ {
41
+ :'authentication_identifier' => :'authenticationIdentifier',
42
+ :'authentication_response' => :'authenticationResponse',
43
+ :'authentication_value' => :'authenticationValue',
44
+ :'electronic_commerce_indicator' => :'electronicCommerceIndicator',
45
+ :'version' => :'version'
46
+ }
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.swagger_types
51
+ {
52
+ :'authentication_identifier' => :'String',
53
+ :'authentication_response' => :'CardAuthenticationResponse',
54
+ :'authentication_value' => :'String',
55
+ :'electronic_commerce_indicator' => :'String',
56
+ :'version' => :'CardAuthenticationVersion'
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?(:'authenticationIdentifier')
69
+ self.authentication_identifier = attributes[:'authenticationIdentifier']
70
+ end
71
+
72
+ if attributes.has_key?(:'authenticationResponse')
73
+ self.authentication_response = attributes[:'authenticationResponse']
74
+ end
75
+
76
+ if attributes.has_key?(:'authenticationValue')
77
+ self.authentication_value = attributes[:'authenticationValue']
78
+ end
79
+
80
+ if attributes.has_key?(:'electronicCommerceIndicator')
81
+ self.electronic_commerce_indicator = attributes[:'electronicCommerceIndicator']
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
+ authentication_identifier == o.authentication_identifier &&
108
+ authentication_response == o.authentication_response &&
109
+ authentication_value == o.authentication_value &&
110
+ electronic_commerce_indicator == o.electronic_commerce_indicator &&
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
+ [authentication_identifier, authentication_response, authentication_value, electronic_commerce_indicator, 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