wallee-ruby-sdk 2.2.3 → 2.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +1 -1
  4. data/lib/wallee-ruby-sdk.rb +17 -5
  5. data/lib/wallee-ruby-sdk/api/payment_terminal_till_service_api.rb +99 -0
  6. data/lib/wallee-ruby-sdk/api/shopify_subscription_service_api.rb +124 -0
  7. data/lib/wallee-ruby-sdk/api/shopify_transaction_service_api.rb +213 -0
  8. data/lib/wallee-ruby-sdk/api/subscriber_service_api.rb +3 -3
  9. data/lib/wallee-ruby-sdk/api/subscription_service_api.rb +67 -0
  10. data/lib/wallee-ruby-sdk/api/token_service_api.rb +126 -0
  11. data/lib/wallee-ruby-sdk/api_client.rb +5 -3
  12. data/lib/wallee-ruby-sdk/configuration.rb +2 -2
  13. data/lib/wallee-ruby-sdk/models/abstract_account_update.rb +11 -1
  14. data/lib/wallee-ruby-sdk/models/{abstract_shopify_subscription_product_active.rb → abstract_shopify_subscription_product_update.rb} +2 -12
  15. data/lib/wallee-ruby-sdk/models/abstract_space_update.rb +11 -1
  16. data/lib/wallee-ruby-sdk/models/abstract_transaction_pending.rb +59 -1
  17. data/lib/wallee-ruby-sdk/models/abstract_webhook_url_update.rb +24 -0
  18. data/lib/wallee-ruby-sdk/models/account.rb +31 -1
  19. data/lib/wallee-ruby-sdk/models/account_create.rb +11 -1
  20. data/lib/wallee-ruby-sdk/models/account_update.rb +11 -1
  21. data/lib/wallee-ruby-sdk/models/charge_attempt.rb +11 -1
  22. data/lib/wallee-ruby-sdk/models/payment_connector_configuration.rb +13 -1
  23. data/lib/wallee-ruby-sdk/models/sales_channel.rb +34 -4
  24. data/lib/wallee-ruby-sdk/models/shopify_additional_line_item_data.rb +35 -0
  25. data/lib/wallee-ruby-sdk/models/shopify_integration.rb +73 -31
  26. data/lib/wallee-ruby-sdk/models/shopify_integration_payment_app_version.rb +34 -0
  27. data/lib/wallee-ruby-sdk/models/{shopify_integration_app_version.rb → shopify_integration_subscription_app_version.rb} +3 -3
  28. data/lib/wallee-ruby-sdk/models/shopify_subscriber_creation.rb +216 -0
  29. data/lib/wallee-ruby-sdk/models/shopify_subscription.rb +51 -7
  30. data/lib/wallee-ruby-sdk/models/shopify_subscription_address.rb +0 -60
  31. data/lib/wallee-ruby-sdk/models/shopify_subscription_address_create.rb +546 -0
  32. data/lib/wallee-ruby-sdk/models/shopify_subscription_creation_request.rb +353 -0
  33. data/lib/wallee-ruby-sdk/models/shopify_subscription_model_billing_configuration.rb +261 -0
  34. data/lib/wallee-ruby-sdk/models/{shopify_subscription_edit_model_item.rb → shopify_subscription_model_item.rb} +2 -2
  35. data/lib/wallee-ruby-sdk/models/{shopify_subscription_edit_model_tax_line.rb → shopify_subscription_model_tax_line.rb} +1 -1
  36. data/lib/wallee-ruby-sdk/models/shopify_subscription_product_create.rb +9 -14
  37. data/lib/wallee-ruby-sdk/models/{shopify_subscription_product_active.rb → shopify_subscription_product_update.rb} +2 -12
  38. data/lib/wallee-ruby-sdk/models/shopify_subscription_update_addresses_request.rb +211 -0
  39. data/lib/wallee-ruby-sdk/models/shopify_subscription_update_request.rb +11 -81
  40. data/lib/wallee-ruby-sdk/models/space.rb +31 -1
  41. data/lib/wallee-ruby-sdk/models/space_create.rb +11 -1
  42. data/lib/wallee-ruby-sdk/models/space_update.rb +11 -1
  43. data/lib/wallee-ruby-sdk/models/subscription.rb +11 -1
  44. data/lib/wallee-ruby-sdk/models/subscription_charge.rb +48 -0
  45. data/lib/wallee-ruby-sdk/models/subscription_charge_create.rb +48 -0
  46. data/lib/wallee-ruby-sdk/models/subscription_create_request.rb +1 -1
  47. data/lib/wallee-ruby-sdk/models/subscription_product_version.rb +11 -1
  48. data/lib/wallee-ruby-sdk/models/subscription_product_version_pending.rb +14 -4
  49. data/lib/wallee-ruby-sdk/models/subscription_update_request.rb +206 -0
  50. data/lib/wallee-ruby-sdk/models/tax_calculation.rb +35 -0
  51. data/lib/wallee-ruby-sdk/models/transaction.rb +69 -1
  52. data/lib/wallee-ruby-sdk/models/transaction_completion.rb +26 -1
  53. data/lib/wallee-ruby-sdk/models/transaction_completion_behavior.rb +36 -0
  54. data/lib/wallee-ruby-sdk/models/transaction_completion_request.rb +26 -1
  55. data/lib/wallee-ruby-sdk/models/transaction_create.rb +59 -1
  56. data/lib/wallee-ruby-sdk/models/transaction_pending.rb +59 -1
  57. data/lib/wallee-ruby-sdk/models/webhook_url.rb +24 -0
  58. data/lib/wallee-ruby-sdk/models/webhook_url_create.rb +24 -0
  59. data/lib/wallee-ruby-sdk/models/webhook_url_update.rb +24 -0
  60. data/lib/wallee-ruby-sdk/version.rb +1 -1
  61. data/wallee-ruby-sdk.gemspec +3 -2
  62. metadata +45 -14
