storecove 1.0.9 → 1.0.10

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 (113) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -0
  3. data/Gemfile.lock +69 -0
  4. data/lib/storecove.rb +20 -1
  5. data/lib/storecove/api/invoice_submissions_api.rb +9 -4
  6. data/lib/storecove/api/legal_entities_api.rb +248 -0
  7. data/lib/storecove/api/peppol_identifiers_api.rb +156 -0
  8. data/lib/storecove/api/purchase_invoices_api.rb +133 -0
  9. data/lib/storecove/api/shop_account_requests_api.rb +24 -11
  10. data/lib/storecove/api/shop_accounts_api.rb +25 -12
  11. data/lib/storecove/api/shops_api.rb +2 -1
  12. data/lib/storecove/api_client.rb +39 -26
  13. data/lib/storecove/api_error.rb +1 -0
  14. data/lib/storecove/configuration.rb +7 -0
  15. data/lib/storecove/models/accounting_cost_code.rb +2 -1
  16. data/lib/storecove/models/accounting_customer_party.rb +2 -1
  17. data/lib/storecove/models/accounting_details.rb +219 -0
  18. data/lib/storecove/models/accounting_details_1.rb +219 -0
  19. data/lib/storecove/models/address.rb +2 -1
  20. data/lib/storecove/models/contact.rb +2 -6
  21. data/lib/storecove/models/country.rb +10 -0
  22. data/lib/storecove/models/currency_code.rb +10 -0
  23. data/lib/storecove/models/error_model.rb +2 -1
  24. data/lib/storecove/models/invoice.rb +16 -3
  25. data/lib/storecove/models/invoice_line.rb +251 -6
  26. data/lib/storecove/models/invoice_recipient.rb +24 -11
  27. data/lib/storecove/models/invoice_recipient_preflight.rb +21 -19
  28. data/lib/storecove/models/invoice_submission.rb +20 -9
  29. data/lib/storecove/models/invoice_submission_result.rb +2 -1
  30. data/lib/storecove/models/legal_entity.rb +164 -25
  31. data/lib/storecove/models/legal_entity_create.rb +417 -0
  32. data/lib/storecove/models/legal_entity_identifier.rb +2 -1
  33. data/lib/storecove/models/legal_entity_shop.rb +253 -0
  34. data/lib/storecove/models/legal_entity_update.rb +380 -0
  35. data/lib/storecove/models/logos.rb +2 -1
  36. data/lib/storecove/models/party.rb +7 -1
  37. data/lib/storecove/models/payment_means.rb +199 -0
  38. data/lib/storecove/models/peppol_identifier.rb +284 -0
  39. data/lib/storecove/models/peppol_identifier_create.rb +308 -0
  40. data/lib/storecove/models/preflight_invoice_recipient_result.rb +2 -1
  41. data/lib/storecove/models/public_identifier.rb +3 -2
  42. data/lib/storecove/models/public_identifiers.rb +2 -1
  43. data/lib/storecove/models/purchase_invoice.rb +463 -0
  44. data/lib/storecove/models/purchase_invoice_invoice_line.rb +247 -0
  45. data/lib/storecove/models/purchase_invoice_sender.rb +280 -0
  46. data/lib/storecove/models/purchase_invoice_sender_billing_contact.rb +209 -0
  47. data/lib/storecove/models/purchase_invoice_ubl.rb +209 -0
  48. data/lib/storecove/models/shop.rb +3 -2
  49. data/lib/storecove/models/shop_account_input.rb +2 -1
  50. data/lib/storecove/models/shop_account_request_input.rb +2 -1
  51. data/lib/storecove/models/shop_account_request_result.rb +2 -1
  52. data/lib/storecove/models/shop_account_request_update.rb +2 -1
  53. data/lib/storecove/models/shop_account_result.rb +2 -1
  54. data/lib/storecove/models/shop_account_update.rb +2 -1
  55. data/lib/storecove/models/tax.rb +2 -1
  56. data/lib/storecove/models/vat_details.rb +209 -0
  57. data/lib/storecove/models/widget_identification.rb +228 -0
  58. data/lib/storecove/version.rb +2 -1
  59. data/spec/api/invoice_submissions_api_spec.rb +9 -20
  60. data/spec/api/legal_entities_api_spec.rb +84 -0
  61. data/spec/api/peppol_identifiers_api_spec.rb +63 -0
  62. data/spec/api/purchase_invoices_api_spec.rb +59 -0
  63. data/spec/api/shop_account_requests_api_spec.rb +30 -41
  64. data/spec/api/shop_accounts_api_spec.rb +34 -45
  65. data/spec/api/shops_api_spec.rb +6 -17
  66. data/spec/api_client_spec.rb +2 -13
  67. data/spec/configuration_spec.rb +2 -13
  68. data/spec/models/accounting_cost_code_spec.rb +3 -14
  69. data/spec/models/accounting_customer_party_spec.rb +3 -14
  70. data/spec/models/accounting_details_1_spec.rb +60 -0
  71. data/spec/models/accounting_details_spec.rb +60 -0
  72. data/spec/models/{party_address_spec.rb → address_spec.rb} +8 -19
  73. data/spec/models/{party_contact_spec.rb → contact_spec.rb} +8 -19
  74. data/spec/models/country_spec.rb +3 -14
  75. data/spec/models/currency_code_spec.rb +3 -14
  76. data/spec/models/error_model_spec.rb +3 -14
  77. data/spec/models/invoice_line_spec.rb +69 -14
  78. data/spec/models/invoice_recipient_preflight_spec.rb +10 -15
  79. data/spec/models/invoice_recipient_spec.rb +15 -14
  80. data/spec/models/{invoice_submission_invoice_spec.rb → invoice_spec.rb} +20 -19
  81. data/spec/models/invoice_submission_result_spec.rb +4 -15
  82. data/spec/models/invoice_submission_spec.rb +4 -15
  83. data/spec/models/legal_entity_create_spec.rb +78 -0
  84. data/spec/models/legal_entity_identifier_spec.rb +3 -14
  85. data/spec/models/legal_entity_shop_spec.rb +84 -0
  86. data/spec/models/legal_entity_spec.rb +7 -18
  87. data/spec/models/legal_entity_update_spec.rb +78 -0
  88. data/spec/models/logos_spec.rb +3 -14
  89. data/spec/models/party_spec.rb +3 -14
  90. data/spec/models/payment_means_spec.rb +48 -0
  91. data/spec/models/peppol_identifier_create_spec.rb +54 -0
  92. data/spec/models/peppol_identifier_spec.rb +54 -0
  93. data/spec/models/preflight_invoice_recipient_result_spec.rb +3 -14
  94. data/spec/models/public_identifier_spec.rb +3 -14
  95. data/spec/models/public_identifiers_spec.rb +3 -14
  96. data/spec/models/purchase_invoice_invoice_line_spec.rb +78 -0
  97. data/spec/models/purchase_invoice_sender_billing_contact_spec.rb +54 -0
  98. data/spec/models/purchase_invoice_sender_spec.rb +96 -0
  99. data/spec/models/purchase_invoice_spec.rb +188 -0
  100. data/spec/models/purchase_invoice_ubl_spec.rb +54 -0
  101. data/spec/models/shop_account_input_spec.rb +3 -14
  102. data/spec/models/shop_account_request_input_spec.rb +3 -14
  103. data/spec/models/{shop_account_request_spec.rb → shop_account_request_result_spec.rb} +8 -19
  104. data/spec/models/shop_account_request_update_spec.rb +3 -14
  105. data/spec/models/shop_account_result_spec.rb +3 -14
  106. data/spec/models/shop_account_update_spec.rb +3 -14
  107. data/spec/models/shop_spec.rb +3 -14
  108. data/spec/models/{invoice_line_tax_spec.rb → tax_spec.rb} +8 -19
  109. data/spec/models/vat_details_spec.rb +54 -0
  110. data/spec/models/widget_identification_spec.rb +48 -0
  111. data/spec/spec_helper.rb +2 -13
  112. data/storecove.gemspec +10 -19
  113. metadata +83 -28
