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.
- checksums.yaml +4 -4
- data/Gemfile +7 -0
- data/Gemfile.lock +69 -0
- data/lib/storecove.rb +20 -1
- data/lib/storecove/api/invoice_submissions_api.rb +9 -4
- data/lib/storecove/api/legal_entities_api.rb +248 -0
- data/lib/storecove/api/peppol_identifiers_api.rb +156 -0
- data/lib/storecove/api/purchase_invoices_api.rb +133 -0
- data/lib/storecove/api/shop_account_requests_api.rb +24 -11
- data/lib/storecove/api/shop_accounts_api.rb +25 -12
- data/lib/storecove/api/shops_api.rb +2 -1
- data/lib/storecove/api_client.rb +39 -26
- data/lib/storecove/api_error.rb +1 -0
- data/lib/storecove/configuration.rb +7 -0
- data/lib/storecove/models/accounting_cost_code.rb +2 -1
- data/lib/storecove/models/accounting_customer_party.rb +2 -1
- data/lib/storecove/models/accounting_details.rb +219 -0
- data/lib/storecove/models/accounting_details_1.rb +219 -0
- data/lib/storecove/models/address.rb +2 -1
- data/lib/storecove/models/contact.rb +2 -6
- data/lib/storecove/models/country.rb +10 -0
- data/lib/storecove/models/currency_code.rb +10 -0
- data/lib/storecove/models/error_model.rb +2 -1
- data/lib/storecove/models/invoice.rb +16 -3
- data/lib/storecove/models/invoice_line.rb +251 -6
- data/lib/storecove/models/invoice_recipient.rb +24 -11
- data/lib/storecove/models/invoice_recipient_preflight.rb +21 -19
- data/lib/storecove/models/invoice_submission.rb +20 -9
- data/lib/storecove/models/invoice_submission_result.rb +2 -1
- data/lib/storecove/models/legal_entity.rb +164 -25
- data/lib/storecove/models/legal_entity_create.rb +417 -0
- data/lib/storecove/models/legal_entity_identifier.rb +2 -1
- data/lib/storecove/models/legal_entity_shop.rb +253 -0
- data/lib/storecove/models/legal_entity_update.rb +380 -0
- data/lib/storecove/models/logos.rb +2 -1
- data/lib/storecove/models/party.rb +7 -1
- data/lib/storecove/models/payment_means.rb +199 -0
- data/lib/storecove/models/peppol_identifier.rb +284 -0
- data/lib/storecove/models/peppol_identifier_create.rb +308 -0
- data/lib/storecove/models/preflight_invoice_recipient_result.rb +2 -1
- data/lib/storecove/models/public_identifier.rb +3 -2
- data/lib/storecove/models/public_identifiers.rb +2 -1
- data/lib/storecove/models/purchase_invoice.rb +463 -0
- data/lib/storecove/models/purchase_invoice_invoice_line.rb +247 -0
- data/lib/storecove/models/purchase_invoice_sender.rb +280 -0
- data/lib/storecove/models/purchase_invoice_sender_billing_contact.rb +209 -0
- data/lib/storecove/models/purchase_invoice_ubl.rb +209 -0
- data/lib/storecove/models/shop.rb +3 -2
- data/lib/storecove/models/shop_account_input.rb +2 -1
- data/lib/storecove/models/shop_account_request_input.rb +2 -1
- data/lib/storecove/models/shop_account_request_result.rb +2 -1
- data/lib/storecove/models/shop_account_request_update.rb +2 -1
- data/lib/storecove/models/shop_account_result.rb +2 -1
- data/lib/storecove/models/shop_account_update.rb +2 -1
- data/lib/storecove/models/tax.rb +2 -1
- data/lib/storecove/models/vat_details.rb +209 -0
- data/lib/storecove/models/widget_identification.rb +228 -0
- data/lib/storecove/version.rb +2 -1
- data/spec/api/invoice_submissions_api_spec.rb +9 -20
- data/spec/api/legal_entities_api_spec.rb +84 -0
- data/spec/api/peppol_identifiers_api_spec.rb +63 -0
- data/spec/api/purchase_invoices_api_spec.rb +59 -0
- data/spec/api/shop_account_requests_api_spec.rb +30 -41
- data/spec/api/shop_accounts_api_spec.rb +34 -45
- data/spec/api/shops_api_spec.rb +6 -17
- data/spec/api_client_spec.rb +2 -13
- data/spec/configuration_spec.rb +2 -13
- data/spec/models/accounting_cost_code_spec.rb +3 -14
- data/spec/models/accounting_customer_party_spec.rb +3 -14
- data/spec/models/accounting_details_1_spec.rb +60 -0
- data/spec/models/accounting_details_spec.rb +60 -0
- data/spec/models/{party_address_spec.rb → address_spec.rb} +8 -19
- data/spec/models/{party_contact_spec.rb → contact_spec.rb} +8 -19
- data/spec/models/country_spec.rb +3 -14
- data/spec/models/currency_code_spec.rb +3 -14
- data/spec/models/error_model_spec.rb +3 -14
- data/spec/models/invoice_line_spec.rb +69 -14
- data/spec/models/invoice_recipient_preflight_spec.rb +10 -15
- data/spec/models/invoice_recipient_spec.rb +15 -14
- data/spec/models/{invoice_submission_invoice_spec.rb → invoice_spec.rb} +20 -19
- data/spec/models/invoice_submission_result_spec.rb +4 -15
- data/spec/models/invoice_submission_spec.rb +4 -15
- data/spec/models/legal_entity_create_spec.rb +78 -0
- data/spec/models/legal_entity_identifier_spec.rb +3 -14
- data/spec/models/legal_entity_shop_spec.rb +84 -0
- data/spec/models/legal_entity_spec.rb +7 -18
- data/spec/models/legal_entity_update_spec.rb +78 -0
- data/spec/models/logos_spec.rb +3 -14
- data/spec/models/party_spec.rb +3 -14
- data/spec/models/payment_means_spec.rb +48 -0
- data/spec/models/peppol_identifier_create_spec.rb +54 -0
- data/spec/models/peppol_identifier_spec.rb +54 -0
- data/spec/models/preflight_invoice_recipient_result_spec.rb +3 -14
- data/spec/models/public_identifier_spec.rb +3 -14
- data/spec/models/public_identifiers_spec.rb +3 -14
- data/spec/models/purchase_invoice_invoice_line_spec.rb +78 -0
- data/spec/models/purchase_invoice_sender_billing_contact_spec.rb +54 -0
- data/spec/models/purchase_invoice_sender_spec.rb +96 -0
- data/spec/models/purchase_invoice_spec.rb +188 -0
- data/spec/models/purchase_invoice_ubl_spec.rb +54 -0
- data/spec/models/shop_account_input_spec.rb +3 -14
- data/spec/models/shop_account_request_input_spec.rb +3 -14
- data/spec/models/{shop_account_request_spec.rb → shop_account_request_result_spec.rb} +8 -19
- data/spec/models/shop_account_request_update_spec.rb +3 -14
- data/spec/models/shop_account_result_spec.rb +3 -14
- data/spec/models/shop_account_update_spec.rb +3 -14
- data/spec/models/shop_spec.rb +3 -14
- data/spec/models/{invoice_line_tax_spec.rb → tax_spec.rb} +8 -19
- data/spec/models/vat_details_spec.rb +54 -0
- data/spec/models/widget_identification_spec.rb +48 -0
- data/spec/spec_helper.rb +2 -13
- data/storecove.gemspec +10 -19
- metadata +83 -28
@@ -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
|
|
@@ -68,7 +69,7 @@ module StorecoveApi
|
|
68
69
|
end
|
69
70
|
|
70
71
|
# Show invalid properties with the reasons. Usually used together with valid?
|
71
|
-
# @return Array for valid
|
72
|
+
# @return Array for valid properties with the reasons
|
72
73
|
def list_invalid_properties
|
73
74
|
invalid_properties = Array.new
|
74
75
|
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
|
|
@@ -14,7 +15,7 @@ require 'date'
|
|
14
15
|
module StorecoveApi
|
15
16
|
# A public identifier for this customer.
|
16
17
|
class PublicIdentifier
|
17
|
-
# The scheme of the
|
18
|
+
# The scheme of the identifier. See <<_company>> for a list.
|
18
19
|
attr_accessor :scheme
|
19
20
|
|
20
21
|
# The actual identifier.
|
@@ -56,7 +57,7 @@ module StorecoveApi
|
|
56
57
|
end
|
57
58
|
|
58
59
|
# Show invalid properties with the reasons. Usually used together with valid?
|
59
|
-
# @return Array for valid
|
60
|
+
# @return Array for valid properties with the reasons
|
60
61
|
def list_invalid_properties
|
61
62
|
invalid_properties = Array.new
|
62
63
|
if @scheme.nil?
|
@@ -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
|
|
@@ -38,7 +39,7 @@ module StorecoveApi
|
|
38
39
|
end
|
39
40
|
|
40
41
|
# Show invalid properties with the reasons. Usually used together with valid?
|
41
|
-
# @return Array for valid
|
42
|
+
# @return Array for valid properties with the reasons
|
42
43
|
def list_invalid_properties
|
43
44
|
invalid_properties = Array.new
|
44
45
|
return invalid_properties
|
@@ -0,0 +1,463 @@
|
|
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 PurchaseInvoice
|
18
|
+
# The GUID of the invoice
|
19
|
+
attr_accessor :guid
|
20
|
+
|
21
|
+
# The id of the LegalEntity the invoice was received for.
|
22
|
+
attr_accessor :legal_entity_id
|
23
|
+
|
24
|
+
# The Base64 encoded PDF document associated with the invoice.
|
25
|
+
attr_accessor :document
|
26
|
+
|
27
|
+
# The invoicenumber.
|
28
|
+
attr_accessor :invoice_number
|
29
|
+
|
30
|
+
# The date the invoice was issued. Format \"YYYY-MM-DD\".
|
31
|
+
attr_accessor :issue_date
|
32
|
+
|
33
|
+
# The date the invoice was issued for tax purposes. In most countries MUST match the issue_date. Format \"YYYY-MM-DD\".
|
34
|
+
attr_accessor :tax_point_date
|
35
|
+
|
36
|
+
# The date the invoice must be payed by. Format \"YYYY-MM-DD\".
|
37
|
+
attr_accessor :due_date
|
38
|
+
|
39
|
+
# The ISO 4217 currency for the invoice.
|
40
|
+
attr_accessor :document_currency_code
|
41
|
+
|
42
|
+
# Whether or not the invoice is reverse charged.
|
43
|
+
attr_accessor :vat_reverse_charge
|
44
|
+
|
45
|
+
# The total invoice amount payable, including VAT. This is equal to the sum of the invoice_lines (amount_excluding_vat + vat.amount)
|
46
|
+
attr_accessor :amount_including_vat
|
47
|
+
|
48
|
+
# A correction on the amount to pay, for instance if the invoice has been prepaid, in which case it will be negative.
|
49
|
+
attr_accessor :allowance_charge
|
50
|
+
|
51
|
+
# The difference between the invoice total and the sum of the invoice lines.
|
52
|
+
attr_accessor :payable_rounding_amount
|
53
|
+
|
54
|
+
# The total invoice amount payable including VAT. This is equal to amount_including_vat + allowance_charge + payable_rounding_amount. This property is redundant and provided only to make invoice processing more easy. You can also choose to only store this property, instead of the underlying fields.
|
55
|
+
attr_accessor :payable_amount
|
56
|
+
|
57
|
+
# The source the invoice was received from.
|
58
|
+
attr_accessor :source
|
59
|
+
|
60
|
+
# The organzation that sent the invoice.
|
61
|
+
attr_accessor :sender
|
62
|
+
|
63
|
+
# The type of invoice.
|
64
|
+
attr_accessor :invoice_type
|
65
|
+
|
66
|
+
# The start date of the period this invoice relates to. Format \"YYYY-MM-DD\".
|
67
|
+
attr_accessor :period_start
|
68
|
+
|
69
|
+
# The end date of the period this invoice relates to. Format \"YYYY-MM-DD\".
|
70
|
+
attr_accessor :period_end
|
71
|
+
|
72
|
+
# The end date of the period this invoice relates to. Format \"YYYY-MM-DD\".
|
73
|
+
attr_accessor :buyer_reference
|
74
|
+
|
75
|
+
# The end date of the period this invoice relates to. Format \"YYYY-MM-DD\".
|
76
|
+
attr_accessor :billing_reference
|
77
|
+
|
78
|
+
# The end date of the period this invoice relates to. Format \"YYYY-MM-DD\".
|
79
|
+
attr_accessor :contract_document_reference
|
80
|
+
|
81
|
+
attr_accessor :invoice_lines
|
82
|
+
|
83
|
+
attr_accessor :accounting
|
84
|
+
|
85
|
+
attr_accessor :payment_means
|
86
|
+
|
87
|
+
class EnumAttributeValidator
|
88
|
+
attr_reader :datatype
|
89
|
+
attr_reader :allowable_values
|
90
|
+
|
91
|
+
def initialize(datatype, allowable_values)
|
92
|
+
@allowable_values = allowable_values.map do |value|
|
93
|
+
case datatype.to_s
|
94
|
+
when /Integer/i
|
95
|
+
value.to_i
|
96
|
+
when /Float/i
|
97
|
+
value.to_f
|
98
|
+
else
|
99
|
+
value
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def valid?(value)
|
105
|
+
!value || allowable_values.include?(value)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
110
|
+
def self.attribute_map
|
111
|
+
{
|
112
|
+
:'guid' => :'guid',
|
113
|
+
:'legal_entity_id' => :'legal_entity_id',
|
114
|
+
:'document' => :'document',
|
115
|
+
:'invoice_number' => :'invoice_number',
|
116
|
+
:'issue_date' => :'issue_date',
|
117
|
+
:'tax_point_date' => :'tax_point_date',
|
118
|
+
:'due_date' => :'due_date',
|
119
|
+
:'document_currency_code' => :'document_currency_code',
|
120
|
+
:'vat_reverse_charge' => :'vat_reverse_charge',
|
121
|
+
:'amount_including_vat' => :'amount_including_vat',
|
122
|
+
:'allowance_charge' => :'allowance_charge',
|
123
|
+
:'payable_rounding_amount' => :'payable_rounding_amount',
|
124
|
+
:'payable_amount' => :'payable_amount',
|
125
|
+
:'source' => :'source',
|
126
|
+
:'sender' => :'sender',
|
127
|
+
:'invoice_type' => :'invoice_type',
|
128
|
+
:'period_start' => :'period_start',
|
129
|
+
:'period_end' => :'period_end',
|
130
|
+
:'buyer_reference' => :'buyer_reference',
|
131
|
+
:'billing_reference' => :'billing_reference',
|
132
|
+
:'contract_document_reference' => :'contract_document_reference',
|
133
|
+
:'invoice_lines' => :'invoice_lines',
|
134
|
+
:'accounting' => :'accounting',
|
135
|
+
:'payment_means' => :'payment_means'
|
136
|
+
}
|
137
|
+
end
|
138
|
+
|
139
|
+
# Attribute type mapping.
|
140
|
+
def self.swagger_types
|
141
|
+
{
|
142
|
+
:'guid' => :'String',
|
143
|
+
:'legal_entity_id' => :'Integer',
|
144
|
+
:'document' => :'String',
|
145
|
+
:'invoice_number' => :'String',
|
146
|
+
:'issue_date' => :'String',
|
147
|
+
:'tax_point_date' => :'String',
|
148
|
+
:'due_date' => :'String',
|
149
|
+
:'document_currency_code' => :'String',
|
150
|
+
:'vat_reverse_charge' => :'BOOLEAN',
|
151
|
+
:'amount_including_vat' => :'Float',
|
152
|
+
:'allowance_charge' => :'Float',
|
153
|
+
:'payable_rounding_amount' => :'Float',
|
154
|
+
:'payable_amount' => :'Float',
|
155
|
+
:'source' => :'String',
|
156
|
+
:'sender' => :'PurchaseInvoiceSender',
|
157
|
+
:'invoice_type' => :'String',
|
158
|
+
:'period_start' => :'String',
|
159
|
+
:'period_end' => :'String',
|
160
|
+
:'buyer_reference' => :'String',
|
161
|
+
:'billing_reference' => :'String',
|
162
|
+
:'contract_document_reference' => :'String',
|
163
|
+
:'invoice_lines' => :'Array<PurchaseInvoiceInvoiceLine>',
|
164
|
+
:'accounting' => :'AccountingDetails',
|
165
|
+
:'payment_means' => :'PaymentMeans'
|
166
|
+
}
|
167
|
+
end
|
168
|
+
|
169
|
+
# Initializes the object
|
170
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
171
|
+
def initialize(attributes = {})
|
172
|
+
return unless attributes.is_a?(Hash)
|
173
|
+
|
174
|
+
# convert string to symbol for hash key
|
175
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
176
|
+
|
177
|
+
if attributes.has_key?(:'guid')
|
178
|
+
self.guid = attributes[:'guid']
|
179
|
+
end
|
180
|
+
|
181
|
+
if attributes.has_key?(:'legal_entity_id')
|
182
|
+
self.legal_entity_id = attributes[:'legal_entity_id']
|
183
|
+
end
|
184
|
+
|
185
|
+
if attributes.has_key?(:'document')
|
186
|
+
self.document = attributes[:'document']
|
187
|
+
end
|
188
|
+
|
189
|
+
if attributes.has_key?(:'invoice_number')
|
190
|
+
self.invoice_number = attributes[:'invoice_number']
|
191
|
+
end
|
192
|
+
|
193
|
+
if attributes.has_key?(:'issue_date')
|
194
|
+
self.issue_date = attributes[:'issue_date']
|
195
|
+
end
|
196
|
+
|
197
|
+
if attributes.has_key?(:'tax_point_date')
|
198
|
+
self.tax_point_date = attributes[:'tax_point_date']
|
199
|
+
end
|
200
|
+
|
201
|
+
if attributes.has_key?(:'due_date')
|
202
|
+
self.due_date = attributes[:'due_date']
|
203
|
+
end
|
204
|
+
|
205
|
+
if attributes.has_key?(:'document_currency_code')
|
206
|
+
self.document_currency_code = attributes[:'document_currency_code']
|
207
|
+
end
|
208
|
+
|
209
|
+
if attributes.has_key?(:'vat_reverse_charge')
|
210
|
+
self.vat_reverse_charge = attributes[:'vat_reverse_charge']
|
211
|
+
end
|
212
|
+
|
213
|
+
if attributes.has_key?(:'amount_including_vat')
|
214
|
+
self.amount_including_vat = attributes[:'amount_including_vat']
|
215
|
+
end
|
216
|
+
|
217
|
+
if attributes.has_key?(:'allowance_charge')
|
218
|
+
self.allowance_charge = attributes[:'allowance_charge']
|
219
|
+
end
|
220
|
+
|
221
|
+
if attributes.has_key?(:'payable_rounding_amount')
|
222
|
+
self.payable_rounding_amount = attributes[:'payable_rounding_amount']
|
223
|
+
end
|
224
|
+
|
225
|
+
if attributes.has_key?(:'payable_amount')
|
226
|
+
self.payable_amount = attributes[:'payable_amount']
|
227
|
+
end
|
228
|
+
|
229
|
+
if attributes.has_key?(:'source')
|
230
|
+
self.source = attributes[:'source']
|
231
|
+
end
|
232
|
+
|
233
|
+
if attributes.has_key?(:'sender')
|
234
|
+
self.sender = attributes[:'sender']
|
235
|
+
end
|
236
|
+
|
237
|
+
if attributes.has_key?(:'invoice_type')
|
238
|
+
self.invoice_type = attributes[:'invoice_type']
|
239
|
+
end
|
240
|
+
|
241
|
+
if attributes.has_key?(:'period_start')
|
242
|
+
self.period_start = attributes[:'period_start']
|
243
|
+
end
|
244
|
+
|
245
|
+
if attributes.has_key?(:'period_end')
|
246
|
+
self.period_end = attributes[:'period_end']
|
247
|
+
end
|
248
|
+
|
249
|
+
if attributes.has_key?(:'buyer_reference')
|
250
|
+
self.buyer_reference = attributes[:'buyer_reference']
|
251
|
+
end
|
252
|
+
|
253
|
+
if attributes.has_key?(:'billing_reference')
|
254
|
+
self.billing_reference = attributes[:'billing_reference']
|
255
|
+
end
|
256
|
+
|
257
|
+
if attributes.has_key?(:'contract_document_reference')
|
258
|
+
self.contract_document_reference = attributes[:'contract_document_reference']
|
259
|
+
end
|
260
|
+
|
261
|
+
if attributes.has_key?(:'invoice_lines')
|
262
|
+
if (value = attributes[:'invoice_lines']).is_a?(Array)
|
263
|
+
self.invoice_lines = value
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
if attributes.has_key?(:'accounting')
|
268
|
+
self.accounting = attributes[:'accounting']
|
269
|
+
end
|
270
|
+
|
271
|
+
if attributes.has_key?(:'payment_means')
|
272
|
+
self.payment_means = attributes[:'payment_means']
|
273
|
+
end
|
274
|
+
|
275
|
+
end
|
276
|
+
|
277
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
278
|
+
# @return Array for valid properties with the reasons
|
279
|
+
def list_invalid_properties
|
280
|
+
invalid_properties = Array.new
|
281
|
+
return invalid_properties
|
282
|
+
end
|
283
|
+
|
284
|
+
# Check to see if the all the properties in the model are valid
|
285
|
+
# @return true if the model is valid
|
286
|
+
def valid?
|
287
|
+
source_validator = EnumAttributeValidator.new('String', ["peppol", "script", "supplier", "email"])
|
288
|
+
return false unless source_validator.valid?(@source)
|
289
|
+
invoice_type_validator = EnumAttributeValidator.new('String', ["invoice", "creditnote", "correctioninvoice"])
|
290
|
+
return false unless invoice_type_validator.valid?(@invoice_type)
|
291
|
+
return true
|
292
|
+
end
|
293
|
+
|
294
|
+
# Custom attribute writer method checking allowed values (enum).
|
295
|
+
# @param [Object] source Object to be assigned
|
296
|
+
def source=(source)
|
297
|
+
validator = EnumAttributeValidator.new('String', ["peppol", "script", "supplier", "email"])
|
298
|
+
unless validator.valid?(source)
|
299
|
+
fail ArgumentError, "invalid value for 'source', must be one of #{validator.allowable_values}."
|
300
|
+
end
|
301
|
+
@source = source
|
302
|
+
end
|
303
|
+
|
304
|
+
# Custom attribute writer method checking allowed values (enum).
|
305
|
+
# @param [Object] invoice_type Object to be assigned
|
306
|
+
def invoice_type=(invoice_type)
|
307
|
+
validator = EnumAttributeValidator.new('String', ["invoice", "creditnote", "correctioninvoice"])
|
308
|
+
unless validator.valid?(invoice_type)
|
309
|
+
fail ArgumentError, "invalid value for 'invoice_type', must be one of #{validator.allowable_values}."
|
310
|
+
end
|
311
|
+
@invoice_type = invoice_type
|
312
|
+
end
|
313
|
+
|
314
|
+
# Checks equality by comparing each attribute.
|
315
|
+
# @param [Object] Object to be compared
|
316
|
+
def ==(o)
|
317
|
+
return true if self.equal?(o)
|
318
|
+
self.class == o.class &&
|
319
|
+
guid == o.guid &&
|
320
|
+
legal_entity_id == o.legal_entity_id &&
|
321
|
+
document == o.document &&
|
322
|
+
invoice_number == o.invoice_number &&
|
323
|
+
issue_date == o.issue_date &&
|
324
|
+
tax_point_date == o.tax_point_date &&
|
325
|
+
due_date == o.due_date &&
|
326
|
+
document_currency_code == o.document_currency_code &&
|
327
|
+
vat_reverse_charge == o.vat_reverse_charge &&
|
328
|
+
amount_including_vat == o.amount_including_vat &&
|
329
|
+
allowance_charge == o.allowance_charge &&
|
330
|
+
payable_rounding_amount == o.payable_rounding_amount &&
|
331
|
+
payable_amount == o.payable_amount &&
|
332
|
+
source == o.source &&
|
333
|
+
sender == o.sender &&
|
334
|
+
invoice_type == o.invoice_type &&
|
335
|
+
period_start == o.period_start &&
|
336
|
+
period_end == o.period_end &&
|
337
|
+
buyer_reference == o.buyer_reference &&
|
338
|
+
billing_reference == o.billing_reference &&
|
339
|
+
contract_document_reference == o.contract_document_reference &&
|
340
|
+
invoice_lines == o.invoice_lines &&
|
341
|
+
accounting == o.accounting &&
|
342
|
+
payment_means == o.payment_means
|
343
|
+
end
|
344
|
+
|
345
|
+
# @see the `==` method
|
346
|
+
# @param [Object] Object to be compared
|
347
|
+
def eql?(o)
|
348
|
+
self == o
|
349
|
+
end
|
350
|
+
|
351
|
+
# Calculates hash code according to all attributes.
|
352
|
+
# @return [Fixnum] Hash code
|
353
|
+
def hash
|
354
|
+
[guid, legal_entity_id, document, invoice_number, issue_date, tax_point_date, due_date, document_currency_code, vat_reverse_charge, amount_including_vat, allowance_charge, payable_rounding_amount, payable_amount, source, sender, invoice_type, period_start, period_end, buyer_reference, billing_reference, contract_document_reference, invoice_lines, accounting, payment_means].hash
|
355
|
+
end
|
356
|
+
|
357
|
+
# Builds the object from hash
|
358
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
359
|
+
# @return [Object] Returns the model itself
|
360
|
+
def build_from_hash(attributes)
|
361
|
+
return nil unless attributes.is_a?(Hash)
|
362
|
+
self.class.swagger_types.each_pair do |key, type|
|
363
|
+
if type =~ /\AArray<(.*)>/i
|
364
|
+
# check to ensure the input is an array given that the the attribute
|
365
|
+
# is documented as an array but the input is not
|
366
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
367
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
368
|
+
end
|
369
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
370
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
371
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
372
|
+
end
|
373
|
+
|
374
|
+
self
|
375
|
+
end
|
376
|
+
|
377
|
+
# Deserializes the data based on type
|
378
|
+
# @param string type Data type
|
379
|
+
# @param string value Value to be deserialized
|
380
|
+
# @return [Object] Deserialized data
|
381
|
+
def _deserialize(type, value)
|
382
|
+
case type.to_sym
|
383
|
+
when :DateTime
|
384
|
+
DateTime.parse(value)
|
385
|
+
when :Date
|
386
|
+
Date.parse(value)
|
387
|
+
when :String
|
388
|
+
value.to_s
|
389
|
+
when :Integer
|
390
|
+
value.to_i
|
391
|
+
when :Float
|
392
|
+
value.to_f
|
393
|
+
when :BOOLEAN
|
394
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
395
|
+
true
|
396
|
+
else
|
397
|
+
false
|
398
|
+
end
|
399
|
+
when :Object
|
400
|
+
# generic object (usually a Hash), return directly
|
401
|
+
value
|
402
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
403
|
+
inner_type = Regexp.last_match[:inner_type]
|
404
|
+
value.map { |v| _deserialize(inner_type, v) }
|
405
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
406
|
+
k_type = Regexp.last_match[:k_type]
|
407
|
+
v_type = Regexp.last_match[:v_type]
|
408
|
+
{}.tap do |hash|
|
409
|
+
value.each do |k, v|
|
410
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
411
|
+
end
|
412
|
+
end
|
413
|
+
else # model
|
414
|
+
temp_model = StorecoveApi.const_get(type).new
|
415
|
+
temp_model.build_from_hash(value)
|
416
|
+
end
|
417
|
+
end
|
418
|
+
|
419
|
+
# Returns the string representation of the object
|
420
|
+
# @return [String] String presentation of the object
|
421
|
+
def to_s
|
422
|
+
to_hash.to_s
|
423
|
+
end
|
424
|
+
|
425
|
+
# to_body is an alias to to_hash (backward compatibility)
|
426
|
+
# @return [Hash] Returns the object in the form of hash
|
427
|
+
def to_body
|
428
|
+
to_hash
|
429
|
+
end
|
430
|
+
|
431
|
+
# Returns the object in the form of hash
|
432
|
+
# @return [Hash] Returns the object in the form of hash
|
433
|
+
def to_hash
|
434
|
+
hash = {}
|
435
|
+
self.class.attribute_map.each_pair do |attr, param|
|
436
|
+
value = self.send(attr)
|
437
|
+
next if value.nil?
|
438
|
+
hash[param] = _to_hash(value)
|
439
|
+
end
|
440
|
+
hash
|
441
|
+
end
|
442
|
+
|
443
|
+
# Outputs non-array value in the form of hash
|
444
|
+
# For object, use to_hash. Otherwise, just return the value
|
445
|
+
# @param [Object] value Any valid value
|
446
|
+
# @return [Hash] Returns the value in the form of hash
|
447
|
+
def _to_hash(value)
|
448
|
+
if value.is_a?(Array)
|
449
|
+
value.compact.map{ |v| _to_hash(v) }
|
450
|
+
elsif value.is_a?(Hash)
|
451
|
+
{}.tap do |hash|
|
452
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
453
|
+
end
|
454
|
+
elsif value.respond_to? :to_hash
|
455
|
+
value.to_hash
|
456
|
+
else
|
457
|
+
value
|
458
|
+
end
|
459
|
+
end
|
460
|
+
|
461
|
+
end
|
462
|
+
|
463
|
+
end
|