@@ -23,18 +23,30 @@ module Wallee
23
23
  #
24
24
  attr_accessor :description
25
25
 
26
+ #
27
+ attr_accessor :icon
28
+
26
29
  # The ID is the primary key of the entity. The ID identifies the entity uniquely.
27
30
  attr_accessor :id
28
31
 
29
32
  #
30
33
  attr_accessor :name
31
34
 
35
+ #
36
+ attr_accessor :parent
37
+
38
+ #
39
+ attr_accessor :sort_order
40
+
32
41
  # Attribute mapping from ruby-style variable name to JSON key.
33
42
  def self.attribute_map
34
43
  {
35
44
  :'description' => :'description',
45
+ :'icon' => :'icon',
36
46
  :'id' => :'id',
37
- :'name' => :'name'
47
+ :'name' => :'name',
48
+ :'parent' => :'parent',
49
+ :'sort_order' => :'sortOrder'
38
50
  }
39
51
  end
40
52
 
@@ -42,8 +54,11 @@ module Wallee
42
54
  def self.swagger_types
43
55
  {
44
56
  :'description' => :'Hash<String, String>',
57
+ :'icon' => :'String',
45
58
  :'id' => :'Integer',
46
- :'name' => :'Hash<String, String>'
59
+ :'name' => :'Hash<String, String>',
60
+ :'parent' => :'SalesChannel',
61
+ :'sort_order' => :'Integer'
47
62
  }
48
63
  end
49
64
 
@@ -61,6 +76,10 @@ module Wallee
61
76
  end
62
77
  end
63
78
 
79
+ if attributes.has_key?(:'icon')
80
+ self.icon = attributes[:'icon']
81
+ end
82
+
64
83
  if attributes.has_key?(:'id')
65
84
  self.id = attributes[:'id']
66
85
  end
@@ -70,6 +89,14 @@ module Wallee
70
89
  self.name = value
71
90
  end
72
91
  end
92
+
93
+ if attributes.has_key?(:'parent')
94
+ self.parent = attributes[:'parent']
95
+ end
96
+
97
+ if attributes.has_key?(:'sortOrder')
98
+ self.sort_order = attributes[:'sortOrder']
99
+ end
73
100
  end
74
101
 
75
102
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -91,8 +118,11 @@ module Wallee
91
118
  return true if self.equal?(o)
