wallee-ruby-sdk 2.2.5 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wallee-ruby-sdk.rb +22 -2
- data/lib/wallee-ruby-sdk/api/bank_account_service_api.rb +213 -0
- data/lib/wallee-ruby-sdk/api/bank_transaction_service_api.rb +213 -0
- data/lib/wallee-ruby-sdk/api/currency_bank_account_service_api.rb +213 -0
- data/lib/wallee-ruby-sdk/api/payment_terminal_till_service_api.rb +71 -0
- data/lib/wallee-ruby-sdk/api/shopify_subscriber_service_api.rb +62 -0
- data/lib/wallee-ruby-sdk/api/transaction_terminal_service_api.rb +21 -32
- data/lib/wallee-ruby-sdk/api/web_app_service_api.rb +200 -0
- data/lib/wallee-ruby-sdk/models/authenticated_card_data.rb +221 -0
- data/lib/wallee-ruby-sdk/models/{unencrypted_card_data.rb → authenticated_card_data_create.rb} +86 -12
- data/lib/wallee-ruby-sdk/models/card_authentication_response.rb +38 -0
- data/lib/wallee-ruby-sdk/models/card_authentication_version.rb +35 -0
- data/lib/wallee-ruby-sdk/models/card_cryptogram.rb +201 -0
- data/lib/wallee-ruby-sdk/models/card_cryptogram_create.rb +211 -0
- data/lib/wallee-ruby-sdk/models/card_cryptogram_type.rb +34 -0
- data/lib/wallee-ruby-sdk/models/cardholder_authentication.rb +231 -0
- data/lib/wallee-ruby-sdk/models/cardholder_authentication_create.rb +241 -0
- data/lib/wallee-ruby-sdk/models/charge_bank_transaction.rb +1 -1
- data/lib/wallee-ruby-sdk/models/payment_terminal.rb +11 -1
- data/lib/wallee-ruby-sdk/models/payment_terminal_configuration_version.rb +11 -1
- data/lib/wallee-ruby-sdk/models/payment_terminal_receipt_type.rb +215 -0
- data/lib/wallee-ruby-sdk/models/permission.rb +14 -4
- data/lib/wallee-ruby-sdk/models/recurring_indicator.rb +37 -0
- data/lib/wallee-ruby-sdk/models/refund_bank_transaction.rb +1 -1
- data/lib/wallee-ruby-sdk/models/refund_recovery_bank_transaction.rb +1 -1
- data/lib/wallee-ruby-sdk/models/rendered_terminal_receipt.rb +26 -6
- data/lib/wallee-ruby-sdk/models/shopify_subscriber_active.rb +241 -0
- data/lib/wallee-ruby-sdk/models/shopify_subscription.rb +11 -1
- data/lib/wallee-ruby-sdk/models/shopify_subscription_creation_request.rb +11 -1
- data/lib/wallee-ruby-sdk/models/subscription_product_component.rb +1 -1
- data/lib/wallee-ruby-sdk/models/subscription_product_component_update.rb +1 -1
- data/lib/wallee-ruby-sdk/models/tax_calculation.rb +2 -2
- data/lib/wallee-ruby-sdk/models/terminal_receipt_fetch_request.rb +221 -0
- data/lib/wallee-ruby-sdk/models/terminal_receipt_format.rb +35 -0
- data/lib/wallee-ruby-sdk/models/tokenized_card_data.rb +211 -0
- data/lib/wallee-ruby-sdk/models/{unencrypted_card_data_create.rb → tokenized_card_data_create.rb} +60 -5
- data/lib/wallee-ruby-sdk/models/web_app_confirmation_request.rb +206 -0
- data/lib/wallee-ruby-sdk/models/web_app_confirmation_response.rb +231 -0
- data/lib/wallee-ruby-sdk/models/webhook_url.rb +11 -1
- data/lib/wallee-ruby-sdk/version.rb +1 -1
- metadata +24 -4
@@ -0,0 +1,241 @@
|
|
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 ShopifySubscriberActive
|
23
|
+
# The ID is the primary key of the entity. The ID identifies the entity uniquely.
|
24
|
+
attr_accessor :id
|
25
|
+
|
26
|
+
# The version number indicates the version of the entity. The version is incremented whenever the entity is changed.
|
27
|
+
attr_accessor :version
|
28
|
+
|
29
|
+
#
|
30
|
+
attr_accessor :email_address
|
31
|
+
|
32
|
+
# The external id helps to identify the entity and a subsequent creation of an entity with the same ID will not create a new entity.
|
33
|
+
attr_accessor :external_id
|
34
|
+
|
35
|
+
#
|
36
|
+
attr_accessor :phone_number
|
37
|
+
|
38
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
39
|
+
def self.attribute_map
|
40
|
+
{
|
41
|
+
:'id' => :'id',
|
42
|
+
:'version' => :'version',
|
43
|
+
:'email_address' => :'emailAddress',
|
44
|
+
:'external_id' => :'externalId',
|
45
|
+
:'phone_number' => :'phoneNumber'
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
# Attribute type mapping.
|
50
|
+
def self.swagger_types
|
51
|
+
{
|
52
|
+
:'id' => :'Integer',
|
53
|
+
:'version' => :'Integer',
|
54
|
+
:'email_address' => :'String',
|
55
|
+
:'external_id' => :'String',
|
56
|
+
:'phone_number' => :'String'
|
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?(:'version')
|
73
|
+
self.version = attributes[:'version']
|
74
|
+
end
|
75
|
+
|
76
|
+
if attributes.has_key?(:'emailAddress')
|
77
|
+
self.email_address = attributes[:'emailAddress']
|
78
|
+
end
|
79
|
+
|
80
|
+
if attributes.has_key?(:'externalId')
|
81
|
+
self.external_id = attributes[:'externalId']
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.has_key?(:'phoneNumber')
|
85
|
+
self.phone_number = attributes[:'phoneNumber']
|
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
|
+
if @id.nil?
|
94
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
95
|
+
end
|
96
|
+
|
97
|
+
if @version.nil?
|
98
|
+
invalid_properties.push('invalid value for "version", version cannot be nil.')
|
99
|
+
end
|
100
|
+
|
101
|
+
invalid_properties
|
102
|
+
end
|
103
|
+
|
104
|
+
# Check to see if the all the properties in the model are valid
|
105
|
+
# @return true if the model is valid
|
106
|
+
def valid?
|
107
|
+
return false if @id.nil?
|
108
|
+
return false if @version.nil?
|
109
|
+
true
|
110
|
+
end
|
111
|
+
|
112
|
+
# Checks equality by comparing each attribute.
|
113
|
+
# @param [Object] Object to be compared
|
114
|
+
def ==(o)
|
115
|
+
return true if self.equal?(o)
|
116
|
+
self.class == o.class &&
|
117
|
+
id == o.id &&
|
118
|
+
version == o.version &&
|
119
|
+
email_address == o.email_address &&
|
120
|
+
external_id == o.external_id &&
|
121
|
+
phone_number == o.phone_number
|
122
|
+
end
|
123
|
+
|
124
|
+
# @see the `==` method
|
125
|
+
# @param [Object] Object to be compared
|
126
|
+
def eql?(o)
|
127
|
+
self == o
|
128
|
+
end
|
129
|
+
|
130
|
+
# Calculates hash code according to all attributes.
|
131
|
+
# @return [Fixnum] Hash code
|
132
|
+
def hash
|
133
|
+
[id, version, email_address, external_id, phone_number].hash
|
134
|
+
end
|
135
|
+
|
136
|
+
# Builds the object from hash
|
137
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
138
|
+
# @return [Object] Returns the model itself
|
139
|
+
def build_from_hash(attributes)
|
140
|
+
return nil unless attributes.is_a?(Hash)
|
141
|
+
self.class.swagger_types.each_pair do |key, type|
|
142
|
+
if type =~ /\AArray<(.*)>/i
|
143
|
+
# check to ensure the input is an array given that the attribute
|
144
|
+
# is documented as an array but the input is not
|
145
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
146
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
147
|
+
end
|
148
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
149
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
150
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
151
|
+
end
|
152
|
+
|
153
|
+
self
|
154
|
+
end
|
155
|
+
|
156
|
+
# Deserializes the data based on type
|
157
|
+
# @param string type Data type
|
158
|
+
# @param string value Value to be deserialized
|
159
|
+
# @return [Object] Deserialized data
|
160
|
+
def _deserialize(type, value)
|
161
|
+
case type.to_sym
|
162
|
+
when :DateTime
|
163
|
+
DateTime.parse(value)
|
164
|
+
when :Date
|
165
|
+
Date.parse(value)
|
166
|
+
when :String
|
167
|
+
value.to_s
|
168
|
+
when :Integer
|
169
|
+
value.to_i
|
170
|
+
when :Float
|
171
|
+
value.to_f
|
172
|
+
when :BOOLEAN
|
173
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
174
|
+
true
|
175
|
+
else
|
176
|
+
false
|
177
|
+
end
|
178
|
+
when :Object
|
179
|
+
# generic object (usually a Hash), return directly
|
180
|
+
value
|
181
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
182
|
+
inner_type = Regexp.last_match[:inner_type]
|
183
|
+
value.map { |v| _deserialize(inner_type, v) }
|
184
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
185
|
+
k_type = Regexp.last_match[:k_type]
|
186
|
+
v_type = Regexp.last_match[:v_type]
|
187
|
+
{}.tap do |hash|
|
188
|
+
value.each do |k, v|
|
189
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
else # model
|
193
|
+
temp_model = Wallee.const_get(type).new
|
194
|
+
temp_model.build_from_hash(value)
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
# Returns the string representation of the object
|
199
|
+
# @return [String] String presentation of the object
|
200
|
+
def to_s
|
201
|
+
to_hash.to_s
|
202
|
+
end
|
203
|
+
|
204
|
+
# to_body is an alias to to_hash (backward compatibility)
|
205
|
+
# @return [Hash] Returns the object in the form of hash
|
206
|
+
def to_body
|
207
|
+
to_hash
|
208
|
+
end
|
209
|
+
|
210
|
+
# Returns the object in the form of hash
|
211
|
+
# @return [Hash] Returns the object in the form of hash
|
212
|
+
def to_hash
|
213
|
+
hash = {}
|
214
|
+
self.class.attribute_map.each_pair do |attr, param|
|
215
|
+
value = self.send(attr)
|
216
|
+
next if value.nil?
|
217
|
+
hash[param] = _to_hash(value)
|
218
|
+
end
|
219
|
+
hash
|
220
|
+
end
|
221
|
+
|
222
|
+
# Outputs non-array value in the form of hash
|
223
|
+
# For object, use to_hash. Otherwise, just return the value
|
224
|
+
# @param [Object] value Any valid value
|
225
|
+
# @return [Hash] Returns the value in the form of hash
|
226
|
+
def _to_hash(value)
|
227
|
+
if value.is_a?(Array)
|
228
|
+
value.compact.map{ |v| _to_hash(v) }
|
229
|
+
elsif value.is_a?(Hash)
|
230
|
+
{}.tap do |hash|
|
231
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
232
|
+
end
|
233
|
+
elsif value.respond_to? :to_hash
|
234
|
+
value.to_hash
|
235
|
+
else
|
236
|
+
value
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
end
|
241
|
+
end
|
@@ -32,6 +32,9 @@ module Wallee
|
|
32
32
|
# The ID is the primary key of the entity. The ID identifies the entity uniquely.
|
33
33
|
attr_accessor :id
|
34
34
|
|
35
|
+
#
|
36
|
+
attr_accessor :initial_execution_date
|
37
|
+
|
35
38
|
#
|
36
39
|
attr_accessor :initial_payment_transaction
|
37
40
|
|
@@ -75,6 +78,7 @@ module Wallee
|
|
75
78
|
:'created_on' => :'createdOn',
|
76
79
|
:'external_id' => :'externalId',
|
77
80
|
:'id' => :'id',
|
81
|
+
:'initial_execution_date' => :'initialExecutionDate',
|
78
82
|
:'initial_payment_transaction' => :'initialPaymentTransaction',
|
79
83
|
:'initial_shopify_transaction' => :'initialShopifyTransaction',
|
80
84
|
:'language' => :'language',
|
@@ -97,6 +101,7 @@ module Wallee
|
|
97
101
|
:'created_on' => :'DateTime',
|
98
102
|
:'external_id' => :'String',
|
99
103
|
:'id' => :'Integer',
|
104
|
+
:'initial_execution_date' => :'DateTime',
|
100
105
|
:'initial_payment_transaction' => :'Integer',
|
101
106
|
:'initial_shopify_transaction' => :'Integer',
|
102
107
|
:'language' => :'String',
|
@@ -136,6 +141,10 @@ module Wallee
|
|
136
141
|
self.id = attributes[:'id']
|
137
142
|
end
|
138
143
|
|
144
|
+
if attributes.has_key?(:'initialExecutionDate')
|
145
|
+
self.initial_execution_date = attributes[:'initialExecutionDate']
|
146
|
+
end
|
147
|
+
|
139
148
|
if attributes.has_key?(:'initialPaymentTransaction')
|
140
149
|
self.initial_payment_transaction = attributes[:'initialPaymentTransaction']
|
141
150
|
end
|
@@ -231,6 +240,7 @@ module Wallee
|
|
231
240
|
created_on == o.created_on &&
|
232
241
|
external_id == o.external_id &&
|
233
242
|
id == o.id &&
|
243
|
+
initial_execution_date == o.initial_execution_date &&
|
234
244
|
initial_payment_transaction == o.initial_payment_transaction &&
|
235
245
|
initial_shopify_transaction == o.initial_shopify_transaction &&
|
236
246
|
language == o.language &&
|
@@ -254,7 +264,7 @@ module Wallee
|
|
254
264
|
# Calculates hash code according to all attributes.
|
255
265
|
# @return [Fixnum] Hash code
|
256
266
|
def hash
|
257
|
-
[created_by, created_on, external_id, id, initial_payment_transaction, initial_shopify_transaction, language, linked_space_id, order_recurrence_number, shop, state, subscriber, terminated_by, terminated_on, termination_request_date, version].hash
|
267
|
+
[created_by, created_on, external_id, id, initial_execution_date, initial_payment_transaction, initial_shopify_transaction, language, linked_space_id, order_recurrence_number, shop, state, subscriber, terminated_by, terminated_on, termination_request_date, version].hash
|
258
268
|
end
|
259
269
|
|
260
270
|
# Builds the object from hash
|
@@ -32,6 +32,9 @@ module Wallee
|
|
32
32
|
# The external id helps to identify the entity and a subsequent creation of an entity with the same ID will not create a new entity.
|
33
33
|
attr_accessor :external_id
|
34
34
|
|
35
|
+
#
|
36
|
+
attr_accessor :initial_execution_date
|
37
|
+
|
35
38
|
#
|
36
39
|
attr_accessor :integration
|
37
40
|
|
@@ -66,6 +69,7 @@ module Wallee
|
|
66
69
|
:'billing_configuration' => :'billingConfiguration',
|
67
70
|
:'currency' => :'currency',
|
68
71
|
:'external_id' => :'externalId',
|
72
|
+
:'initial_execution_date' => :'initialExecutionDate',
|
69
73
|
:'integration' => :'integration',
|
70
74
|
:'items' => :'items',
|
71
75
|
:'language' => :'language',
|
@@ -85,6 +89,7 @@ module Wallee
|
|
85
89
|
:'billing_configuration' => :'ShopifySubscriptionModelBillingConfiguration',
|
86
90
|
:'currency' => :'String',
|
87
91
|
:'external_id' => :'String',
|
92
|
+
:'initial_execution_date' => :'DateTime',
|
88
93
|
:'integration' => :'Integer',
|
89
94
|
:'items' => :'Array<ShopifySubscriptionModelItem>',
|
90
95
|
:'language' => :'String',
|
@@ -121,6 +126,10 @@ module Wallee
|
|
121
126
|
self.external_id = attributes[:'externalId']
|
122
127
|
end
|
123
128
|
|
129
|
+
if attributes.has_key?(:'initialExecutionDate')
|
130
|
+
self.initial_execution_date = attributes[:'initialExecutionDate']
|
131
|
+
end
|
132
|
+
|
124
133
|
if attributes.has_key?(:'integration')
|
125
134
|
self.integration = attributes[:'integration']
|
126
135
|
end
|
@@ -222,6 +231,7 @@ module Wallee
|
|
222
231
|
billing_configuration == o.billing_configuration &&
|
223
232
|
currency == o.currency &&
|
224
233
|
external_id == o.external_id &&
|
234
|
+
initial_execution_date == o.initial_execution_date &&
|
225
235
|
integration == o.integration &&
|
226
236
|
items == o.items &&
|
227
237
|
language == o.language &&
|
@@ -242,7 +252,7 @@ module Wallee
|
|
242
252
|
# Calculates hash code according to all attributes.
|
243
253
|
# @return [Fixnum] Hash code
|
244
254
|
def hash
|
245
|
-
[billing_address, billing_configuration, currency, external_id, integration, items, language, shipping_address, shipping_method_name, space_view_id, store_order_confirmation_email_enabled, subscriber, subscriber_suspension_allowed].hash
|
255
|
+
[billing_address, billing_configuration, currency, external_id, initial_execution_date, integration, items, language, shipping_address, shipping_method_name, space_view_id, store_order_confirmation_email_enabled, subscriber, subscriber_suspension_allowed].hash
|
246
256
|
end
|
247
257
|
|
248
258
|
# Builds the object from hash
|
@@ -26,7 +26,7 @@ module Wallee
|
|
26
26
|
#
|
27
27
|
attr_accessor :component_group
|
28
28
|
|
29
|
-
# When a component is marked as a 'default' component it is used
|
29
|
+
# When a component is marked as a 'default' component it is used as the default component in its group and will be preselected in the product configuration.
|
30
30
|
attr_accessor :default_component
|
31
31
|
|
32
32
|
# The component description may contain a longer description which gives the subscriber a better understanding of what the component contains.
|
@@ -32,7 +32,7 @@ module Wallee
|
|
32
32
|
#
|
33
33
|
attr_accessor :component_group
|
34
34
|
|
35
|
-
# When a component is marked as a 'default' component it is used
|
35
|
+
# When a component is marked as a 'default' component it is used as the default component in its group and will be preselected in the product configuration.
|
36
36
|
attr_accessor :default_component
|
37
37
|
|
38
38
|
# The component description may contain a longer description which gives the subscriber a better understanding of what the component contains.
|
@@ -20,8 +20,8 @@ require 'date'
|
|
20
20
|
module Wallee
|
21
21
|
class TaxCalculation
|
22
22
|
|
23
|
-
|
24
|
-
|
23
|
+
TAX_INCLUDED = 'TAX_INCLUDED'.freeze
|
24
|
+
TAX_NOT_INCLUDED = 'TAX_NOT_INCLUDED'.freeze
|
25
25
|
|
26
26
|
# Builds the enum from string
|
27
27
|
# @param [String] The enum value in the form of the string
|
@@ -0,0 +1,221 @@
|
|
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
|
+
# The receipt fetch request allows to retrieve the receipt documents for a terminal transaction.
|
22
|
+
class TerminalReceiptFetchRequest
|
23
|
+
# The format determines in what format the receipts will be returned in.
|
24
|
+
attr_accessor :format
|
25
|
+
|
26
|
+
# Provide here the ID of the transaction for which the receipts should be fetched.
|
27
|
+
attr_accessor :transaction
|
28
|
+
|
29
|
+
# The width controls how width the document will be rendered. In case of the PDF format the width is in mm. In case of the text format the width is in the number of chars per line.
|
30
|
+
attr_accessor :width
|
31
|
+
|
32
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
33
|
+
def self.attribute_map
|
34
|
+
{
|
35
|
+
:'format' => :'format',
|
36
|
+
:'transaction' => :'transaction',
|
37
|
+
:'width' => :'width'
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
# Attribute type mapping.
|
42
|
+
def self.swagger_types
|
43
|
+
{
|
44
|
+
:'format' => :'TerminalReceiptFormat',
|
45
|
+
:'transaction' => :'Integer',
|
46
|
+
:'width' => :'Integer'
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
# Initializes the object
|
51
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
52
|
+
def initialize(attributes = {})
|
53
|
+
return unless attributes.is_a?(Hash)
|
54
|
+
|
55
|
+
# convert string to symbol for hash key
|
56
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
57
|
+
|
58
|
+
if attributes.has_key?(:'format')
|
59
|
+
self.format = attributes[:'format']
|
60
|
+
end
|
61
|
+
|
62
|
+
if attributes.has_key?(:'transaction')
|
63
|
+
self.transaction = attributes[:'transaction']
|
64
|
+
end
|
65
|
+
|
66
|
+
if attributes.has_key?(:'width')
|
67
|
+
self.width = attributes[:'width']
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
72
|
+
# @return Array for valid properties with the reasons
|
73
|
+
def list_invalid_properties
|
74
|
+
invalid_properties = Array.new
|
75
|
+
if @format.nil?
|
76
|
+
invalid_properties.push('invalid value for "format", format cannot be nil.')
|
77
|
+
end
|
78
|
+
|
79
|
+
if @transaction.nil?
|
80
|
+
invalid_properties.push('invalid value for "transaction", transaction cannot be nil.')
|
81
|
+
end
|
82
|
+
|
83
|
+
invalid_properties
|
84
|
+
end
|
85
|
+
|
86
|
+
# Check to see if the all the properties in the model are valid
|
87
|
+
# @return true if the model is valid
|
88
|
+
def valid?
|
89
|
+
return false if @format.nil?
|
90
|
+
return false if @transaction.nil?
|
91
|
+
true
|
92
|
+
end
|
93
|
+
|
94
|
+
# Checks equality by comparing each attribute.
|
95
|
+
# @param [Object] Object to be compared
|
96
|
+
def ==(o)
|
97
|
+
return true if self.equal?(o)
|
98
|
+
self.class == o.class &&
|
99
|
+
format == o.format &&
|
100
|
+
transaction == o.transaction &&
|
101
|
+
width == o.width
|
102
|
+
end
|
103
|
+
|
104
|
+
# @see the `==` method
|
105
|
+
# @param [Object] Object to be compared
|
106
|
+
def eql?(o)
|
107
|
+
self == o
|
108
|
+
end
|
109
|
+
|
110
|
+
# Calculates hash code according to all attributes.
|
111
|
+
# @return [Fixnum] Hash code
|
112
|
+
def hash
|
113
|
+
[format, transaction, width].hash
|
114
|
+
end
|
115
|
+
|
116
|
+
# Builds the object from hash
|
117
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
118
|
+
# @return [Object] Returns the model itself
|
119
|
+
def build_from_hash(attributes)
|
120
|
+
return nil unless attributes.is_a?(Hash)
|
121
|
+
self.class.swagger_types.each_pair do |key, type|
|
122
|
+
if type =~ /\AArray<(.*)>/i
|
123
|
+
# check to ensure the input is an array given that the attribute
|
124
|
+
# is documented as an array but the input is not
|
125
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
126
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
127
|
+
end
|
128
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
129
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
130
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
131
|
+
end
|
132
|
+
|
133
|
+
self
|
134
|
+
end
|
135
|
+
|
136
|
+
# Deserializes the data based on type
|
137
|
+
# @param string type Data type
|
138
|
+
# @param string value Value to be deserialized
|
139
|
+
# @return [Object] Deserialized data
|
140
|
+
def _deserialize(type, value)
|
141
|
+
case type.to_sym
|
142
|
+
when :DateTime
|
143
|
+
DateTime.parse(value)
|
144
|
+
when :Date
|
145
|
+
Date.parse(value)
|
146
|
+
when :String
|
147
|
+
value.to_s
|
148
|
+
when :Integer
|
149
|
+
value.to_i
|
150
|
+
when :Float
|
151
|
+
value.to_f
|
152
|
+
when :BOOLEAN
|
153
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
154
|
+
true
|
155
|
+
else
|
156
|
+
false
|
157
|
+
end
|
158
|
+
when :Object
|
159
|
+
# generic object (usually a Hash), return directly
|
160
|
+
value
|
161
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
162
|
+
inner_type = Regexp.last_match[:inner_type]
|
163
|
+
value.map { |v| _deserialize(inner_type, v) }
|
164
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
165
|
+
k_type = Regexp.last_match[:k_type]
|
166
|
+
v_type = Regexp.last_match[:v_type]
|
167
|
+
{}.tap do |hash|
|
168
|
+
value.each do |k, v|
|
169
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
else # model
|
173
|
+
temp_model = Wallee.const_get(type).new
|
174
|
+
temp_model.build_from_hash(value)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
# Returns the string representation of the object
|
179
|
+
# @return [String] String presentation of the object
|
180
|
+
def to_s
|
181
|
+
to_hash.to_s
|
182
|
+
end
|
183
|
+
|
184
|
+
# to_body is an alias to to_hash (backward compatibility)
|
185
|
+
# @return [Hash] Returns the object in the form of hash
|
186
|
+
def to_body
|
187
|
+
to_hash
|
188
|
+
end
|
189
|
+
|
190
|
+
# Returns the object in the form of hash
|
191
|
+
# @return [Hash] Returns the object in the form of hash
|
192
|
+
def to_hash
|
193
|
+
hash = {}
|
194
|
+
self.class.attribute_map.each_pair do |attr, param|
|
195
|
+
value = self.send(attr)
|
196
|
+
next if value.nil?
|
197
|
+
hash[param] = _to_hash(value)
|
198
|
+
end
|
199
|
+
hash
|
200
|
+
end
|
201
|
+
|
202
|
+
# Outputs non-array value in the form of hash
|
203
|
+
# For object, use to_hash. Otherwise, just return the value
|
204
|
+
# @param [Object] value Any valid value
|
205
|
+
# @return [Hash] Returns the value in the form of hash
|
206
|
+
def _to_hash(value)
|
207
|
+
if value.is_a?(Array)
|
208
|
+
value.compact.map{ |v| _to_hash(v) }
|
209
|
+
elsif value.is_a?(Hash)
|
210
|
+
{}.tap do |hash|
|
211
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
212
|
+
end
|
213
|
+
elsif value.respond_to? :to_hash
|
214
|
+
value.to_hash
|
215
|
+
else
|
216
|
+
value
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
end
|
221
|
+
end
|