@@ -0,0 +1,380 @@
1
+ =begin
2
+ #Storecove API
3
+
4
+ #Storecove API
5
+
6
+ OpenAPI spec version: 2.0.1
7
+ Contact: apisupport@storecove.nl
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module StorecoveApi
16
+
17
+ class LegalEntityUpdate
18
+ # The name of the company.
19
+ attr_accessor :party_name
20
+
21
+ # The first address line.
22
+ attr_accessor :line1
23
+
24
+ # The second address line, if applicable
25
+ attr_accessor :line2
26
+
27
+ # The city.
28
+ attr_accessor :city
29
+
30
+ # The zipcode.
31
+ attr_accessor :zip
32
+
33
+ # County, if applicable
34
+ attr_accessor :county
35
+
36
+ attr_accessor :country
37
+
38
+
39
+ # Attribute mapping from ruby-style variable name to JSON key.
40
+ def self.attribute_map
41
+ {
42
+ :'party_name' => :'party_name',
43
+ :'line1' => :'line1',
44
+ :'line2' => :'line2',
45
+ :'city' => :'city',
46
+ :'zip' => :'zip',
47
+ :'county' => :'county',
48
+ :'country' => :'country'
49
+ }
50
+ end
51
+
52
+ # Attribute type mapping.
53
+ def self.swagger_types
54
+ {
55
+ :'party_name' => :'String',
56
+ :'line1' => :'String',
57
+ :'line2' => :'String',
58
+ :'city' => :'String',
59
+ :'zip' => :'String',
60
+ :'county' => :'String',
61
+ :'country' => :'Country'
62
+ }
63
+ end
64
+
65
+ # Initializes the object
66
+ # @param [Hash] attributes Model attributes in the form of hash
67
+ def initialize(attributes = {})
68
+ return unless attributes.is_a?(Hash)
69
+
70
+ # convert string to symbol for hash key
71
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
72
+
73
+ if attributes.has_key?(:'party_name')
74
+ self.party_name = attributes[:'party_name']
75
+ end
76
+
77
+ if attributes.has_key?(:'line1')
78
+ self.line1 = attributes[:'line1']
79
+ end
80
+
81
+ if attributes.has_key?(:'line2')
82
+ self.line2 = attributes[:'line2']
83
+ end
84
+
85
+ if attributes.has_key?(:'city')
86
+ self.city = attributes[:'city']
87
+ end
88
+
89
+ if attributes.has_key?(:'zip')
90
+ self.zip = attributes[:'zip']
91
+ end
92
+
93
+ if attributes.has_key?(:'county')
94
+ self.county = attributes[:'county']
95
+ end
96
+
97
+ if attributes.has_key?(:'country')
98
+ self.country = attributes[:'country']
99
+ end
100
+
101
+ end
102
+
103
+ # Show invalid properties with the reasons. Usually used together with valid?
104
+ # @return Array for valid properties with the reasons
105
+ def list_invalid_properties
106
+ invalid_properties = Array.new
107
+ if !@party_name.nil? && @party_name.to_s.length > 64
108
+ invalid_properties.push("invalid value for 'party_name', the character length must be smaller than or equal to 64.")
109
+ end
110
+
111
+ if !@party_name.nil? && @party_name.to_s.length < 2
112
+ invalid_properties.push("invalid value for 'party_name', the character length must be great than or equal to 2.")
113
+ end
114
+
115
+ if !@line1.nil? && @line1.to_s.length > 64
116
+ invalid_properties.push("invalid value for 'line1', the character length must be smaller than or equal to 64.")
117
+ end
118
+
119
+ if !@line1.nil? && @line1.to_s.length < 2
120
+ invalid_properties.push("invalid value for 'line1', the character length must be great than or equal to 2.")
121
+ end
122
+
123
+ if !@line2.nil? && @line2.to_s.length > 64
124
+ invalid_properties.push("invalid value for 'line2', the character length must be smaller than or equal to 64.")
125
+ end
126
+
127
+ if !@city.nil? && @city.to_s.length > 64
128
+ invalid_properties.push("invalid value for 'city', the character length must be smaller than or equal to 64.")
129
+ end
130
+
131
+ if !@city.nil? && @city.to_s.length < 2
132
+ invalid_properties.push("invalid value for 'city', the character length must be great than or equal to 2.")
133
+ end
134
+
135
+ if !@zip.nil? && @zip.to_s.length > 32
136
+ invalid_properties.push("invalid value for 'zip', the character length must be smaller than or equal to 32.")
137
+ end
138
+
139
+ if !@zip.nil? && @zip.to_s.length < 2
140
+ invalid_properties.push("invalid value for 'zip', the character length must be great than or equal to 2.")
141
+ end
142
+
143
+ if !@county.nil? && @county.to_s.length > 64
144
+ invalid_properties.push("invalid value for 'county', the character length must be smaller than or equal to 64.")
145
+ end
146
+
147
+ return invalid_properties
148
+ end
149
+
150
+ # Check to see if the all the properties in the model are valid
151
+ # @return true if the model is valid
152
+ def valid?
153
+ return false if !@party_name.nil? && @party_name.to_s.length > 64
154
+ return false if !@party_name.nil? && @party_name.to_s.length < 2
155
+ return false if !@line1.nil? && @line1.to_s.length > 64
156
+ return false if !@line1.nil? && @line1.to_s.length < 2
157
+ return false if !@line2.nil? && @line2.to_s.length > 64
158
+ return false if !@city.nil? && @city.to_s.length > 64
159
+ return false if !@city.nil? && @city.to_s.length < 2
160
+ return false if !@zip.nil? && @zip.to_s.length > 32
161
+ return false if !@zip.nil? && @zip.to_s.length < 2
162
+ return false if !@county.nil? && @county.to_s.length > 64
163
+ return true
164
+ end
165
+
166
+ # Custom attribute writer method with validation
167
+ # @param [Object] party_name Value to be assigned
168
+ def party_name=(party_name)
169
+
170
+ if !party_name.nil? && party_name.to_s.length > 64
171
+ fail ArgumentError, "invalid value for 'party_name', the character length must be smaller than or equal to 64."
172
+ end
173
+
174
+ if !party_name.nil? && party_name.to_s.length < 2
175
+ fail ArgumentError, "invalid value for 'party_name', the character length must be great than or equal to 2."
176
+ end
177
+
178
+ @party_name = party_name
179
+ end
180
+
181
+ # Custom attribute writer method with validation
182
+ # @param [Object] line1 Value to be assigned
183
+ def line1=(line1)
184
+
185
+ if !line1.nil? && line1.to_s.length > 64
186
+ fail ArgumentError, "invalid value for 'line1', the character length must be smaller than or equal to 64."
187
+ end
188
+
189
+ if !line1.nil? && line1.to_s.length < 2
190
+ fail ArgumentError, "invalid value for 'line1', the character length must be great than or equal to 2."
191
+ end
192
+
193
+ @line1 = line1
194
+ end
195
+
196
+ # Custom attribute writer method with validation
197
+ # @param [Object] line2 Value to be assigned
198
+ def line2=(line2)
199
+
200
+ if !line2.nil? && line2.to_s.length > 64
201
+ fail ArgumentError, "invalid value for 'line2', the character length must be smaller than or equal to 64."
202
+ end
203
+
204
+ @line2 = line2
205
+ end
206
+
207
+ # Custom attribute writer method with validation
208
+ # @param [Object] city Value to be assigned
209
+ def city=(city)
210
+
211
+ if !city.nil? && city.to_s.length > 64
212
+ fail ArgumentError, "invalid value for 'city', the character length must be smaller than or equal to 64."
213
+ end
214
+
215
+ if !city.nil? && city.to_s.length < 2
216
+ fail ArgumentError, "invalid value for 'city', the character length must be great than or equal to 2."
217
+ end
218
+
219
+ @city = city
220
+ end
221
+
222
+ # Custom attribute writer method with validation
223
+ # @param [Object] zip Value to be assigned
224
+ def zip=(zip)
225
+
226
+ if !zip.nil? && zip.to_s.length > 32
227
+ fail ArgumentError, "invalid value for 'zip', the character length must be smaller than or equal to 32."
228
+ end
229
+
230
+ if !zip.nil? && zip.to_s.length < 2
231
+ fail ArgumentError, "invalid value for 'zip', the character length must be great than or equal to 2."
232
+ end
233
+
234
+ @zip = zip
235
+ end
236
+
237
+ # Custom attribute writer method with validation
238
+ # @param [Object] county Value to be assigned
239
+ def county=(county)
240
+
241
+ if !county.nil? && county.to_s.length > 64
242
+ fail ArgumentError, "invalid value for 'county', the character length must be smaller than or equal to 64."
243
+ end
244
+
245
+ @county = county
246
+ end
247
+
248
+ # Checks equality by comparing each attribute.
249
+ # @param [Object] Object to be compared
250
+ def ==(o)
251
+ return true if self.equal?(o)
252
+ self.class == o.class &&
253
+ party_name == o.party_name &&
254
+ line1 == o.line1 &&
255
+ line2 == o.line2 &&
256
+ city == o.city &&
257
+ zip == o.zip &&
258
+ county == o.county &&
259
+ country == o.country
260
+ end
261
+
262
+ # @see the `==` method
263
+ # @param [Object] Object to be compared
264
+ def eql?(o)
265
+ self == o
266
+ end
267
+
268
+ # Calculates hash code according to all attributes.
269
+ # @return [Fixnum] Hash code
270
+ def hash
271
+ [party_name, line1, line2, city, zip, county, country].hash
272
+ end
273
+
274
+ # Builds the object from hash
275
+ # @param [Hash] attributes Model attributes in the form of hash
276
+ # @return [Object] Returns the model itself
277
+ def build_from_hash(attributes)
278
+ return nil unless attributes.is_a?(Hash)
279
+ self.class.swagger_types.each_pair do |key, type|
280
+ if type =~ /\AArray<(.*)>/i
281
+ # check to ensure the input is an array given that the the attribute
282
+ # is documented as an array but the input is not
283
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
284
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
285
+ end
286
+ elsif !attributes[self.class.attribute_map[key]].nil?
287
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
288
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
289
+ end
290
+
291
+ self
292
+ end
293
+
294
+ # Deserializes the data based on type
295
+ # @param string type Data type
296
+ # @param string value Value to be deserialized
297
+ # @return [Object] Deserialized data
298
+ def _deserialize(type, value)
299
+ case type.to_sym
300
+ when :DateTime
301
+ DateTime.parse(value)
302
+ when :Date
303
+ Date.parse(value)
304
+ when :String
305
+ value.to_s
306
+ when :Integer
307
+ value.to_i
308
+ when :Float
309
+ value.to_f
310
+ when :BOOLEAN
311
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
312
+ true
313
+ else
314
+ false
315
+ end
316
+ when :Object
317
+ # generic object (usually a Hash), return directly
318
+ value
319
+ when /\AArray<(?<inner_type>.+)>\z/
320
+ inner_type = Regexp.last_match[:inner_type]
321
+ value.map { |v| _deserialize(inner_type, v) }
322
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
323
+ k_type = Regexp.last_match[:k_type]
324
+ v_type = Regexp.last_match[:v_type]
325
+ {}.tap do |hash|
326
+ value.each do |k, v|
327
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
328
+ end
329
+ end
330
+ else # model
331
+ temp_model = StorecoveApi.const_get(type).new
332
+ temp_model.build_from_hash(value)
333
+ end
334
+ end
335
+
336
+ # Returns the string representation of the object
337
+ # @return [String] String presentation of the object
338
+ def to_s
339
+ to_hash.to_s
340
+ end
341
+
342
+ # to_body is an alias to to_hash (backward compatibility)
343
+ # @return [Hash] Returns the object in the form of hash
344
+ def to_body
345
+ to_hash
346
+ end
347
+
348
+ # Returns the object in the form of hash
349
+ # @return [Hash] Returns the object in the form of hash
350
+ def to_hash
351
+ hash = {}
352
+ self.class.attribute_map.each_pair do |attr, param|
353
+ value = self.send(attr)
354
+ next if value.nil?
355
+ hash[param] = _to_hash(value)
356
+ end
357
+ hash
358
+ end
359
+
360
+ # Outputs non-array value in the form of hash
361
+ # For object, use to_hash. Otherwise, just return the value
362
+ # @param [Object] value Any valid value
363
+ # @return [Hash] Returns the value in the form of hash
364
+ def _to_hash(value)
365
+ if value.is_a?(Array)
366
+ value.compact.map{ |v| _to_hash(v) }
367
+ elsif value.is_a?(Hash)
368
+ {}.tap do |hash|
369
+ value.each { |k, v| hash[k] = _to_hash(v) }
370
+ end
371
+ elsif value.respond_to? :to_hash
372
+ value.to_hash
373
+ else
374
+ value
375
+ end
376
+ end
377
+
378
+ end
379
+
380
+ end
@@ -6,6 +6,7 @@
6
6
  OpenAPI spec version: 2.0.1
