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,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
- fail ArgumentError, "Missing the required parameter 'shop_account_request' when calling ShopAccountRequestsApi.create_shop_account_request" if shop_account_request.nil?
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".sub('{format}','json')
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
- fail ArgumentError, "Missing the required parameter 'id' when calling ShopAccountRequestsApi.delete_shop_account_request" if id.nil?
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('{format}','json').sub('{' + 'id' + '}', id.to_s)
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
- fail ArgumentError, "Missing the required parameter 'id' when calling ShopAccountRequestsApi.get_shop_account_request" if id.nil?
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('{format}','json').sub('{' + 'id' + '}', id.to_s)
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
- fail ArgumentError, "Missing the required parameter 'external_user_id' when calling ShopAccountRequestsApi.shop_account_requests_index" if external_user_id.nil?
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".sub('{format}','json')
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
- fail ArgumentError, "Missing the required parameter 'id' when calling ShopAccountRequestsApi.update_shop_account_request" if id.nil?
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
- fail ArgumentError, "Missing the required parameter 'shop_account_request' when calling ShopAccountRequestsApi.update_shop_account_request" if shop_account_request.nil?
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('{format}','json').sub('{' + 'id' + '}', id.to_s)
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
- fail ArgumentError, "Missing the required parameter 'shop_account' when calling ShopAccountsApi.create_shop_account" if shop_account.nil?
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".sub('{format}','json')
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
- fail ArgumentError, "Missing the required parameter 'id' when calling ShopAccountsApi.delete_shop_account" if id.nil?
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('{format}','json').sub('{' + 'id' + '}', id.to_s)
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
- fail ArgumentError, "Missing the required parameter 'id' when calling ShopAccountsApi.get_shop_account" if id.nil?
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('{format}','json').sub('{' + 'id' + '}', id.to_s)
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".sub('{format}','json')
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
- fail ArgumentError, "Missing the required parameter 'external_user_id' when calling ShopAccountsApi.shop_accounts_index" if external_user_id.nil?
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".sub('{format}','json')
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
- fail ArgumentError, "Missing the required parameter 'id' when calling ShopAccountsApi.update_shop_account" if id.nil?
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
- fail ArgumentError, "Missing the required parameter 'shop_account' when calling ShopAccountsApi.update_shop_account" if shop_account.nil?
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('{format}','json').sub('{' + 'id' + '}', id.to_s)
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".sub('{format}','json')
41
+ local_var_path = "/shops"
41
42
 
42
43
  # query parameters
43
44
  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
 
@@ -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 =~ /\Aapplication\/json(;.*)?\z/i).nil?
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
- # @return [Tempfile] the file downloaded
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 = response.body.encoding
231
- Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding) do |file|
232
- file.write(response.body)
233
- tempfile = file
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
@@ -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
 
@@ -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