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
@@ -0,0 +1,133 @@
|
|
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 "uri"
|
14
|
+
|
15
|
+
module StorecoveApi
|
16
|
+
class PurchaseInvoicesApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
|
23
|
+
# Get Invoice
|
24
|
+
# Get a specific Invoice.
|
25
|
+
# @param guid purchase invoice guid
|
26
|
+
# @param [Hash] opts the optional parameters
|
27
|
+
# @return [PurchaseInvoice]
|
28
|
+
def get_invoice(guid, opts = {})
|
29
|
+
data, _status_code, _headers = get_invoice_with_http_info(guid, opts)
|
30
|
+
return data
|
31
|
+
end
|
32
|
+
|
33
|
+
# Get Invoice
|
34
|
+
# Get a specific Invoice.
|
35
|
+
# @param guid purchase invoice guid
|
36
|
+
# @param [Hash] opts the optional parameters
|
37
|
+
# @return [Array<(PurchaseInvoice, Fixnum, Hash)>] PurchaseInvoice data, response status code and response headers
|
38
|
+
def get_invoice_with_http_info(guid, opts = {})
|
39
|
+
if @api_client.config.debugging
|
40
|
+
@api_client.config.logger.debug "Calling API: PurchaseInvoicesApi.get_invoice ..."
|
41
|
+
end
|
42
|
+
# verify the required parameter 'guid' is set
|
43
|
+
if @api_client.config.client_side_validation && guid.nil?
|
44
|
+
fail ArgumentError, "Missing the required parameter 'guid' when calling PurchaseInvoicesApi.get_invoice"
|
45
|
+
end
|
46
|
+
# resource path
|
47
|
+
local_var_path = "/purchase_invoices/{guid}".sub('{' + 'guid' + '}', guid.to_s)
|
48
|
+
|
49
|
+
# query parameters
|
50
|
+
query_params = {}
|
51
|
+
|
52
|
+
# header parameters
|
53
|
+
header_params = {}
|
54
|
+
# HTTP header 'Accept' (if needed)
|
55
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
56
|
+
# HTTP header 'Content-Type'
|
57
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
58
|
+
|
59
|
+
# form parameters
|
60
|
+
form_params = {}
|
61
|
+
|
62
|
+
# http body (model)
|
63
|
+
post_body = nil
|
64
|
+
auth_names = ['Bearer']
|
65
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
66
|
+
:header_params => header_params,
|
67
|
+
:query_params => query_params,
|
68
|
+
:form_params => form_params,
|
69
|
+
:body => post_body,
|
70
|
+
:auth_names => auth_names,
|
71
|
+
:return_type => 'PurchaseInvoice')
|
72
|
+
if @api_client.config.debugging
|
73
|
+
@api_client.config.logger.debug "API called: PurchaseInvoicesApi#get_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
74
|
+
end
|
75
|
+
return data, status_code, headers
|
76
|
+
end
|
77
|
+
|
78
|
+
# Get Invoice as UBL
|
79
|
+
# Get a specific Invoice in UBL form.
|
80
|
+
# @param guid purchase invoice guid
|
81
|
+
# @param [Hash] opts the optional parameters
|
82
|
+
# @return [PurchaseInvoiceUbl]
|
83
|
+
def get_invoice_ubl(guid, opts = {})
|
84
|
+
data, _status_code, _headers = get_invoice_ubl_with_http_info(guid, opts)
|
85
|
+
return data
|
86
|
+
end
|
87
|
+
|
88
|
+
# Get Invoice as UBL
|
89
|
+
# Get a specific Invoice in UBL form.
|
90
|
+
# @param guid purchase invoice guid
|
91
|
+
# @param [Hash] opts the optional parameters
|
92
|
+
# @return [Array<(PurchaseInvoiceUbl, Fixnum, Hash)>] PurchaseInvoiceUbl data, response status code and response headers
|
93
|
+
def get_invoice_ubl_with_http_info(guid, opts = {})
|
94
|
+
if @api_client.config.debugging
|
95
|
+
@api_client.config.logger.debug "Calling API: PurchaseInvoicesApi.get_invoice_ubl ..."
|
96
|
+
end
|
97
|
+
# verify the required parameter 'guid' is set
|
98
|
+
if @api_client.config.client_side_validation && guid.nil?
|
99
|
+
fail ArgumentError, "Missing the required parameter 'guid' when calling PurchaseInvoicesApi.get_invoice_ubl"
|
100
|
+
end
|
101
|
+
# resource path
|
102
|
+
local_var_path = "/purchase_invoices/{guid}/ubl".sub('{' + 'guid' + '}', guid.to_s)
|
103
|
+
|
104
|
+
# query parameters
|
105
|
+
query_params = {}
|
106
|
+
|
107
|
+
# header parameters
|
108
|
+
header_params = {}
|
109
|
+
# HTTP header 'Accept' (if needed)
|
110
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
111
|
+
# HTTP header 'Content-Type'
|
112
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
113
|
+
|
114
|
+
# form parameters
|
115
|
+
form_params = {}
|
116
|
+
|
117
|
+
# http body (model)
|
118
|
+
post_body = nil
|
119
|
+
auth_names = ['Bearer']
|
120
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
121
|
+
:header_params => header_params,
|
122
|
+
:query_params => query_params,
|
123
|
+
:form_params => form_params,
|
124
|
+
:body => post_body,
|
125
|
+
:auth_names => auth_names,
|
126
|
+
:return_type => 'PurchaseInvoiceUbl')
|
127
|
+
if @api_client.config.debugging
|
128
|
+
@api_client.config.logger.debug "API called: PurchaseInvoicesApi#get_invoice_ubl\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
129
|
+
end
|
130
|
+
return data, status_code, headers
|
131
|
+
end
|
132
|
+
end
|
133
|
+
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
|
|
@@ -39,9 +40,11 @@ module StorecoveApi
|
|
39
40
|
@api_client.config.logger.debug "Calling API: ShopAccountRequestsApi.create_shop_account_request ..."
|
40
41
|
end
|
41
42
|
# verify the required parameter 'shop_account_request' is set
|
42
|
-
|
43
|
+
if @api_client.config.client_side_validation && shop_account_request.nil?
|
44
|
+
fail ArgumentError, "Missing the required parameter 'shop_account_request' when calling ShopAccountRequestsApi.create_shop_account_request"
|
45
|
+
end
|
43
46
|
# resource path
|
44
|
-
local_var_path = "/shop_account_requests"
|
47
|
+
local_var_path = "/shop_account_requests"
|
45
48
|
|
46
49
|
# query parameters
|
47
50
|
query_params = {}
|
@@ -92,9 +95,11 @@ module StorecoveApi
|
|
92
95
|
@api_client.config.logger.debug "Calling API: ShopAccountRequestsApi.delete_shop_account_request ..."
|
93
96
|
end
|
94
97
|
# verify the required parameter 'id' is set
|
95
|
-
|
98
|
+
if @api_client.config.client_side_validation && id.nil?
|
99
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling ShopAccountRequestsApi.delete_shop_account_request"
|
100
|
+
end
|
96
101
|
# resource path
|
97
|
-
local_var_path = "/shop_account_requests/{id}".sub('{
|
102
|
+
local_var_path = "/shop_account_requests/{id}".sub('{' + 'id' + '}', id.to_s)
|
98
103
|
|
99
104
|
# query parameters
|
100
105
|
query_params = {}
|
@@ -144,9 +149,11 @@ module StorecoveApi
|
|
144
149
|
@api_client.config.logger.debug "Calling API: ShopAccountRequestsApi.get_shop_account_request ..."
|
145
150
|
end
|
146
151
|
# verify the required parameter 'id' is set
|
147
|
-
|
152
|
+
if @api_client.config.client_side_validation && id.nil?
|
153
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling ShopAccountRequestsApi.get_shop_account_request"
|
154
|
+
end
|
148
155
|
# resource path
|
149
|
-
local_var_path = "/shop_account_requests/{id}".sub('{
|
156
|
+
local_var_path = "/shop_account_requests/{id}".sub('{' + 'id' + '}', id.to_s)
|
150
157
|
|
151
158
|
# query parameters
|
152
159
|
query_params = {}
|
@@ -197,9 +204,11 @@ module StorecoveApi
|
|
197
204
|
@api_client.config.logger.debug "Calling API: ShopAccountRequestsApi.shop_account_requests_index ..."
|
198
205
|
end
|
199
206
|
# verify the required parameter 'external_user_id' is set
|
200
|
-
|
207
|
+
if @api_client.config.client_side_validation && external_user_id.nil?
|
208
|
+
fail ArgumentError, "Missing the required parameter 'external_user_id' when calling ShopAccountRequestsApi.shop_account_requests_index"
|
209
|
+
end
|
201
210
|
# resource path
|
202
|
-
local_var_path = "/shop_account_requests"
|
211
|
+
local_var_path = "/shop_account_requests"
|
203
212
|
|
204
213
|
# query parameters
|
205
214
|
query_params = {}
|
@@ -253,11 +262,15 @@ module StorecoveApi
|
|
253
262
|
@api_client.config.logger.debug "Calling API: ShopAccountRequestsApi.update_shop_account_request ..."
|
254
263
|
end
|
255
264
|
# verify the required parameter 'id' is set
|
256
|
-
|
265
|
+
if @api_client.config.client_side_validation && id.nil?
|
266
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling ShopAccountRequestsApi.update_shop_account_request"
|
267
|
+
end
|
257
268
|
# verify the required parameter 'shop_account_request' is set
|
258
|
-
|
269
|
+
if @api_client.config.client_side_validation && shop_account_request.nil?
|
270
|
+
fail ArgumentError, "Missing the required parameter 'shop_account_request' when calling ShopAccountRequestsApi.update_shop_account_request"
|
271
|
+
end
|
259
272
|
# resource path
|
260
|
-
local_var_path = "/shop_account_requests/{id}".sub('{
|
273
|
+
local_var_path = "/shop_account_requests/{id}".sub('{' + 'id' + '}', id.to_s)
|
261
274
|
|
262
275
|
# query parameters
|
263
276
|
query_params = {}
|
@@ -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
|
|
@@ -39,9 +40,11 @@ module StorecoveApi
|
|
39
40
|
@api_client.config.logger.debug "Calling API: ShopAccountsApi.create_shop_account ..."
|
40
41
|
end
|
41
42
|
# verify the required parameter 'shop_account' is set
|
42
|
-
|
43
|
+
if @api_client.config.client_side_validation && shop_account.nil?
|
44
|
+
fail ArgumentError, "Missing the required parameter 'shop_account' when calling ShopAccountsApi.create_shop_account"
|
45
|
+
end
|
43
46
|
# resource path
|
44
|
-
local_var_path = "/shop_accounts"
|
47
|
+
local_var_path = "/shop_accounts"
|
45
48
|
|
46
49
|
# query parameters
|
47
50
|
query_params = {}
|
@@ -92,9 +95,11 @@ module StorecoveApi
|
|
92
95
|
@api_client.config.logger.debug "Calling API: ShopAccountsApi.delete_shop_account ..."
|
93
96
|
end
|
94
97
|
# verify the required parameter 'id' is set
|
95
|
-
|
98
|
+
if @api_client.config.client_side_validation && id.nil?
|
99
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling ShopAccountsApi.delete_shop_account"
|
100
|
+
end
|
96
101
|
# resource path
|
97
|
-
local_var_path = "/shop_accounts/{id}".sub('{
|
102
|
+
local_var_path = "/shop_accounts/{id}".sub('{' + 'id' + '}', id.to_s)
|
98
103
|
|
99
104
|
# query parameters
|
100
105
|
query_params = {}
|
@@ -144,9 +149,11 @@ module StorecoveApi
|
|
144
149
|
@api_client.config.logger.debug "Calling API: ShopAccountsApi.get_shop_account ..."
|
145
150
|
end
|
146
151
|
# verify the required parameter 'id' is set
|
147
|
-
|
152
|
+
if @api_client.config.client_side_validation && id.nil?
|
153
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling ShopAccountsApi.get_shop_account"
|
154
|
+
end
|
148
155
|
# resource path
|
149
|
-
local_var_path = "/shop_accounts/{id}".sub('{
|
156
|
+
local_var_path = "/shop_accounts/{id}".sub('{' + 'id' + '}', id.to_s)
|
150
157
|
|
151
158
|
# query parameters
|
152
159
|
query_params = {}
|
@@ -195,7 +202,7 @@ module StorecoveApi
|
|
195
202
|
@api_client.config.logger.debug "Calling API: ShopAccountsApi.shop_accounts_auth_failures ..."
|
196
203
|
end
|
197
204
|
# resource path
|
198
|
-
local_var_path = "/shop_accounts/auth_failures"
|
205
|
+
local_var_path = "/shop_accounts/auth_failures"
|
199
206
|
|
200
207
|
# query parameters
|
201
208
|
query_params = {}
|
@@ -246,9 +253,11 @@ module StorecoveApi
|
|
246
253
|
@api_client.config.logger.debug "Calling API: ShopAccountsApi.shop_accounts_index ..."
|
247
254
|
end
|
248
255
|
# verify the required parameter 'external_user_id' is set
|
249
|
-
|
256
|
+
if @api_client.config.client_side_validation && external_user_id.nil?
|
257
|
+
fail ArgumentError, "Missing the required parameter 'external_user_id' when calling ShopAccountsApi.shop_accounts_index"
|
258
|
+
end
|
250
259
|
# resource path
|
251
|
-
local_var_path = "/shop_accounts"
|
260
|
+
local_var_path = "/shop_accounts"
|
252
261
|
|
253
262
|
# query parameters
|
254
263
|
query_params = {}
|
@@ -302,11 +311,15 @@ module StorecoveApi
|
|
302
311
|
@api_client.config.logger.debug "Calling API: ShopAccountsApi.update_shop_account ..."
|
303
312
|
end
|
304
313
|
# verify the required parameter 'id' is set
|
305
|
-
|
314
|
+
if @api_client.config.client_side_validation && id.nil?
|
315
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling ShopAccountsApi.update_shop_account"
|
316
|
+
end
|
306
317
|
# verify the required parameter 'shop_account' is set
|
307
|
-
|
318
|
+
if @api_client.config.client_side_validation && shop_account.nil?
|
319
|
+
fail ArgumentError, "Missing the required parameter 'shop_account' when calling ShopAccountsApi.update_shop_account"
|
320
|
+
end
|
308
321
|
# resource path
|
309
|
-
local_var_path = "/shop_accounts/{id}".sub('{
|
322
|
+
local_var_path = "/shop_accounts/{id}".sub('{' + 'id' + '}', id.to_s)
|
310
323
|
|
311
324
|
# query parameters
|
312
325
|
query_params = {}
|
@@ -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
|
|
@@ -37,7 +38,7 @@ module StorecoveApi
|
|
37
38
|
@api_client.config.logger.debug "Calling API: ShopsApi.shops_index ..."
|
38
39
|
end
|
39
40
|
# resource path
|
40
|
-
local_var_path = "/shops"
|
41
|
+
local_var_path = "/shops"
|
41
42
|
|
42
43
|
# query parameters
|
43
44
|
query_params = {}
|
data/lib/storecove/api_client.rb
CHANGED
@@ -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
|
|
@@ -122,7 +123,9 @@ module StorecoveApi
|
|
122
123
|
end
|
123
124
|
end
|
124
125
|
|
125
|
-
Typhoeus::Request.new(url, req_opts)
|
126
|
+
request = Typhoeus::Request.new(url, req_opts)
|
127
|
+
download_file(request) if opts[:return_type] == 'File'
|
128
|
+
request
|
126
129
|
end
|
127
130
|
|
128
131
|
# Check if the given MIME is a JSON MIME.
|
@@ -134,7 +137,7 @@ module StorecoveApi
|
|
134
137
|
# @param [String] mime MIME
|
135
138
|
# @return [Boolean] True if the MIME is application/json
|
136
139
|
def json_mime?(mime)
|
137
|
-
(mime == "*/*") || !(mime =~
|
140
|
+
(mime == "*/*") || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
|
138
141
|
end
|
139
142
|
|
140
143
|
# Deserialize the response to the given return type.
|
@@ -143,14 +146,16 @@ module StorecoveApi
|
|
143
146
|
# @param [String] return_type some examples: "User", "Array[User]", "Hash[String,Integer]"
|
144
147
|
def deserialize(response, return_type)
|
145
148
|
body = response.body
|
149
|
+
|
150
|
+
# handle file downloading - return the File instance processed in request callbacks
|
151
|
+
# note that response body is empty when the file is written in chunks in request on_body callback
|
152
|
+
return @tempfile if return_type == 'File'
|
153
|
+
|
146
154
|
return nil if body.nil? || body.empty?
|
147
155
|
|
148
156
|
# return response body directly for String return type
|
149
157
|
return body if return_type == 'String'
|
150
158
|
|
151
|
-
# handle file downloading - save response body into a tmp file and return the File instance
|
152
|
-
return download_file(response) if return_type == 'File'
|
153
|
-
|
154
159
|
# ensuring a default content type
|
155
160
|
content_type = response.headers['Content-Type'] || 'application/json'
|
156
161
|
|
@@ -213,30 +218,38 @@ module StorecoveApi
|
|
213
218
|
|
214
219
|
# Save response body into a file in (the defined) temporary folder, using the filename
|
215
220
|
# from the "Content-Disposition" header if provided, otherwise a random filename.
|
221
|
+
# The response body is written to the file in chunks in order to handle files which
|
222
|
+
# size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
|
223
|
+
# process can use.
|
216
224
|
#
|
217
225
|
# @see Configuration#temp_folder_path
|
218
|
-
|
219
|
-
def download_file(response)
|
220
|
-
content_disposition = response.headers['Content-Disposition']
|
221
|
-
if content_disposition and content_disposition =~ /filename=/i
|
222
|
-
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
223
|
-
prefix = sanitize_filename(filename)
|
224
|
-
else
|
225
|
-
prefix = 'download-'
|
226
|
-
end
|
227
|
-
prefix = prefix + '-' unless prefix.end_with?('-')
|
228
|
-
|
226
|
+
def download_file(request)
|
229
227
|
tempfile = nil
|
230
|
-
encoding =
|
231
|
-
|
232
|
-
|
233
|
-
|
228
|
+
encoding = nil
|
229
|
+
request.on_headers do |response|
|
230
|
+
content_disposition = response.headers['Content-Disposition']
|
231
|
+
if content_disposition and content_disposition =~ /filename=/i
|
232
|
+
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
233
|
+
prefix = sanitize_filename(filename)
|
234
|
+
else
|
235
|
+
prefix = 'download-'
|
236
|
+
end
|
237
|
+
prefix = prefix + '-' unless prefix.end_with?('-')
|
238
|
+
encoding = response.body.encoding
|
239
|
+
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
240
|
+
@tempfile = tempfile
|
241
|
+
end
|
242
|
+
request.on_body do |chunk|
|
243
|
+
chunk.force_encoding(encoding)
|
244
|
+
tempfile.write(chunk)
|
245
|
+
end
|
246
|
+
request.on_complete do |response|
|
247
|
+
tempfile.close
|
248
|
+
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
249
|
+
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
250
|
+
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
251
|
+
"explicitly with `tempfile.delete`"
|
234
252
|
end
|
235
|
-
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
236
|
-
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
237
|
-
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
238
|
-
"explicitly with `tempfile.delete`"
|
239
|
-
tempfile
|
240
253
|
end
|
241
254
|
|
242
255
|
# Sanitize filename by removing path.
|
@@ -267,7 +280,7 @@ module StorecoveApi
|
|
267
280
|
data = {}
|
268
281
|
form_params.each do |key, value|
|
269
282
|
case value
|
270
|
-
when File, Array, nil
|
283
|
+
when ::File, ::Array, nil
|
271
284
|
# let typhoeus handle File, Array and nil parameters
|
272
285
|
data[key] = value
|
273
286
|
else
|
data/lib/storecove/api_error.rb
CHANGED
@@ -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
|
|
@@ -75,6 +76,11 @@ module StorecoveApi
|
|
75
76
|
# Default to 0 (never times out).
|
76
77
|
attr_accessor :timeout
|
77
78
|
|
79
|
+
# Set this to false to skip client side validation in the operation.
|
80
|
+
# Default to true.
|
81
|
+
# @return [true, false]
|
82
|
+
attr_accessor :client_side_validation
|
83
|
+
|
78
84
|
### TLS/SSL setting
|
79
85
|
# Set this to false to skip verifying SSL certificate when calling API from https server.
|
80
86
|
# Default to true.
|
@@ -128,6 +134,7 @@ module StorecoveApi
|
|
128
134
|
@api_key = {}
|
129
135
|
@api_key_prefix = {}
|
130
136
|
@timeout = 0
|
137
|
+
@client_side_validation = true
|
131
138
|
@verify_ssl = true
|
132
139
|
@verify_ssl_host = true
|
133
140
|
@params_encoding = nil
|