7
7
  Contact: apisupport@storecove.nl
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
9
10
 
10
11
  =end
11
12
 
@@ -62,7 +63,7 @@ module StorecoveApi
62
63
  end
63
64
 
64
65
  # Show invalid properties with the reasons. Usually used together with valid?
65
- # @return Array for valid properies with the reasons
66
+ # @return Array for valid properties with the reasons
66
67
  def list_invalid_properties
67
68
  invalid_properties = Array.new
68
69
  return invalid_properties
@@ -6,6 +6,7 @@
6
6
  OpenAPI spec version: 2.0.1
7
7
  Contact: apisupport@storecove.nl
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
9
10
 
10
11
  =end
11
12
 
@@ -63,7 +64,7 @@ module StorecoveApi
63
64
  end
64
65
 
65
66
  # Show invalid properties with the reasons. Usually used together with valid?
66
- # @return Array for valid properies with the reasons
67
+ # @return Array for valid properties with the reasons
67
68
  def list_invalid_properties
68
69
  invalid_properties = Array.new
69
70
  if @company_name.nil?
@@ -74,6 +75,10 @@ module StorecoveApi
74
75
  invalid_properties.push("invalid value for 'company_name', the character length must be great than or equal to 2.")
75
76
  end
76
77
 
78
+ if @address.nil?
79
+ invalid_properties.push("invalid value for 'address', address cannot be nil.")
80
+ end
81
+
77
82
  return invalid_properties
