storecove 1.0.3

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 (41) hide show
  1. checksums.yaml +7 -0
  2. data/lib/storecove/api/invoice_submissions_api.rb +148 -0
  3. data/lib/storecove/api/shop_account_requests_api.rb +323 -0
  4. data/lib/storecove/api/shop_accounts_api.rb +376 -0
  5. data/lib/storecove/api/shops_api.rb +87 -0
  6. data/lib/storecove/api_client.rb +379 -0
  7. data/lib/storecove/api_error.rb +47 -0
  8. data/lib/storecove/configuration.rb +214 -0
  9. data/lib/storecove/models/accounting_cost_code.rb +298 -0
  10. data/lib/storecove/models/accounting_customer_party.rb +210 -0
  11. data/lib/storecove/models/country.rb +280 -0
  12. data/lib/storecove/models/currency_code.rb +209 -0
  13. data/lib/storecove/models/error_model.rb +208 -0
  14. data/lib/storecove/models/invoice_line.rb +327 -0
  15. data/lib/storecove/models/invoice_line_tax.rb +222 -0
  16. data/lib/storecove/models/invoice_recipient.rb +227 -0
  17. data/lib/storecove/models/invoice_recipient_preflight.rb +211 -0
  18. data/lib/storecove/models/invoice_submission.rb +321 -0
  19. data/lib/storecove/models/invoice_submission_invoice.rb +506 -0
  20. data/lib/storecove/models/invoice_submission_result.rb +200 -0
  21. data/lib/storecove/models/legal_entity.rb +264 -0
  22. data/lib/storecove/models/legal_entity_identifier.rb +217 -0
  23. data/lib/storecove/models/logos.rb +217 -0
  24. data/lib/storecove/models/party.rb +242 -0
  25. data/lib/storecove/models/party_address.rb +331 -0
  26. data/lib/storecove/models/party_contact.rb +218 -0
  27. data/lib/storecove/models/preflight_invoice_recipient_result.rb +233 -0
  28. data/lib/storecove/models/public_identifiers.rb +190 -0
  29. data/lib/storecove/models/public_identifiers_inner.rb +258 -0
  30. data/lib/storecove/models/shop.rb +237 -0
  31. data/lib/storecove/models/shop_account.rb +270 -0
  32. data/lib/storecove/models/shop_account_input.rb +244 -0
  33. data/lib/storecove/models/shop_account_request.rb +236 -0
  34. data/lib/storecove/models/shop_account_request_input.rb +235 -0
  35. data/lib/storecove/models/shop_account_request_update.rb +226 -0
  36. data/lib/storecove/models/shop_account_update.rb +220 -0
  37. data/lib/storecove/models/swagger-codegen +2799 -0
  38. data/lib/storecove/version.rb +26 -0
  39. data/lib/storecove.rb +82 -0
  40. data/storecove.gemspec +55 -0
  41. metadata +263 -0