92
119
  self.class == o.class &&
93
120
  description == o.description &&
121
+ icon == o.icon &&
94
122
  id == o.id &&
95
- name == o.name
123
+ name == o.name &&
124
+ parent == o.parent &&
125
+ sort_order == o.sort_order
96
126
  end
97
127
 
98
128
  # @see the `==` method
@@ -104,7 +134,7 @@ module Wallee
104
134
  # Calculates hash code according to all attributes.
105
135
  # @return [Fixnum] Hash code
106
136
  def hash
107
- [description, id, name].hash
137
+ [description, icon, id, name, parent, sort_order].hash
108
138
  end
109
139
 
110
140
  # Builds the object from hash
@@ -0,0 +1,35 @@
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 ShopifyAdditionalLineItemData
22
+
23
+ VENDOR = 'VENDOR'.freeze
24
+ WEIGHT = 'WEIGHT'.freeze
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def build_from_hash(value)
30
+ constantValues = ShopifyAdditionalLineItemData.constants.select { |c| ShopifyAdditionalLineItemData::const_get(c) == value }
31
+ raise "Invalid ENUM value #{value} for class #ShopifyAdditionalLineItemData" if constantValues.empty?
32
+ value
33
+ end
34
+ end
35
+ end
@@ -21,13 +21,13 @@ module Wallee
21
21
  # A Shopify Integration allows to connect a Shopify shop.
22
22
  class ShopifyIntegration
23
23
  #
24
- attr_accessor :allow_invoice_download
24
+ attr_accessor :additional_line_item_data
25
25
 
26
26
  #
27
- attr_accessor :allowed_payment_method_configurations
27
+ attr_accessor :allow_invoice_download
28
28
 
29
29
  #
30
- attr_accessor :app_version
30
+ attr_accessor :allowed_payment_method_configurations
31
31
 
32
32
  #
33
33
  attr_accessor :currency
@@ -35,9 +35,6 @@ module Wallee
35
35
  # The ID is the primary key of the entity. The ID identifies the entity uniquely.
36
36
  attr_accessor :id
37
37
 
38
- #
39
- attr_accessor :installed
40
-
41
38
  # Enabling the integrated payment form will embed the payment form in the Shopify shop. The app needs to be installed for this to be possible.
42
39
  attr_accessor :integrated_payment_form_enabled
43
40
 
@@ -50,11 +47,17 @@ module Wallee
50
47
  # The integration name is used internally to identify a specific integration.For example the name is used withinsearch fields and hence it should be distinct and descriptive.
51
48
  attr_accessor :name
52
49
 
53
- # The planned purge date indicates when the entity is permanently removed. When the date is null the entity is not planned to be removed.
54
- attr_accessor :planned_purge_date
50
+ #
51
+ attr_accessor :payment_app_version
52
+
53
+ #
54
+ attr_accessor :payment_installed
55
55
 
56
56
  # Define the path of the proxy URL. This only needs to be changed if the apps proxy URL is overwritten in the Shopify store.
57
- attr_accessor :proxy_path
57
+ attr_accessor :payment_proxy_path
58
+
59
+ # The planned purge date indicates when the entity is permanently removed. When the date is null the entity is not planned to be removed.
60
+ attr_accessor :planned_purge_date
58
61
 
59
62
  #
60
63
  attr_accessor :replace_payment_method_image
@@ -77,24 +80,34 @@ module Wallee
77
80
  #
78
81
  attr_accessor :state
79
82
 
83
+ #
84
+ attr_accessor :subscription_app_version
85
+
86
+ #
87
+ attr_accessor :subscription_installed
88
+
89
+ # Define the path of the proxy URL. This only needs to be changed if the apps proxy URL is overwritten in the Shopify store.
90
+ attr_accessor :subscription_proxy_path
91
+
80
92
  # The version number indicates the version of the entity. The version is incremented whenever the entity is changed.
81
93
  attr_accessor :version
82
94
 
83
95
  # Attribute mapping from ruby-style variable name to JSON key.
84
96
  def self.attribute_map