78
83
  end
79
84
 
@@ -82,6 +87,7 @@ module StorecoveApi
82
87
  def valid?
83
88
  return false if @company_name.nil?
84
89
  return false if @company_name.to_s.length < 2
90
+ return false if @address.nil?
85
91
  return true
86
92
  end
87
93
 
@@ -0,0 +1,199 @@
1
+ =begin
2
+ #Storecove API
3
+
4
+ #Storecove API
5
+
6
+ OpenAPI spec version: 2.0.1
7
+ Contact: apisupport@storecove.nl
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module StorecoveApi
16
+ # How the invoice can be paid.
17
+ class PaymentMeans
18
+ # The IBAN to which to transfer.
19
+ attr_accessor :iban
20
+
21
+ # An id to mention in the transfer.
22
+ attr_accessor :id
23
+
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'iban' => :'iban',
29
+ :'id' => :'id'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ :'iban' => :'String',
37
+ :'id' => :'String'
38
+ }
39
+ end
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ def initialize(attributes = {})
44
+ return unless attributes.is_a?(Hash)
45
+
46
+ # convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
48
+
49
+ if attributes.has_key?(:'iban')
50
+ self.iban = attributes[:'iban']
51
+ end
52
+
53
+ if attributes.has_key?(:'id')
54
+ self.id = attributes[:'id']
55
+ end
56
+
57
+ end
58
+
59
+ # Show invalid properties with the reasons. Usually used together with valid?
60
+ # @return Array for valid properties with the reasons
61
+ def list_invalid_properties
62
+ invalid_properties = Array.new
63
+ return invalid_properties
64
+ end
65
+
66
+ # Check to see if the all the properties in the model are valid
67
+ # @return true if the model is valid
68
+ def valid?
69
+ return true
70
+ end
71
+
72
+ # Checks equality by comparing each attribute.
73
+ # @param [Object] Object to be compared
74
+ def ==(o)
75
+ return true if self.equal?(o)
76
+ self.class == o.class &&
77
+ iban == o.iban &&
78
+ id == o.id
79
+ end
80
+
81
+ # @see the `==` method
82
+ # @param [Object] Object to be compared
83
+ def eql?(o)
84
+ self == o
85
+ end
86
+
87
+ # Calculates hash code according to all attributes.
88
+ # @return [Fixnum] Hash code
89
+ def hash
90
+ [iban, id].hash
91
+ end
92
+
93
+ # Builds the object from hash
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ # @return [Object] Returns the model itself
96
+ def build_from_hash(attributes)
97
+ return nil unless attributes.is_a?(Hash)
98
+ self.class.swagger_types.each_pair do |key, type|
99
+ if type =~ /\AArray<(.*)>/i
100
+ # check to ensure the input is an array given that the the attribute
101
+ # is documented as an array but the input is not
102
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
103
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
104
+ end
105
+ elsif !attributes[self.class.attribute_map[key]].nil?
106
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
107
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
108
+ end
109
+
110
+ self
111
+ end
112
+
113
+ # Deserializes the data based on type
114
+ # @param string type Data type
115
+ # @param string value Value to be deserialized
116
+ # @return [Object] Deserialized data
117
+ def _deserialize(type, value)
118
+ case type.to_sym
119
+ when :DateTime
120
+ DateTime.parse(value)
121
+ when :Date
122
+ Date.parse(value)
123
+ when :String
124
+ value.to_s
125
+ when :Integer
126
+ value.to_i
127
+ when :Float
128
+ value.to_f
129
+ when :BOOLEAN
130
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
131
+ true
132
+ else
133
+ false
134
+ end
135
+ when :Object
136
+ # generic object (usually a Hash), return directly
137
+ value
138
+ when /\AArray<(?<inner_type>.+)>\z/
139
+ inner_type = Regexp.last_match[:inner_type]
140
+ value.map { |v| _deserialize(inner_type, v) }
141
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
142
+ k_type = Regexp.last_match[:k_type]
143
+ v_type = Regexp.last_match[:v_type]
144
+ {}.tap do |hash|
145
+ value.each do |k, v|
146
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
147
+ end
148
+ end
149
+ else # model
150
+ temp_model = StorecoveApi.const_get(type).new
151
+ temp_model.build_from_hash(value)
152
+ end
153
+ end
154
+
155
+ # Returns the string representation of the object
156
+ # @return [String] String presentation of the object
157
+ def to_s
158
+ to_hash.to_s
159
+ end
160
+
161
+ # to_body is an alias to to_hash (backward compatibility)
162
+ # @return [Hash] Returns the object in the form of hash
163
+ def to_body
164
+ to_hash
165
+ end
166
+
167
+ # Returns the object in the form of hash
168
+ # @return [Hash] Returns the object in the form of hash
169
+ def to_hash
170
+ hash = {}
171
+ self.class.attribute_map.each_pair do |attr, param|
172
+ value = self.send(attr)
173
+ next if value.nil?
174
+ hash[param] = _to_hash(value)
175
+ end
176
+ hash
177
+ end
178
+
179
+ # Outputs non-array value in the form of hash
180
+ # For object, use to_hash. Otherwise, just return the value
181
+ # @param [Object] value Any valid value
182
+ # @return [Hash] Returns the value in the form of hash
183
+ def _to_hash(value)
184
+ if value.is_a?(Array)
185
+ value.compact.map{ |v| _to_hash(v) }
186
+ elsif value.is_a?(Hash)
187
+ {}.tap do |hash|
188
+ value.each { |k, v| hash[k] = _to_hash(v) }
189
+ end
190
+ elsif value.respond_to? :to_hash
191
+ value.to_hash
192
+ else
193
+ value
194
+ end
195
+ end
196
+
197
+ end
198
+
199
+ end