@@ -0,0 +1,327 @@
1
+ =begin
2
+ #Storecove API
3
+
4
+ #Storecove API
5
+
6
+ OpenAPI spec version: 2.0.0
7
+ Contact: apisupport@storecove.nl
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
21
+
22
+ =end
23
+
24
+ require 'date'
25
+
26
+ module StorecoveApi
27
+
28
+ class InvoiceLine
29
+ # Your id for this invoice line.
30
+ attr_accessor :id
31
+
32
+ # The description for this invoice line.
33
+ attr_accessor :description
34
+
35
+ # The period (or specific date) to which the invoice line applies. Format: yyyy-mm-dd - yyyy-mm-dd.
36
+ attr_accessor :invoice_period
37
+
38
+ # The number of items (may be fractional).
39
+ attr_accessor :quantity
40
+
41
+ # The amount excluding VAT. Should equal quantity x itemPrice (if these are both present). A difference of 5 cents or 1% between the calculated value and the provided value is allowed.
42
+ attr_accessor :amount_excluding_vat
43
+
44
+ attr_accessor :tax
45
+
46
+ attr_accessor :accounting_cost_code
47
+
48
+ # A URL to an image for the product in the invoice line.
49
+ attr_accessor :image_url
50
+
51
+
52
+ # Attribute mapping from ruby-style variable name to JSON key.
53
+ def self.attribute_map
54
+ {
55
+ :'id' => :'id',
56
+ :'description' => :'description',
57
+ :'invoice_period' => :'invoicePeriod',
58
+ :'quantity' => :'quantity',
59
+ :'amount_excluding_vat' => :'amountExcludingVat',
60
+ :'tax' => :'tax',
61
+ :'accounting_cost_code' => :'accountingCostCode',
62
+ :'image_url' => :'imageUrl'
63
+ }
64
+ end
65
+
66
+ # Attribute type mapping.
67
+ def self.swagger_types
68
+ {
69
+ :'id' => :'String',
70
+ :'description' => :'String',
71
+ :'invoice_period' => :'String',
72
+ :'quantity' => :'Float',
73
+ :'amount_excluding_vat' => :'Float',
74
+ :'tax' => :'InvoiceLineTax',
75
+ :'accounting_cost_code' => :'AccountingCostCode',
76
+ :'image_url' => :'String'
77
+ }
78
+ end
79
+
80
+ # Initializes the object
81
+ # @param [Hash] attributes Model attributes in the form of hash
82
+ def initialize(attributes = {})
83
+ return unless attributes.is_a?(Hash)
84
+
85
+ # convert string to symbol for hash key
86
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
87
+
88
+ if attributes.has_key?(:'id')
89
+ self.id = attributes[:'id']
90
+ end
91
+
92
+ if attributes.has_key?(:'description')
93
+ self.description = attributes[:'description']
94
+ end
95
+
96
+ if attributes.has_key?(:'invoicePeriod')
97
+ self.invoice_period = attributes[:'invoicePeriod']
98
+ end
99
+
100
+ if attributes.has_key?(:'quantity')
101
+ self.quantity = attributes[:'quantity']
102
+ end
103
+
104
+ if attributes.has_key?(:'amountExcludingVat')
105
+ self.amount_excluding_vat = attributes[:'amountExcludingVat']
106
+ end
107
+
108
+ if attributes.has_key?(:'tax')
109
+ self.tax = attributes[:'tax']
110
+ end
111
+
112
+ if attributes.has_key?(:'accountingCostCode')
113
+ self.accounting_cost_code = attributes[:'accountingCostCode']
114
+ end
115
+
116
+ if attributes.has_key?(:'imageUrl')
117
+ self.image_url = attributes[:'imageUrl']
118
+ end
119
+
120
+ end
121
+
122
+ # Show invalid properties with the reasons. Usually used together with valid?
123
+ # @return Array for valid properies with the reasons
124
+ def list_invalid_properties
125
+ invalid_properties = Array.new
126
+
127
+ if !@id.nil? && @id.to_s.length < 1
128
+ invalid_properties.push("invalid value for 'id', the character length must be great than or equal to 1.")
129
+ end
130
+
131
+ if @description.nil?
132
+ invalid_properties.push("invalid value for 'description', description cannot be nil.")
133
+ end
134
+
135
+ if @description.to_s.length < 1
136
+ invalid_properties.push("invalid value for 'description', the character length must be great than or equal to 1.")
137
+ end
138
+
139
+
140
+ if !@invoice_period.nil? && @invoice_period !~ Regexp.new(/^\\d{4}-\\d{2}-\\d{2}\\s+-\\s+\\d{4}-\\d{2}-\\d{2}$/)
141
+ invalid_properties.push("invalid value for 'invoice_period', must conform to the pattern /^\\d{4}-\\d{2}-\\d{2}\\s+-\\s+\\d{4}-\\d{2}-\\d{2}$/.")
142
+ end
143
+
144
+ return invalid_properties
145
+ end
146
+
147
+ # Check to see if the all the properties in the model are valid
148
+ # @return true if the model is valid
149
+ def valid?
150
+ return false if !@id.nil? && @id.to_s.length < 1
151
+ return false if @description.nil?
152
+ return false if @description.to_s.length < 1
153
+ return false if !@invoice_period.nil? && @invoice_period !~ Regexp.new(/^\\d{4}-\\d{2}-\\d{2}\\s+-\\s+\\d{4}-\\d{2}-\\d{2}$/)
154
+ return false if @amount_excluding_vat.nil?
155
+ return true
156
+ end
157
+
158
+ # Custom attribute writer method with validation
159
+ # @param [Object] id Value to be assigned
160
+ def id=(id)
161
+
162
+ if !id.nil? && id.to_s.length < 1
163
+ fail ArgumentError, "invalid value for 'id', the character length must be great than or equal to 1."
164
+ end
165
+
166
+ @id = id
167
+ end
168
+
169
+ # Custom attribute writer method with validation
170
+ # @param [Object] description Value to be assigned
171
+ def description=(description)
172
+ if description.nil?
173
+ fail ArgumentError, "description cannot be nil"
174
+ end
175
+
176
+ if description.to_s.length < 1
177
+ fail ArgumentError, "invalid value for 'description', the character length must be great than or equal to 1."
178
+ end
179
+
180
+ @description = description
181
+ end
182
+
183
+ # Custom attribute writer method with validation
184
+ # @param [Object] invoice_period Value to be assigned
185
+ def invoice_period=(invoice_period)
186
+
187
+ if !invoice_period.nil? && invoice_period !~ Regexp.new(/^\\d{4}-\\d{2}-\\d{2}\\s+-\\s+\\d{4}-\\d{2}-\\d{2}$/)
188
+ fail ArgumentError, "invalid value for 'invoice_period', must conform to the pattern /^\\d{4}-\\d{2}-\\d{2}\\s+-\\s+\\d{4}-\\d{2}-\\d{2}$/."
189
+ end
190
+
191
+ @invoice_period = invoice_period
192
+ end
193
+
194
+ # Checks equality by comparing each attribute.
195
+ # @param [Object] Object to be compared
196
+ def ==(o)
197
+ return true if self.equal?(o)
198
+ self.class == o.class &&
199
+ id == o.id &&
200
+ description == o.description &&
201
+ invoice_period == o.invoice_period &&
202
+ quantity == o.quantity &&
203
+ amount_excluding_vat == o.amount_excluding_vat &&
204
+ tax == o.tax &&
205
+ accounting_cost_code == o.accounting_cost_code &&
206
+ image_url == o.image_url
207
+ end
208
+
209
+ # @see the `==` method
210
+ # @param [Object] Object to be compared
211
+ def eql?(o)
212
+ self == o
213
+ end
214
+
215
+ # Calculates hash code according to all attributes.
216
+ # @return [Fixnum] Hash code
217
+ def hash
218
+ [id, description, invoice_period, quantity, amount_excluding_vat, tax, accounting_cost_code, image_url].hash
219
+ end
220
+
221
+ # Builds the object from hash
222
+ # @param [Hash] attributes Model attributes in the form of hash
223
+ # @return [Object] Returns the model itself
224
+ def build_from_hash(attributes)
225
+ return nil unless attributes.is_a?(Hash)
226
+ self.class.swagger_types.each_pair do |key, type|
227
+ if type =~ /^Array<(.*)>/i
228
+ # check to ensure the input is an array given that the the attribute
229
+ # is documented as an array but the input is not
230
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
231
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
232
+ end
233
+ elsif !attributes[self.class.attribute_map[key]].nil?
234
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
235
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
236
+ end
237
+
238
+ self
239
+ end
240
+
241
+ # Deserializes the data based on type
242
+ # @param string type Data type
243
+ # @param string value Value to be deserialized
244
+ # @return [Object] Deserialized data
245
+ def _deserialize(type, value)
246
+ case type.to_sym
247
+ when :DateTime
248
+ DateTime.parse(value)
249
+ when :Date
250
+ Date.parse(value)
251
+ when :String
252
+ value.to_s
253
+ when :Integer
254
+ value.to_i
255
+ when :Float
256
+ value.to_f
257
+ when :BOOLEAN
258
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
259
+ true
260
+ else
261
+ false
262
+ end
263
+ when :Object
264
+ # generic object (usually a Hash), return directly
265
+ value
266
+ when /\AArray<(?<inner_type>.+)>\z/
267
+ inner_type = Regexp.last_match[:inner_type]
268
+ value.map { |v| _deserialize(inner_type, v) }
269
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
270
+ k_type = Regexp.last_match[:k_type]
271
+ v_type = Regexp.last_match[:v_type]
272
+ {}.tap do |hash|
273
+ value.each do |k, v|
274
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
275
+ end
276
+ end
277
+ else # model
278
+ temp_model = StorecoveApi.const_get(type).new
279
+ temp_model.build_from_hash(value)
280
+ end
281
+ end
282
+
283
+ # Returns the string representation of the object
284
+ # @return [String] String presentation of the object
285
+ def to_s
286
+ to_hash.to_s
287
+ end
288
+
289
+ # to_body is an alias to to_hash (backward compatibility)
290
+ # @return [Hash] Returns the object in the form of hash
291
+ def to_body
292
+ to_hash
293
+ end
294
+
295
+ # Returns the object in the form of hash
296
+ # @return [Hash] Returns the object in the form of hash
297
+ def to_hash
298
+ hash = {}
299
+ self.class.attribute_map.each_pair do |attr, param|
300
+ value = self.send(attr)
301
+ next if value.nil?
302
+ hash[param] = _to_hash(value)
303
+ end
304
+ hash
305
+ end
306
+
307
+ # Outputs non-array value in the form of hash
308
+ # For object, use to_hash. Otherwise, just return the value
309
+ # @param [Object] value Any valid value
310
+ # @return [Hash] Returns the value in the form of hash
311
+ def _to_hash(value)
312
+ if value.is_a?(Array)
313
+ value.compact.map{ |v| _to_hash(v) }
314
+ elsif value.is_a?(Hash)
315
+ {}.tap do |hash|
316
+ value.each { |k, v| hash[k] = _to_hash(v) }
317
+ end
318
+ elsif value.respond_to? :to_hash
319
+ value.to_hash
320
+ else
321
+ value
322
+ end
323
+ end
324
+
325
+ end
326
+
327
+ end
@@ -0,0 +1,222 @@
1
+ =begin
2
+ #Storecove API
3
+
4
+ #Storecove API
5
+
6
+ OpenAPI spec version: 2.0.0
7
+ Contact: apisupport@storecove.nl
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
21
+
22
+ =end
23
+
24
+ require 'date'
25
+
26
+ module StorecoveApi
27
+ # The tax for this invoice line.
28
+ class InvoiceLineTax
29
+ # The amount of VAT. Should equal percentage x amountExcludingVat. A difference of 5 cents or 1% between the calculated value and the provided value is allowed.
30
+ attr_accessor :amount
31
+
32
+ # The percentage VAT. This should be a valid VAT percentage in the country at the time of the issueDate of this invoice.
33
+ attr_accessor :percentage
34
+
35
+ attr_accessor :country
36
+
37
+
38
+ # Attribute mapping from ruby-style variable name to JSON key.
39
+ def self.attribute_map
40
+ {
41
+ :'amount' => :'amount',
42
+ :'percentage' => :'percentage',
43
+ :'country' => :'country'
44
+ }
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.swagger_types
49
+ {
50
+ :'amount' => :'Float',
51
+ :'percentage' => :'Float',
52
+ :'country' => :'Country'
53
+ }
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ return unless attributes.is_a?(Hash)
60
+
61
+ # convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
63
+
64
+ if attributes.has_key?(:'amount')
65
+ self.amount = attributes[:'amount']
66
+ end
67
+
68
+ if attributes.has_key?(:'percentage')
69
+ self.percentage = attributes[:'percentage']
70
+ end
71
+
72
+ if attributes.has_key?(:'country')
73
+ self.country = attributes[:'country']
74
+ end
75
+
76
+ end
77
+
78
+ # Show invalid properties with the reasons. Usually used together with valid?
79
+ # @return Array for valid properies with the reasons
80
+ def list_invalid_properties
81
+ invalid_properties = Array.new
82
+ return invalid_properties
83
+ end
84
+
85
+ # Check to see if the all the properties in the model are valid
86
+ # @return true if the model is valid
87
+ def valid?
88
+ return false if @amount.nil?
89
+ return false if @percentage.nil?
90
+ return false if @country.nil?
91
+ return 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
+ amount == o.amount &&
100
+ percentage == o.percentage &&
101
+ country == o.country
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
+ [amount, percentage, country].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 =~ /^Array<(.*)>/i
123
+ # check to ensure the input is an array given that the 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 =~ /^(true|t|yes|y|1)$/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 = StorecoveApi.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
+
222
+ end