85
97
  {
98
+ :'additional_line_item_data' => :'additionalLineItemData',
86
99
  :'allow_invoice_download' => :'allowInvoiceDownload',
87
100
  :'allowed_payment_method_configurations' => :'allowedPaymentMethodConfigurations',
88
- :'app_version' => :'appVersion',
89
101
  :'currency' => :'currency',
90
102
  :'id' => :'id',
91
- :'installed' => :'installed',
92
103
  :'integrated_payment_form_enabled' => :'integratedPaymentFormEnabled',
93
104
  :'language' => :'language',
94
105
  :'login_name' => :'loginName',
95
106
  :'name' => :'name',
107
+ :'payment_app_version' => :'paymentAppVersion',
108
+ :'payment_installed' => :'paymentInstalled',
109
+ :'payment_proxy_path' => :'paymentProxyPath',
96
110
  :'planned_purge_date' => :'plannedPurgeDate',
97
- :'proxy_path' => :'proxyPath',
98
111
  :'replace_payment_method_image' => :'replacePaymentMethodImage',
99
112
  :'shop_name' => :'shopName',
100
113
  :'show_payment_information' => :'showPaymentInformation',
@@ -102,6 +115,9 @@ module Wallee
102
115
  :'space_id' => :'spaceId',
103
116
  :'space_view_id' => :'spaceViewId',
104
117
  :'state' => :'state',
118
+ :'subscription_app_version' => :'subscriptionAppVersion',
119
+ :'subscription_installed' => :'subscriptionInstalled',
120
+ :'subscription_proxy_path' => :'subscriptionProxyPath',
105
121
  :'version' => :'version'
106
122
  }
107
123
  end
@@ -109,18 +125,19 @@ module Wallee
109
125
  # Attribute type mapping.
110
126
  def self.swagger_types
111
127
  {
128
+ :'additional_line_item_data' => :'Array<ShopifyAdditionalLineItemData>',
112
129
  :'allow_invoice_download' => :'BOOLEAN',
113
130
  :'allowed_payment_method_configurations' => :'Array<PaymentMethodConfiguration>',
114
- :'app_version' => :'ShopifyIntegrationAppVersion',
115
131
  :'currency' => :'String',
116
132
  :'id' => :'Integer',
117
- :'installed' => :'BOOLEAN',
118
133
  :'integrated_payment_form_enabled' => :'BOOLEAN',
119
134
  :'language' => :'String',
120
135
  :'login_name' => :'String',
121
136
  :'name' => :'String',
137
+ :'payment_app_version' => :'ShopifyIntegrationPaymentAppVersion',
138
+ :'payment_installed' => :'BOOLEAN',
139
+ :'payment_proxy_path' => :'String',
122
140
  :'planned_purge_date' => :'DateTime',
123
- :'proxy_path' => :'String',
124
141
  :'replace_payment_method_image' => :'BOOLEAN',
125
142
  :'shop_name' => :'String',
126
143
  :'show_payment_information' => :'BOOLEAN',
@@ -128,6 +145,9 @@ module Wallee
128
145
  :'space_id' => :'Integer',
129
146
  :'space_view_id' => :'Integer',
130
147
  :'state' => :'CreationEntityState',
148
+ :'subscription_app_version' => :'ShopifyIntegrationSubscriptionAppVersion',
149
+ :'subscription_installed' => :'BOOLEAN',
150
+ :'subscription_proxy_path' => :'String',
131
151
  :'version' => :'Integer'
132
152
  }
133
153
  end
@@ -140,6 +160,12 @@ module Wallee
140
160
  # convert string to symbol for hash key
141
161
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
142
162
 
163
+ if attributes.has_key?(:'additionalLineItemData')
164
+ if (value = attributes[:'additionalLineItemData']).is_a?(Array)
165
+ self.additional_line_item_data = value
166
+ end
167
+ end
168
+
143
169
  if attributes.has_key?(:'allowInvoiceDownload')
144
170
  self.allow_invoice_download = attributes[:'allowInvoiceDownload']
145
171
  end
@@ -150,10 +176,6 @@ module Wallee
150
176
  end
151
177
  end
152
178
 
