storecove 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
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,321 @@
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 invoice you want Storecove to process, with some meta-data.
28
+ class InvoiceSubmission
29
+ # The mode in which to run this invoice submission.
30
+ attr_accessor :mode
31
+
32
+ # The supplier id, provided by Storecove.
33
+ attr_accessor :supplier_id
34
+
35
+ # If a supplierId has more than one legal entity to send invoices from, specify the legal entity here. If you have not received one or more legal entities, don't supply this field.
36
+ attr_accessor :legal_supplier_id
37
+
38
+ # For internal use only
39
+ attr_accessor :shop_account_id
40
+
41
+ attr_accessor :invoice_recipient
42
+
43
+ # The invoice in PDF form. The document should be base64 encoded and the enocded string length should not exceed 2MB (2097152 bytes).
44
+ attr_accessor :document
45
+
46
+ # A URL to retrieve the PDF document via HTTP GET. If the link expires, please allow at least 7 days of validity.
47
+ attr_accessor :document_url
48
+
49
+ attr_accessor :invoice
50
+
51
+ class EnumAttributeValidator
52
+ attr_reader :datatype
53
+ attr_reader :allowable_values
54
+
55
+ def initialize(datatype, allowable_values)
56
+ @allowable_values = allowable_values.map do |value|
57
+ case datatype.to_s
58
+ when /Integer/i
59
+ value.to_i
60
+ when /Float/i
61
+ value.to_f
62
+ else
63
+ value
64
+ end
65
+ end
66
+ end
67
+
68
+ def valid?(value)
69
+ !value || allowable_values.include?(value)
70
+ end
71
+ end
72
+
73
+ # Attribute mapping from ruby-style variable name to JSON key.
74
+ def self.attribute_map
75
+ {
76
+ :'mode' => :'mode',
77
+ :'supplier_id' => :'supplierId',
78
+ :'legal_supplier_id' => :'legalSupplierId',
79
+ :'shop_account_id' => :'shopAccountId',
80
+ :'invoice_recipient' => :'invoiceRecipient',
81
+ :'document' => :'document',
82
+ :'document_url' => :'documentUrl',
83
+ :'invoice' => :'invoice'
84
+ }
85
+ end
86
+
87
+ # Attribute type mapping.
88
+ def self.swagger_types
89
+ {
90
+ :'mode' => :'String',
91
+ :'supplier_id' => :'Integer',
92
+ :'legal_supplier_id' => :'Integer',
93
+ :'shop_account_id' => :'Integer',
94
+ :'invoice_recipient' => :'InvoiceRecipient',
95
+ :'document' => :'String',
96
+ :'document_url' => :'String',
97
+ :'invoice' => :'InvoiceSubmissionInvoice'
98
+ }
99
+ end
100
+
101
+ # Initializes the object
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ def initialize(attributes = {})
104
+ return unless attributes.is_a?(Hash)
105
+
106
+ # convert string to symbol for hash key
107
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
108
+
109
+ if attributes.has_key?(:'mode')
110
+ self.mode = attributes[:'mode']
111
+ end
112
+
113
+ if attributes.has_key?(:'supplierId')
114
+ self.supplier_id = attributes[:'supplierId']
115
+ end
116
+
117
+ if attributes.has_key?(:'legalSupplierId')
118
+ self.legal_supplier_id = attributes[:'legalSupplierId']
119
+ end
120
+
121
+ if attributes.has_key?(:'shopAccountId')
122
+ self.shop_account_id = attributes[:'shopAccountId']
123
+ end
124
+
125
+ if attributes.has_key?(:'invoiceRecipient')
126
+ self.invoice_recipient = attributes[:'invoiceRecipient']
127
+ end
128
+
129
+ if attributes.has_key?(:'document')
130
+ self.document = attributes[:'document']
131
+ end
132
+
133
+ if attributes.has_key?(:'documentUrl')
134
+ self.document_url = attributes[:'documentUrl']
135
+ end
136
+
137
+ if attributes.has_key?(:'invoice')
138
+ self.invoice = attributes[:'invoice']
139
+ end
140
+
141
+ end
142
+
143
+ # Show invalid properties with the reasons. Usually used together with valid?
144
+ # @return Array for valid properies with the reasons
145
+ def list_invalid_properties
146
+ invalid_properties = Array.new
147
+
148
+ if !@document.nil? && @document.to_s.length < 5
149
+ invalid_properties.push("invalid value for 'document', the character length must be great than or equal to 5.")
150
+ end
151
+
152
+ return invalid_properties
153
+ end
154
+
155
+ # Check to see if the all the properties in the model are valid
156
+ # @return true if the model is valid
157
+ def valid?
158
+ return false if @mode.nil?
159
+ mode_validator = EnumAttributeValidator.new('String', ["direct"])
160
+ return false unless mode_validator.valid?(@mode)
161
+ return false if @supplier_id.nil?
162
+ return false if @invoice_recipient.nil?
163
+ return false if !@document.nil? && @document.to_s.length < 5
164
+ return true
165
+ end
166
+
167
+ # Custom attribute writer method checking allowed values (enum).
168
+ # @param [Object] mode Object to be assigned
169
+ def mode=(mode)
170
+ validator = EnumAttributeValidator.new('String', ["direct"])
171
+ unless validator.valid?(mode)
172
+ fail ArgumentError, "invalid value for 'mode', must be one of #{validator.allowable_values}."
173
+ end
174
+ @mode = mode
175
+ end
176
+
177
+ # Custom attribute writer method with validation
178
+ # @param [Object] document Value to be assigned
179
+ def document=(document)
180
+
181
+ if !document.nil? && document.to_s.length < 5
182
+ fail ArgumentError, "invalid value for 'document', the character length must be great than or equal to 5."
183
+ end
184
+
185
+ @document = document
186
+ end
187
+
188
+ # Checks equality by comparing each attribute.
189
+ # @param [Object] Object to be compared
190
+ def ==(o)
191
+ return true if self.equal?(o)
192
+ self.class == o.class &&
193
+ mode == o.mode &&
194
+ supplier_id == o.supplier_id &&
195
+ legal_supplier_id == o.legal_supplier_id &&
196
+ shop_account_id == o.shop_account_id &&
197
+ invoice_recipient == o.invoice_recipient &&
198
+ document == o.document &&
199
+ document_url == o.document_url &&
200
+ invoice == o.invoice
201
+ end
202
+
203
+ # @see the `==` method
204
+ # @param [Object] Object to be compared
205
+ def eql?(o)
206
+ self == o
207
+ end
208
+
209
+ # Calculates hash code according to all attributes.
210
+ # @return [Fixnum] Hash code
211
+ def hash
212
+ [mode, supplier_id, legal_supplier_id, shop_account_id, invoice_recipient, document, document_url, invoice].hash
213
+ end
214
+
215
+ # Builds the object from hash
216
+ # @param [Hash] attributes Model attributes in the form of hash
217
+ # @return [Object] Returns the model itself
218
+ def build_from_hash(attributes)
219
+ return nil unless attributes.is_a?(Hash)
220
+ self.class.swagger_types.each_pair do |key, type|
221
+ if type =~ /^Array<(.*)>/i
222
+ # check to ensure the input is an array given that the the attribute
223
+ # is documented as an array but the input is not
224
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
225
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
226
+ end
227
+ elsif !attributes[self.class.attribute_map[key]].nil?
228
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
229
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
230
+ end
231
+
232
+ self
233
+ end
234
+
235
+ # Deserializes the data based on type
236
+ # @param string type Data type
237
+ # @param string value Value to be deserialized
238
+ # @return [Object] Deserialized data
239
+ def _deserialize(type, value)
240
+ case type.to_sym
241
+ when :DateTime
242
+ DateTime.parse(value)
243
+ when :Date
244
+ Date.parse(value)
245
+ when :String
246
+ value.to_s
247
+ when :Integer
248
+ value.to_i
249
+ when :Float
250
+ value.to_f
251
+ when :BOOLEAN
252
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
253
+ true
254
+ else
255
+ false
256
+ end
257
+ when :Object
258
+ # generic object (usually a Hash), return directly
259
+ value
260
+ when /\AArray<(?<inner_type>.+)>\z/
261
+ inner_type = Regexp.last_match[:inner_type]
262
+ value.map { |v| _deserialize(inner_type, v) }
263
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
264
+ k_type = Regexp.last_match[:k_type]
265
+ v_type = Regexp.last_match[:v_type]
266
+ {}.tap do |hash|
267
+ value.each do |k, v|
268
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
269
+ end
270
+ end
271
+ else # model
272
+ temp_model = StorecoveApi.const_get(type).new
273
+ temp_model.build_from_hash(value)
274
+ end
275
+ end
276
+
277
+ # Returns the string representation of the object
278
+ # @return [String] String presentation of the object
279
+ def to_s
280
+ to_hash.to_s
281
+ end
282
+
283
+ # to_body is an alias to to_hash (backward compatibility)
284
+ # @return [Hash] Returns the object in the form of hash
285
+ def to_body
286
+ to_hash
287
+ end
288
+
289
+ # Returns the object in the form of hash
290
+ # @return [Hash] Returns the object in the form of hash
291
+ def to_hash
292
+ hash = {}
293
+ self.class.attribute_map.each_pair do |attr, param|
294
+ value = self.send(attr)
295
+ next if value.nil?
296
+ hash[param] = _to_hash(value)
297
+ end
298
+ hash
299
+ end
300
+
301
+ # Outputs non-array value in the form of hash
302
+ # For object, use to_hash. Otherwise, just return the value
303
+ # @param [Object] value Any valid value
304
+ # @return [Hash] Returns the value in the form of hash
305
+ def _to_hash(value)
306
+ if value.is_a?(Array)
307
+ value.compact.map{ |v| _to_hash(v) }
308
+ elsif value.is_a?(Hash)
309
+ {}.tap do |hash|
310
+ value.each { |k, v| hash[k] = _to_hash(v) }
311
+ end
312
+ elsif value.respond_to? :to_hash
313
+ value.to_hash
314
+ else
315
+ value
316
+ end
317
+ end
318
+
319
+ end
320
+
321
+ end