wallee-ruby-sdk 2.2.3 → 3.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) 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 +63 -8
  5. data/lib/wallee-ruby-sdk/api/bank_account_service_api.rb +213 -0
  6. data/lib/wallee-ruby-sdk/api/bank_transaction_service_api.rb +213 -0
  7. data/lib/wallee-ruby-sdk/api/charge_bank_transaction_service_api.rb +213 -0
  8. data/lib/wallee-ruby-sdk/api/currency_bank_account_service_api.rb +213 -0
  9. data/lib/wallee-ruby-sdk/api/external_transfer_bank_transaction_service_api.rb +213 -0
  10. data/lib/wallee-ruby-sdk/api/internal_transfer_bank_transaction_service_api.rb +213 -0
  11. data/lib/wallee-ruby-sdk/api/payment_terminal_till_service_api.rb +170 -0
  12. data/lib/wallee-ruby-sdk/api/refund_bank_transaction_service_api.rb +213 -0
  13. data/lib/wallee-ruby-sdk/api/refund_recovery_bank_transaction_service_api.rb +213 -0
  14. data/lib/wallee-ruby-sdk/api/shopify_subscriber_service_api.rb +62 -0
  15. data/lib/wallee-ruby-sdk/api/shopify_subscription_service_api.rb +124 -0
  16. data/lib/wallee-ruby-sdk/api/shopify_transaction_service_api.rb +213 -0
  17. data/lib/wallee-ruby-sdk/api/subscriber_service_api.rb +3 -3
  18. data/lib/wallee-ruby-sdk/api/subscription_service_api.rb +67 -0
  19. data/lib/wallee-ruby-sdk/api/token_service_api.rb +189 -0
  20. data/lib/wallee-ruby-sdk/api/transaction_terminal_service_api.rb +21 -32
  21. data/lib/wallee-ruby-sdk/api/web_app_service_api.rb +200 -0
  22. data/lib/wallee-ruby-sdk/api_client.rb +7 -4
  23. data/lib/wallee-ruby-sdk/configuration.rb +2 -2
  24. data/lib/wallee-ruby-sdk/models/abstract_account_update.rb +11 -1
  25. data/lib/wallee-ruby-sdk/models/abstract_payment_link_update.rb +15 -15
  26. data/lib/wallee-ruby-sdk/models/{abstract_shopify_subscription_product_active.rb → abstract_shopify_subscription_product_update.rb} +2 -12
  27. data/lib/wallee-ruby-sdk/models/abstract_space_update.rb +11 -1
  28. data/lib/wallee-ruby-sdk/models/abstract_subscription_product_active.rb +11 -1
  29. data/lib/wallee-ruby-sdk/models/abstract_transaction_pending.rb +59 -1
  30. data/lib/wallee-ruby-sdk/models/abstract_webhook_url_update.rb +24 -0
  31. data/lib/wallee-ruby-sdk/models/account.rb +31 -1
  32. data/lib/wallee-ruby-sdk/models/account_create.rb +11 -1
  33. data/lib/wallee-ruby-sdk/models/account_update.rb +11 -1
  34. data/lib/wallee-ruby-sdk/models/authenticated_card_data.rb +221 -0
  35. data/lib/wallee-ruby-sdk/models/{unencrypted_card_data.rb → authenticated_card_data_create.rb} +86 -12
  36. data/lib/wallee-ruby-sdk/models/bank_account.rb +291 -0
  37. data/lib/wallee-ruby-sdk/models/bank_account_environment.rb +35 -0
  38. data/lib/wallee-ruby-sdk/models/bank_account_state.rb +37 -0
  39. data/lib/wallee-ruby-sdk/models/bank_account_type.rb +227 -0
  40. data/lib/wallee-ruby-sdk/models/bank_transaction.rb +387 -0
  41. data/lib/wallee-ruby-sdk/models/bank_transaction_flow_direction.rb +35 -0
  42. data/lib/wallee-ruby-sdk/models/bank_transaction_source.rb +215 -0
  43. data/lib/wallee-ruby-sdk/models/bank_transaction_state.rb +35 -0
  44. data/lib/wallee-ruby-sdk/models/bank_transaction_type.rb +215 -0
  45. data/lib/wallee-ruby-sdk/models/card_authentication_response.rb +38 -0
  46. data/lib/wallee-ruby-sdk/models/card_authentication_version.rb +35 -0
  47. data/lib/wallee-ruby-sdk/models/card_cryptogram.rb +201 -0
  48. data/lib/wallee-ruby-sdk/models/card_cryptogram_create.rb +211 -0
  49. data/lib/wallee-ruby-sdk/models/card_cryptogram_type.rb +34 -0
  50. data/lib/wallee-ruby-sdk/models/cardholder_authentication.rb +231 -0
  51. data/lib/wallee-ruby-sdk/models/cardholder_authentication_create.rb +241 -0
  52. data/lib/wallee-ruby-sdk/models/charge_attempt.rb +11 -1
  53. data/lib/wallee-ruby-sdk/models/charge_bank_transaction.rb +291 -0
  54. data/lib/wallee-ruby-sdk/models/currency_bank_account.rb +241 -0
  55. data/lib/wallee-ruby-sdk/models/debt_collection_case.rb +1 -1
  56. data/lib/wallee-ruby-sdk/models/debt_collection_case_create.rb +1 -1
  57. data/lib/wallee-ruby-sdk/models/external_transfer_bank_transaction.rb +251 -0
  58. data/lib/wallee-ruby-sdk/models/internal_transfer_bank_transaction.rb +231 -0
  59. data/lib/wallee-ruby-sdk/models/payment_adjustment.rb +231 -0
  60. data/lib/wallee-ruby-sdk/models/payment_adjustment_type.rb +215 -0
  61. data/lib/wallee-ruby-sdk/models/payment_connector_configuration.rb +13 -1
  62. data/lib/wallee-ruby-sdk/models/payment_contract.rb +1 -25
  63. data/lib/wallee-ruby-sdk/models/payment_link.rb +16 -40
  64. data/lib/wallee-ruby-sdk/models/payment_link_active.rb +15 -15
  65. data/lib/wallee-ruby-sdk/models/payment_link_address_handling_mode.rb +36 -0
  66. data/lib/wallee-ruby-sdk/models/payment_link_create.rb +16 -44
  67. data/lib/wallee-ruby-sdk/models/payment_link_update.rb +15 -15
  68. data/lib/wallee-ruby-sdk/models/payment_terminal.rb +11 -1
  69. data/lib/wallee-ruby-sdk/models/payment_terminal_address.rb +0 -60
  70. data/lib/wallee-ruby-sdk/models/payment_terminal_configuration_version.rb +11 -1
  71. data/lib/wallee-ruby-sdk/models/payment_terminal_location.rb +2 -22
  72. data/lib/wallee-ruby-sdk/models/payment_terminal_receipt_type.rb +215 -0
  73. data/lib/wallee-ruby-sdk/models/permission.rb +14 -4
  74. data/lib/wallee-ruby-sdk/models/recurring_indicator.rb +37 -0
  75. data/lib/wallee-ruby-sdk/models/refund_bank_transaction.rb +281 -0
  76. data/lib/wallee-ruby-sdk/models/refund_recovery_bank_transaction.rb +293 -0
  77. data/lib/wallee-ruby-sdk/models/rendered_terminal_receipt.rb +26 -6
  78. data/lib/wallee-ruby-sdk/models/role.rb +1 -1
  79. data/lib/wallee-ruby-sdk/models/role_state.rb +37 -0
  80. data/lib/wallee-ruby-sdk/models/sales_channel.rb +34 -4
  81. data/lib/wallee-ruby-sdk/models/shopify_additional_line_item_data.rb +35 -0
  82. data/lib/wallee-ruby-sdk/models/shopify_integration.rb +73 -31
  83. data/lib/wallee-ruby-sdk/models/shopify_integration_payment_app_version.rb +34 -0
  84. data/lib/wallee-ruby-sdk/models/{shopify_integration_app_version.rb → shopify_integration_subscription_app_version.rb} +3 -3
  85. data/lib/wallee-ruby-sdk/models/shopify_subscriber.rb +1 -1
  86. data/lib/wallee-ruby-sdk/models/shopify_subscriber_active.rb +241 -0
  87. data/lib/wallee-ruby-sdk/models/shopify_subscriber_creation.rb +216 -0
  88. data/lib/wallee-ruby-sdk/models/shopify_subscription.rb +61 -7
  89. data/lib/wallee-ruby-sdk/models/shopify_subscription_address.rb +0 -60
  90. data/lib/wallee-ruby-sdk/models/{payment_terminal_contact_address.rb → shopify_subscription_address_create.rb} +152 -2
  91. data/lib/wallee-ruby-sdk/models/shopify_subscription_creation_request.rb +363 -0
  92. data/lib/wallee-ruby-sdk/models/shopify_subscription_model_billing_configuration.rb +271 -0
  93. data/lib/wallee-ruby-sdk/models/{shopify_subscription_edit_model_item.rb → shopify_subscription_model_item.rb} +2 -2
  94. data/lib/wallee-ruby-sdk/models/{shopify_subscription_edit_model_tax_line.rb → shopify_subscription_model_tax_line.rb} +1 -1
  95. data/lib/wallee-ruby-sdk/models/shopify_subscription_product_create.rb +9 -14
  96. data/lib/wallee-ruby-sdk/models/{shopify_subscription_product_active.rb → shopify_subscription_product_update.rb} +2 -12
  97. data/lib/wallee-ruby-sdk/models/shopify_subscription_update_addresses_request.rb +211 -0
  98. data/lib/wallee-ruby-sdk/models/shopify_subscription_update_request.rb +11 -81
  99. data/lib/wallee-ruby-sdk/models/shopify_subscription_version.rb +11 -1
  100. data/lib/wallee-ruby-sdk/models/space.rb +31 -1
  101. data/lib/wallee-ruby-sdk/models/space_create.rb +11 -1
  102. data/lib/wallee-ruby-sdk/models/space_update.rb +11 -1
  103. data/lib/wallee-ruby-sdk/models/subscriber.rb +1 -1
  104. data/lib/wallee-ruby-sdk/models/subscriber_create.rb +1 -1
  105. data/lib/wallee-ruby-sdk/models/subscription.rb +11 -1
  106. data/lib/wallee-ruby-sdk/models/subscription_affiliate.rb +1 -25
  107. data/lib/wallee-ruby-sdk/models/subscription_affiliate_create.rb +1 -29
  108. data/lib/wallee-ruby-sdk/models/subscription_affiliate_deleted.rb +1 -25
  109. data/lib/wallee-ruby-sdk/models/subscription_affiliate_deleting.rb +1 -25
  110. data/lib/wallee-ruby-sdk/models/subscription_charge.rb +49 -1
  111. data/lib/wallee-ruby-sdk/models/subscription_charge_create.rb +49 -1
  112. data/lib/wallee-ruby-sdk/models/subscription_create_request.rb +1 -1
  113. data/lib/wallee-ruby-sdk/models/subscription_ledger_entry.rb +12 -2
  114. data/lib/wallee-ruby-sdk/models/subscription_ledger_entry_create.rb +1 -1
  115. data/lib/wallee-ruby-sdk/models/subscription_product.rb +11 -1
  116. data/lib/wallee-ruby-sdk/models/subscription_product_active.rb +11 -1
  117. data/lib/wallee-ruby-sdk/models/subscription_product_component.rb +1 -1
  118. data/lib/wallee-ruby-sdk/models/subscription_product_component_update.rb +1 -1
  119. data/lib/wallee-ruby-sdk/models/subscription_product_create.rb +11 -1
  120. data/lib/wallee-ruby-sdk/models/subscription_product_version.rb +11 -1
  121. data/lib/wallee-ruby-sdk/models/subscription_product_version_pending.rb +14 -4
  122. data/lib/wallee-ruby-sdk/models/subscription_update_request.rb +206 -0
  123. data/lib/wallee-ruby-sdk/models/tax_calculation.rb +35 -0
  124. data/lib/wallee-ruby-sdk/models/terminal_receipt_fetch_request.rb +221 -0
  125. data/lib/wallee-ruby-sdk/models/terminal_receipt_format.rb +35 -0
  126. data/lib/wallee-ruby-sdk/models/token.rb +1 -25
  127. data/lib/wallee-ruby-sdk/models/token_create.rb +1 -29
  128. data/lib/wallee-ruby-sdk/models/tokenized_card_data.rb +211 -0
  129. data/lib/wallee-ruby-sdk/models/{unencrypted_card_data_create.rb → tokenized_card_data_create.rb} +60 -5
  130. data/lib/wallee-ruby-sdk/models/transaction.rb +132 -4
  131. data/lib/wallee-ruby-sdk/models/transaction_completion.rb +26 -1
  132. data/lib/wallee-ruby-sdk/models/transaction_completion_behavior.rb +36 -0
  133. data/lib/wallee-ruby-sdk/models/transaction_completion_request.rb +26 -1
  134. data/lib/wallee-ruby-sdk/models/transaction_create.rb +59 -1
  135. data/lib/wallee-ruby-sdk/models/transaction_pending.rb +59 -1
  136. data/lib/wallee-ruby-sdk/models/web_app_confirmation_request.rb +206 -0
  137. data/lib/wallee-ruby-sdk/models/web_app_confirmation_response.rb +231 -0
  138. data/lib/wallee-ruby-sdk/models/webhook_url.rb +35 -1
  139. data/lib/wallee-ruby-sdk/models/webhook_url_create.rb +24 -0
  140. data/lib/wallee-ruby-sdk/models/webhook_url_update.rb +24 -0
  141. data/lib/wallee-ruby-sdk/version.rb +1 -1
  142. data/test/condition_type_service_test.rb +22 -0
  143. data/wallee-ruby-sdk.gemspec +3 -2
  144. metadata +93 -17
@@ -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
@@ -26,7 +26,7 @@ module Wallee
26
26
  #
27
27
  attr_accessor :email_address
28
28
 
29
- # 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.
29
+ # A client generated nonce which identifies the entity to be created. Subsequent creation requests with the same external ID will not create new entities but return the initially created entity instead.
30
30
  attr_accessor :external_id
31
31
 
32
32
  # The ID is the primary key of the entity. The ID identifies the entity uniquely.
@@ -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
+ # A client generated nonce which identifies the entity to be created. Subsequent creation requests with the same external ID will not create new entities but return the initially created entity instead.
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
@@ -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