153
- if attributes.has_key?(:'appVersion')
154
- self.app_version = attributes[:'appVersion']
155
- end
156
-
157
179
  if attributes.has_key?(:'currency')
158
180
  self.currency = attributes[:'currency']
159
181
  end
@@ -162,10 +184,6 @@ module Wallee
162
184
  self.id = attributes[:'id']
163
185
  end
164
186
 
165
- if attributes.has_key?(:'installed')
166
- self.installed = attributes[:'installed']
167
- end
168
-
169
187
  if attributes.has_key?(:'integratedPaymentFormEnabled')
170
188
  self.integrated_payment_form_enabled = attributes[:'integratedPaymentFormEnabled']
171
189
  end
@@ -182,12 +200,20 @@ module Wallee
182
200
  self.name = attributes[:'name']
183
201
  end
184
202
 
185
- if attributes.has_key?(:'plannedPurgeDate')
186
- self.planned_purge_date = attributes[:'plannedPurgeDate']
203
+ if attributes.has_key?(:'paymentAppVersion')
204
+ self.payment_app_version = attributes[:'paymentAppVersion']
205
+ end
206
+
207
+ if attributes.has_key?(:'paymentInstalled')
208
+ self.payment_installed = attributes[:'paymentInstalled']
187
209
  end
188
210
 
189
- if attributes.has_key?(:'proxyPath')
190
- self.proxy_path = attributes[:'proxyPath']
211
+ if attributes.has_key?(:'paymentProxyPath')
212
+ self.payment_proxy_path = attributes[:'paymentProxyPath']
213
+ end
214
+
215
+ if attributes.has_key?(:'plannedPurgeDate')
216
+ self.planned_purge_date = attributes[:'plannedPurgeDate']
191
217
  end
192
218
 
193
219
  if attributes.has_key?(:'replacePaymentMethodImage')
@@ -218,6 +244,18 @@ module Wallee
218
244
  self.state = attributes[:'state']
219
245
  end
220
246
 
247
+ if attributes.has_key?(:'subscriptionAppVersion')
248
+ self.subscription_app_version = attributes[:'subscriptionAppVersion']
249
+ end
250
+
251
+ if attributes.has_key?(:'subscriptionInstalled')
252
+ self.subscription_installed = attributes[:'subscriptionInstalled']
253
+ end
254
+
255
+ if attributes.has_key?(:'subscriptionProxyPath')
256
+ self.subscription_proxy_path = attributes[:'subscriptionProxyPath']
257
+ end
258
+
221
259
  if attributes.has_key?(:'version')
222
260
  self.version = attributes[:'version']
223
261
  end
@@ -286,18 +324,19 @@ module Wallee
286
324
  def ==(o)
287
325
  return true if self.equal?(o)
288
326
  self.class == o.class &&
327
+ additional_line_item_data == o.additional_line_item_data &&
289
328
  allow_invoice_download == o.allow_invoice_download &&
290
329
  allowed_payment_method_configurations == o.allowed_payment_method_configurations &&
291
- app_version == o.app_version &&
292
330
  currency == o.currency &&
293
331
  id == o.id &&
294
- installed == o.installed &&
295
332
  integrated_payment_form_enabled == o.integrated_payment_form_enabled &&
296
333
  language == o.language &&
297
334
  login_name == o.login_name &&
298
335
  name == o.name &&
336
+ payment_app_version == o.payment_app_version &&
337
+ payment_installed == o.payment_installed &&
338
+ payment_proxy_path == o.payment_proxy_path &&
299
339
  planned_purge_date == o.planned_purge_date &&
300
- proxy_path == o.proxy_path &&
301
340
  replace_payment_method_image == o.replace_payment_method_image &&
302
341
  shop_name == o.shop_name &&
303
342
  show_payment_information == o.show_payment_information &&
@@ -305,6 +344,9 @@ module Wallee
305
344
  space_id == o.space_id &&
306
345
  space_view_id == o.space_view_id &&
307
346
  state == o.state &&
347
+ subscription_app_version == o.subscription_app_version &&
348
+ subscription_installed == o.subscription_installed &&
349
+ subscription_proxy_path == o.subscription_proxy_path &&
308
350
  version == o.version
