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,281 @@
|
|
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 RefundBankTransaction
|
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 :linked_transaction
|
31
|
+
|
32
|
+
#
|
33
|
+
attr_accessor :bank_transaction
|
34
|
+
|
35
|
+
#
|
36
|
+
attr_accessor :language
|
37
|
+
|
38
|
+
#
|
39
|
+
attr_accessor :refund
|
40
|
+
|
41
|
+
# Specify the posting amount in the refund's currency.
|
42
|
+
attr_accessor :refund_currency_amount
|
43
|
+
|
44
|
+
#
|
45
|
+
attr_accessor :refund_currency_value_amount
|
46
|
+
|
47
|
+
#
|
48
|
+
attr_accessor :space_view_id
|
49
|
+
|
50
|
+
# The version number indicates the version of the entity. The version is incremented whenever the entity is changed.
|
51
|
+
attr_accessor :version
|
52
|
+
|
53
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
54
|
+
def self.attribute_map
|
55
|
+
{
|
56
|
+
:'id' => :'id',
|
57
|
+
:'linked_space_id' => :'linkedSpaceId',
|
58
|
+
:'linked_transaction' => :'linkedTransaction',
|
59
|
+
:'bank_transaction' => :'bankTransaction',
|
60
|
+
:'language' => :'language',
|
61
|
+
:'refund' => :'refund',
|
62
|
+
:'refund_currency_amount' => :'refundCurrencyAmount',
|
63
|
+
:'refund_currency_value_amount' => :'refundCurrencyValueAmount',
|
64
|
+
:'space_view_id' => :'spaceViewId',
|
65
|
+
:'version' => :'version'
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
# Attribute type mapping.
|
70
|
+
def self.swagger_types
|
71
|
+
{
|
72
|
+
:'id' => :'Integer',
|
73
|
+
:'linked_space_id' => :'Integer',
|
74
|
+
:'linked_transaction' => :'Integer',
|
75
|
+
:'bank_transaction' => :'BankTransaction',
|
76
|
+
:'language' => :'String',
|
77
|
+
:'refund' => :'Integer',
|
78
|
+
:'refund_currency_amount' => :'Float',
|
79
|
+
:'refund_currency_value_amount' => :'Float',
|
80
|
+
:'space_view_id' => :'Integer',
|
81
|
+
:'version' => :'Integer'
|
82
|
+
}
|
83
|
+
end
|
84
|
+
|
85
|
+
# Initializes the object
|
86
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
87
|
+
def initialize(attributes = {})
|
88
|
+
return unless attributes.is_a?(Hash)
|
89
|
+
|
90
|
+
# convert string to symbol for hash key
|
91
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
92
|
+
|
93
|
+
if attributes.has_key?(:'id')
|
94
|
+
self.id = attributes[:'id']
|
95
|
+
end
|
96
|
+
|
97
|
+
if attributes.has_key?(:'linkedSpaceId')
|
98
|
+
self.linked_space_id = attributes[:'linkedSpaceId']
|
99
|
+
end
|
100
|
+
|
101
|
+
if attributes.has_key?(:'linkedTransaction')
|
102
|
+
self.linked_transaction = attributes[:'linkedTransaction']
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.has_key?(:'bankTransaction')
|
106
|
+
self.bank_transaction = attributes[:'bankTransaction']
|
107
|
+
end
|
108
|
+
|
109
|
+
if attributes.has_key?(:'language')
|
110
|
+
self.language = attributes[:'language']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.has_key?(:'refund')
|
114
|
+
self.refund = attributes[:'refund']
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.has_key?(:'refundCurrencyAmount')
|
118
|
+
self.refund_currency_amount = attributes[:'refundCurrencyAmount']
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.has_key?(:'refundCurrencyValueAmount')
|
122
|
+
self.refund_currency_value_amount = attributes[:'refundCurrencyValueAmount']
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.has_key?(:'spaceViewId')
|
126
|
+
self.space_view_id = attributes[:'spaceViewId']
|
127
|
+
end
|
128
|
+
|
129
|
+
if attributes.has_key?(:'version')
|
130
|
+
self.version = attributes[:'version']
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
135
|
+
# @return Array for valid properties with the reasons
|
136
|
+
def list_invalid_properties
|
137
|
+
invalid_properties = Array.new
|
138
|
+
invalid_properties
|
139
|
+
end
|
140
|
+
|
141
|
+
# Check to see if the all the properties in the model are valid
|
142
|
+
# @return true if the model is valid
|
143
|
+
def valid?
|
144
|
+
true
|
145
|
+
end
|
146
|
+
|
147
|
+
# Checks equality by comparing each attribute.
|
148
|
+
# @param [Object] Object to be compared
|
149
|
+
def ==(o)
|
150
|
+
return true if self.equal?(o)
|
151
|
+
self.class == o.class &&
|
152
|
+
id == o.id &&
|
153
|
+
linked_space_id == o.linked_space_id &&
|
154
|
+
linked_transaction == o.linked_transaction &&
|
155
|
+
bank_transaction == o.bank_transaction &&
|
156
|
+
language == o.language &&
|
157
|
+
refund == o.refund &&
|
158
|
+
refund_currency_amount == o.refund_currency_amount &&
|
159
|
+
refund_currency_value_amount == o.refund_currency_value_amount &&
|
160
|
+
space_view_id == o.space_view_id &&
|
161
|
+
version == o.version
|
162
|
+
end
|
163
|
+
|
164
|
+
# @see the `==` method
|
165
|
+
# @param [Object] Object to be compared
|
166
|
+
def eql?(o)
|
167
|
+
self == o
|
168
|
+
end
|
169
|
+
|
170
|
+
# Calculates hash code according to all attributes.
|
171
|
+
# @return [Fixnum] Hash code
|
172
|
+
def hash
|
173
|
+
[id, linked_space_id, linked_transaction, bank_transaction, language, refund, refund_currency_amount, refund_currency_value_amount, space_view_id, version].hash
|
174
|
+
end
|
175
|
+
|
176
|
+
# Builds the object from hash
|
177
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
178
|
+
# @return [Object] Returns the model itself
|
179
|
+
def build_from_hash(attributes)
|
180
|
+
return nil unless attributes.is_a?(Hash)
|
181
|
+
self.class.swagger_types.each_pair do |key, type|
|
182
|
+
if type =~ /\AArray<(.*)>/i
|
183
|
+
# check to ensure the input is an array given that the attribute
|
184
|
+
# is documented as an array but the input is not
|
185
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
186
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
187
|
+
end
|
188
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
189
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
190
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
191
|
+
end
|
192
|
+
|
193
|
+
self
|
194
|
+
end
|
195
|
+
|
196
|
+
# Deserializes the data based on type
|
197
|
+
# @param string type Data type
|
198
|
+
# @param string value Value to be deserialized
|
199
|
+
# @return [Object] Deserialized data
|
200
|
+
def _deserialize(type, value)
|
201
|
+
case type.to_sym
|
202
|
+
when :DateTime
|
203
|
+
DateTime.parse(value)
|
204
|
+
when :Date
|
205
|
+
Date.parse(value)
|
206
|
+
when :String
|
207
|
+
value.to_s
|
208
|
+
when :Integer
|
209
|
+
value.to_i
|
210
|
+
when :Float
|
211
|
+
value.to_f
|
212
|
+
when :BOOLEAN
|
213
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
214
|
+
true
|
215
|
+
else
|
216
|
+
false
|
217
|
+
end
|
218
|
+
when :Object
|
219
|
+
# generic object (usually a Hash), return directly
|
220
|
+
value
|
221
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
222
|
+
inner_type = Regexp.last_match[:inner_type]
|
223
|
+
value.map { |v| _deserialize(inner_type, v) }
|
224
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
225
|
+
k_type = Regexp.last_match[:k_type]
|
226
|
+
v_type = Regexp.last_match[:v_type]
|
227
|
+
{}.tap do |hash|
|
228
|
+
value.each do |k, v|
|
229
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
230
|
+
end
|
231
|
+
end
|
232
|
+
else # model
|
233
|
+
temp_model = Wallee.const_get(type).new
|
234
|
+
temp_model.build_from_hash(value)
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
# Returns the string representation of the object
|
239
|
+
# @return [String] String presentation of the object
|
240
|
+
def to_s
|
241
|
+
to_hash.to_s
|
242
|
+
end
|
243
|
+
|
244
|
+
# to_body is an alias to to_hash (backward compatibility)
|
245
|
+
# @return [Hash] Returns the object in the form of hash
|
246
|
+
def to_body
|
247
|
+
to_hash
|
248
|
+
end
|
249
|
+
|
250
|
+
# Returns the object in the form of hash
|
251
|
+
# @return [Hash] Returns the object in the form of hash
|
252
|
+
def to_hash
|
253
|
+
hash = {}
|
254
|
+
self.class.attribute_map.each_pair do |attr, param|
|
255
|
+
value = self.send(attr)
|
256
|
+
next if value.nil?
|
257
|
+
hash[param] = _to_hash(value)
|
258
|
+
end
|
259
|
+
hash
|
260
|
+
end
|
261
|
+
|
262
|
+
# Outputs non-array value in the form of hash
|
263
|
+
# For object, use to_hash. Otherwise, just return the value
|
264
|
+
# @param [Object] value Any valid value
|
265
|
+
# @return [Hash] Returns the value in the form of hash
|
266
|
+
def _to_hash(value)
|
267
|
+
if value.is_a?(Array)
|
268
|
+
value.compact.map{ |v| _to_hash(v) }
|
269
|
+
elsif value.is_a?(Hash)
|
270
|
+
{}.tap do |hash|
|
271
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
272
|
+
end
|
273
|
+
elsif value.respond_to? :to_hash
|
274
|
+
value.to_hash
|
275
|
+
else
|
276
|
+
value
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
end
|
281
|
+
end
|
@@ -0,0 +1,293 @@
|
|
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 RefundRecoveryBankTransaction
|
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 :linked_transaction
|
31
|
+
|
32
|
+
#
|
33
|
+
attr_accessor :bank_transaction
|
34
|
+
|
35
|
+
#
|
36
|
+
attr_accessor :language
|
37
|
+
|
38
|
+
# The line items contain the items which could be recovered.
|
39
|
+
attr_accessor :line_items
|
40
|
+
|
41
|
+
#
|
42
|
+
attr_accessor :refund
|
43
|
+
|
44
|
+
# Specify the posting amount in the refund's currency.
|
45
|
+
attr_accessor :refund_currency_amount
|
46
|
+
|
47
|
+
#
|
48
|
+
attr_accessor :refund_currency_value_amount
|
49
|
+
|
50
|
+
#
|
51
|
+
attr_accessor :space_view_id
|
52
|
+
|
53
|
+
# The version number indicates the version of the entity. The version is incremented whenever the entity is changed.
|
54
|
+
attr_accessor :version
|
55
|
+
|
56
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
57
|
+
def self.attribute_map
|
58
|
+
{
|
59
|
+
:'id' => :'id',
|
60
|
+
:'linked_space_id' => :'linkedSpaceId',
|
61
|
+
:'linked_transaction' => :'linkedTransaction',
|
62
|
+
:'bank_transaction' => :'bankTransaction',
|
63
|
+
:'language' => :'language',
|
64
|
+
:'line_items' => :'lineItems',
|
65
|
+
:'refund' => :'refund',
|
66
|
+
:'refund_currency_amount' => :'refundCurrencyAmount',
|
67
|
+
:'refund_currency_value_amount' => :'refundCurrencyValueAmount',
|
68
|
+
:'space_view_id' => :'spaceViewId',
|
69
|
+
:'version' => :'version'
|
70
|
+
}
|
71
|
+
end
|
72
|
+
|
73
|
+
# Attribute type mapping.
|
74
|
+
def self.swagger_types
|
75
|
+
{
|
76
|
+
:'id' => :'Integer',
|
77
|
+
:'linked_space_id' => :'Integer',
|
78
|
+
:'linked_transaction' => :'Integer',
|
79
|
+
:'bank_transaction' => :'BankTransaction',
|
80
|
+
:'language' => :'String',
|
81
|
+
:'line_items' => :'Array<LineItem>',
|
82
|
+
:'refund' => :'Integer',
|
83
|
+
:'refund_currency_amount' => :'Float',
|
84
|
+
:'refund_currency_value_amount' => :'Float',
|
85
|
+
:'space_view_id' => :'Integer',
|
86
|
+
:'version' => :'Integer'
|
87
|
+
}
|
88
|
+
end
|
89
|
+
|
90
|
+
# Initializes the object
|
91
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
92
|
+
def initialize(attributes = {})
|
93
|
+
return unless attributes.is_a?(Hash)
|
94
|
+
|
95
|
+
# convert string to symbol for hash key
|
96
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
97
|
+
|
98
|
+
if attributes.has_key?(:'id')
|
99
|
+
self.id = attributes[:'id']
|
100
|
+
end
|
101
|
+
|
102
|
+
if attributes.has_key?(:'linkedSpaceId')
|
103
|
+
self.linked_space_id = attributes[:'linkedSpaceId']
|
104
|
+
end
|
105
|
+
|
106
|
+
if attributes.has_key?(:'linkedTransaction')
|
107
|
+
self.linked_transaction = attributes[:'linkedTransaction']
|
108
|
+
end
|
109
|
+
|
110
|
+
if attributes.has_key?(:'bankTransaction')
|
111
|
+
self.bank_transaction = attributes[:'bankTransaction']
|
112
|
+
end
|
113
|
+
|
114
|
+
if attributes.has_key?(:'language')
|
115
|
+
self.language = attributes[:'language']
|
116
|
+
end
|
117
|
+
|
118
|
+
if attributes.has_key?(:'lineItems')
|
119
|
+
if (value = attributes[:'lineItems']).is_a?(Array)
|
120
|
+
self.line_items = value
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
if attributes.has_key?(:'refund')
|
125
|
+
self.refund = attributes[:'refund']
|
126
|
+
end
|
127
|
+
|
128
|
+
if attributes.has_key?(:'refundCurrencyAmount')
|
129
|
+
self.refund_currency_amount = attributes[:'refundCurrencyAmount']
|
130
|
+
end
|
131
|
+
|
132
|
+
if attributes.has_key?(:'refundCurrencyValueAmount')
|
133
|
+
self.refund_currency_value_amount = attributes[:'refundCurrencyValueAmount']
|
134
|
+
end
|
135
|
+
|
136
|
+
if attributes.has_key?(:'spaceViewId')
|
137
|
+
self.space_view_id = attributes[:'spaceViewId']
|
138
|
+
end
|
139
|
+
|
140
|
+
if attributes.has_key?(:'version')
|
141
|
+
self.version = attributes[:'version']
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
146
|
+
# @return Array for valid properties with the reasons
|
147
|
+
def list_invalid_properties
|
148
|
+
invalid_properties = Array.new
|
149
|
+
invalid_properties
|
150
|
+
end
|
151
|
+
|
152
|
+
# Check to see if the all the properties in the model are valid
|
153
|
+
# @return true if the model is valid
|
154
|
+
def valid?
|
155
|
+
true
|
156
|
+
end
|
157
|
+
|
158
|
+
# Checks equality by comparing each attribute.
|
159
|
+
# @param [Object] Object to be compared
|
160
|
+
def ==(o)
|
161
|
+
return true if self.equal?(o)
|
162
|
+
self.class == o.class &&
|
163
|
+
id == o.id &&
|
164
|
+
linked_space_id == o.linked_space_id &&
|
165
|
+
linked_transaction == o.linked_transaction &&
|
166
|
+
bank_transaction == o.bank_transaction &&
|
167
|
+
language == o.language &&
|
168
|
+
line_items == o.line_items &&
|
169
|
+
refund == o.refund &&
|
170
|
+
refund_currency_amount == o.refund_currency_amount &&
|
171
|
+
refund_currency_value_amount == o.refund_currency_value_amount &&
|
172
|
+
space_view_id == o.space_view_id &&
|
173
|
+
version == o.version
|
174
|
+
end
|
175
|
+
|
176
|
+
# @see the `==` method
|
177
|
+
# @param [Object] Object to be compared
|
178
|
+
def eql?(o)
|
179
|
+
self == o
|
180
|
+
end
|
181
|
+
|
182
|
+
# Calculates hash code according to all attributes.
|
183
|
+
# @return [Fixnum] Hash code
|
184
|
+
def hash
|
185
|
+
[id, linked_space_id, linked_transaction, bank_transaction, language, line_items, refund, refund_currency_amount, refund_currency_value_amount, space_view_id, version].hash
|
186
|
+
end
|
187
|
+
|
188
|
+
# Builds the object from hash
|
189
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
190
|
+
# @return [Object] Returns the model itself
|
191
|
+
def build_from_hash(attributes)
|
192
|
+
return nil unless attributes.is_a?(Hash)
|
193
|
+
self.class.swagger_types.each_pair do |key, type|
|
194
|
+
if type =~ /\AArray<(.*)>/i
|
195
|
+
# check to ensure the input is an array given that the attribute
|
196
|
+
# is documented as an array but the input is not
|
197
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
198
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
199
|
+
end
|
200
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
201
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
202
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
203
|
+
end
|
204
|
+
|
205
|
+
self
|
206
|
+
end
|
207
|
+
|
208
|
+
# Deserializes the data based on type
|
209
|
+
# @param string type Data type
|
210
|
+
# @param string value Value to be deserialized
|
211
|
+
# @return [Object] Deserialized data
|
212
|
+
def _deserialize(type, value)
|
213
|
+
case type.to_sym
|
214
|
+
when :DateTime
|
215
|
+
DateTime.parse(value)
|
216
|
+
when :Date
|
217
|
+
Date.parse(value)
|
218
|
+
when :String
|
219
|
+
value.to_s
|
220
|
+
when :Integer
|
221
|
+
value.to_i
|
222
|
+
when :Float
|
223
|
+
value.to_f
|
224
|
+
when :BOOLEAN
|
225
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
226
|
+
true
|
227
|
+
else
|
228
|
+
false
|
229
|
+
end
|
230
|
+
when :Object
|
231
|
+
# generic object (usually a Hash), return directly
|
232
|
+
value
|
233
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
234
|
+
inner_type = Regexp.last_match[:inner_type]
|
235
|
+
value.map { |v| _deserialize(inner_type, v) }
|
236
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
237
|
+
k_type = Regexp.last_match[:k_type]
|
238
|
+
v_type = Regexp.last_match[:v_type]
|
239
|
+
{}.tap do |hash|
|
240
|
+
value.each do |k, v|
|
241
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
242
|
+
end
|
243
|
+
end
|
244
|
+
else # model
|
245
|
+
temp_model = Wallee.const_get(type).new
|
246
|
+
temp_model.build_from_hash(value)
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
# Returns the string representation of the object
|
251
|
+
# @return [String] String presentation of the object
|
252
|
+
def to_s
|
253
|
+
to_hash.to_s
|
254
|
+
end
|
255
|
+
|
256
|
+
# to_body is an alias to to_hash (backward compatibility)
|
257
|
+
# @return [Hash] Returns the object in the form of hash
|
258
|
+
def to_body
|
259
|
+
to_hash
|
260
|
+
end
|
261
|
+
|
262
|
+
# Returns the object in the form of hash
|
263
|
+
# @return [Hash] Returns the object in the form of hash
|
264
|
+
def to_hash
|
265
|
+
hash = {}
|
266
|
+
self.class.attribute_map.each_pair do |attr, param|
|
267
|
+
value = self.send(attr)
|
268
|
+
next if value.nil?
|
269
|
+
hash[param] = _to_hash(value)
|
270
|
+
end
|
271
|
+
hash
|
272
|
+
end
|
273
|
+
|
274
|
+
# Outputs non-array value in the form of hash
|
275
|
+
# For object, use to_hash. Otherwise, just return the value
|
276
|
+
# @param [Object] value Any valid value
|
277
|
+
# @return [Hash] Returns the value in the form of hash
|
278
|
+
def _to_hash(value)
|
279
|
+
if value.is_a?(Array)
|
280
|
+
value.compact.map{ |v| _to_hash(v) }
|
281
|
+
elsif value.is_a?(Hash)
|
282
|
+
{}.tap do |hash|
|
283
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
284
|
+
end
|
285
|
+
elsif value.respond_to? :to_hash
|
286
|
+
value.to_hash
|
287
|
+
else
|
288
|
+
value
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
end
|
293
|
+
end
|