309
351
  end
310
352
 
@@ -317,7 +359,7 @@ module Wallee
317
359
  # Calculates hash code according to all attributes.
318
360
  # @return [Fixnum] Hash code
319
361
  def hash
320
- [allow_invoice_download, allowed_payment_method_configurations, app_version, currency, id, installed, integrated_payment_form_enabled, language, login_name, name, planned_purge_date, proxy_path, replace_payment_method_image, shop_name, show_payment_information, show_subscription_information, space_id, space_view_id, state, version].hash
362
+ [additional_line_item_data, allow_invoice_download, allowed_payment_method_configurations, currency, id, integrated_payment_form_enabled, language, login_name, name, payment_app_version, payment_installed, payment_proxy_path, planned_purge_date, replace_payment_method_image, shop_name, show_payment_information, show_subscription_information, space_id, space_view_id, state, subscription_app_version, subscription_installed, subscription_proxy_path, version].hash
321
363
  end
322
364
 
323
365
  # Builds the object from hash
@@ -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 ShopifyIntegrationPaymentAppVersion
22
+
23
+ API_2019_07 = 'API_2019_07'.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 = ShopifyIntegrationPaymentAppVersion.constants.select { |c| ShopifyIntegrationPaymentAppVersion::const_get(c) == value }
30
+ raise "Invalid ENUM value #{value} for class #ShopifyIntegrationPaymentAppVersion" if constantValues.empty?
31
+ value
32
+ end
33
+ end
34
+ end
@@ -18,7 +18,7 @@ limitations under the License.
18
18
  require 'date'
19
19
 
20
20
  module Wallee
21
- class ShopifyIntegrationAppVersion
21
+ class ShopifyIntegrationSubscriptionAppVersion
22
22
 
23
23
  BASIC = 'BASIC'.freeze
24
24
  SUBSCRIPTION = 'SUBSCRIPTION'.freeze
@@ -28,8 +28,8 @@ module Wallee
28
28
  # @param [String] The enum value in the form of the string
29
29
  # @return [String] The enum value
30
30
  def build_from_hash(value)
31
- constantValues = ShopifyIntegrationAppVersion.constants.select { |c| ShopifyIntegrationAppVersion::const_get(c) == value }
32
- raise "Invalid ENUM value #{value} for class #ShopifyIntegrationAppVersion" if constantValues.empty?
31
+ constantValues = ShopifyIntegrationSubscriptionAppVersion.constants.select { |c| ShopifyIntegrationSubscriptionAppVersion::const_get(c) == value }
32
+ raise "Invalid ENUM value #{value} for class #ShopifyIntegrationSubscriptionAppVersion" if constantValues.empty?
33
33
  value
34
34
  end
35
35
  end
@@ -0,0 +1,216 @@
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 ShopifySubscriberCreation
23
+ #
24
+ attr_accessor :email_address
25
+
26
+ #
27
+ attr_accessor :phone_number
28
+
29
+ # The customer ID has to correspond to the ID assigned to the customer by Shopify. When the subscriber already exists no new subscriber will be created.
30
+ attr_accessor :shopify_customer_id
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'email_address' => :'emailAddress',
36
+ :'phone_number' => :'phoneNumber',
37
+ :'shopify_customer_id' => :'shopifyCustomerId'
38
+ }
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.swagger_types
43
+ {
44
+ :'email_address' => :'String',
45
+ :'phone_number' => :'String',
46
+ :'shopify_customer_id' => :'String'
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?(:'emailAddress')
59
+ self.email_address = attributes[:'emailAddress']
60
+ end
61
+
62
+ if attributes.has_key?(:'phoneNumber')
63
+ self.phone_number = attributes[:'phoneNumber']
64
+ end
65
+
66
+ if attributes.has_key?(:'shopifyCustomerId')
67
+ self.shopify_customer_id = attributes[:'shopifyCustomerId']
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 @shopify_customer_id.nil?
76
+ invalid_properties.push('invalid value for "shopify_customer_id", shopify_customer_id cannot be nil.')
77
+ end
78
+
79
+ invalid_properties
80
+ end
81
+
82
+ # Check to see if the all the properties in the model are valid
83
+ # @return true if the model is valid
84
+ def valid?
85
+ return false if @shopify_customer_id.nil?
86
+ true
87
+ end
88
+
89
+ # Checks equality by comparing each attribute.
90
+ # @param [Object] Object to be compared
91
+ def ==(o)
92
+ return true if self.equal?(o)
93
+ self.class == o.class &&
94
+ email_address == o.email_address &&
95
+ phone_number == o.phone_number &&
96
+ shopify_customer_id == o.shopify_customer_id
97
+ end
98
+
99
+ # @see the `==` method
100
+ # @param [Object] Object to be compared
101
+ def eql?(o)
102
+ self == o
103
+ end
104
+
105
+ # Calculates hash code according to all attributes.
106
+ # @return [Fixnum] Hash code
107
+ def hash
108
+ [email_address, phone_number, shopify_customer_id].hash
109
+ end
110
+
111
+ # Builds the object from hash
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ # @return [Object] Returns the model itself
114
+ def build_from_hash(attributes)
115
+ return nil unless attributes.is_a?(Hash)
116
+ self.class.swagger_types.each_pair do |key, type|
117
+ if type =~ /\AArray<(.*)>/i
118
+ # check to ensure the input is an array given that the attribute
119
+ # is documented as an array but the input is not
120
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
121
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
122
+ end
123
+ elsif !attributes[self.class.attribute_map[key]].nil?
124
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
125
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
126
+ end
127
+
128
+ self
129
+ end
130
+
131
+ # Deserializes the data based on type
132
+ # @param string type Data type
133
+ # @param string value Value to be deserialized
134
+ # @return [Object] Deserialized data
135
+ def _deserialize(type, value)
136
+ case type.to_sym
137
+ when :DateTime
138
+ DateTime.parse(value)
139
+ when :Date
140
+ Date.parse(value)
141
+ when :String
142
+ value.to_s
143
+ when :Integer
144
+ value.to_i
145
+ when :Float
146
+ value.to_f
147
+ when :BOOLEAN
148
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
149
+ true
150
+ else
151
+ false
152
+ end
153
+ when :Object
154
+ # generic object (usually a Hash), return directly
155
+ value
156
+ when /\AArray<(?<inner_type>.+)>\z/
157
+ inner_type = Regexp.last_match[:inner_type]
158
+ value.map { |v| _deserialize(inner_type, v) }
159
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
160
+ k_type = Regexp.last_match[:k_type]
161
+ v_type = Regexp.last_match[:v_type]
162
+ {}.tap do |hash|
163
+ value.each do |k, v|
164
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
165
+ end
166
+ end
167
+ else # model
168
+ temp_model = Wallee.const_get(type).new
169
+ temp_model.build_from_hash(value)
170
+ end
171
+ end
172
+
173
+ # Returns the string representation of the object
174
+ # @return [String] String presentation of the object
175
+ def to_s
176
+ to_hash.to_s
177
+ end
178
+
179
+ # to_body is an alias to to_hash (backward compatibility)
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_body
182
+ to_hash
183
+ end
184
+
185
+ # Returns the object in the form of hash
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_hash
188
+ hash = {}
189
+ self.class.attribute_map.each_pair do |attr, param|
190
+ value = self.send(attr)
191
+ next if value.nil?
192
+ hash[param] = _to_hash(value)
193
+ end
194
+ hash
195
+ end
196
+
197
+ # Outputs non-array value in the form of hash
198
+ # For object, use to_hash. Otherwise, just return the value
199
+ # @param [Object] value Any valid value
200
+ # @return [Hash] Returns the value in the form of hash
201
+ def _to_hash(value)
202
+ if value.is_a?(Array)
203
+ value.compact.map{ |v| _to_hash(v) }
204
+ elsif value.is_a?(Hash)
205
+ {}.tap do |hash|
206
+ value.each { |k, v| hash[k] = _to_hash(v) }
207
+ end
208
+ elsif value.respond_to? :to_hash
209
+ value.to_hash
210
+ else
211
+ value
212
+ end
213
+ end
214
+
215
+ end
216
+ end