storecove 1.0.3 → 1.0.4

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 (75) hide show
  1. checksums.yaml +4 -4
  2. data/lib/storecove/api/invoice_submissions_api.rb +8 -28
  3. data/lib/storecove/api/shop_account_requests_api.rb +10 -42
  4. data/lib/storecove/api/shop_accounts_api.rb +45 -81
  5. data/lib/storecove/api/shops_api.rb +4 -20
  6. data/lib/storecove/api_client.rb +16 -19
  7. data/lib/storecove/api_error.rb +7 -17
  8. data/lib/storecove/configuration.rb +0 -12
  9. data/lib/storecove/models/accounting_cost_code.rb +3 -19
  10. data/lib/storecove/models/accounting_customer_party.rb +7 -15
  11. data/lib/storecove/models/{party_address.rb → address.rb} +8 -19
  12. data/lib/storecove/models/{party_contact.rb → contact.rb} +8 -16
  13. data/lib/storecove/models/country.rb +0 -12
  14. data/lib/storecove/models/currency_code.rb +0 -12
  15. data/lib/storecove/models/error_model.rb +3 -15
  16. data/lib/storecove/models/{invoice_submission_invoice.rb → invoice.rb} +55 -41
  17. data/lib/storecove/models/invoice_line.rb +12 -22
  18. data/lib/storecove/models/invoice_recipient.rb +18 -21
  19. data/lib/storecove/models/invoice_recipient_preflight.rb +11 -15
  20. data/lib/storecove/models/invoice_submission.rb +15 -16
  21. data/lib/storecove/models/invoice_submission_result.rb +11 -23
  22. data/lib/storecove/models/legal_entity.rb +3 -15
  23. data/lib/storecove/models/legal_entity_identifier.rb +3 -15
  24. data/lib/storecove/models/logos.rb +3 -15
  25. data/lib/storecove/models/party.rb +5 -17
  26. data/lib/storecove/models/preflight_invoice_recipient_result.rb +3 -15
  27. data/lib/storecove/models/{public_identifiers_inner.rb → public_identifier.rb} +4 -16
  28. data/lib/storecove/models/public_identifiers.rb +3 -15
  29. data/lib/storecove/models/shop.rb +3 -15
  30. data/lib/storecove/models/shop_account_input.rb +19 -15
  31. data/lib/storecove/models/shop_account_request.rb +7 -15
  32. data/lib/storecove/models/shop_account_request_input.rb +3 -15
  33. data/lib/storecove/models/shop_account_request_update.rb +3 -15
  34. data/lib/storecove/models/{shop_account.rb → shop_account_result.rb} +4 -16
  35. data/lib/storecove/models/shop_account_update.rb +3 -15
  36. data/lib/storecove/models/{invoice_line_tax.rb → tax.rb} +16 -16
  37. data/lib/storecove/version.rb +1 -13
  38. data/lib/storecove.rb +6 -18
  39. data/spec/api/invoice_submissions_api_spec.rb +70 -0
  40. data/spec/api/shop_account_requests_api_spec.rb +107 -0
  41. data/spec/api/shop_accounts_api_spec.rb +118 -0
  42. data/spec/api/shops_api_spec.rb +57 -0
  43. data/spec/api_client_spec.rb +237 -0
  44. data/spec/configuration_spec.rb +53 -0
  45. data/spec/models/accounting_cost_code_spec.rb +71 -0
  46. data/spec/models/accounting_customer_party_spec.rb +59 -0
  47. data/spec/models/country_spec.rb +47 -0
  48. data/spec/models/currency_code_spec.rb +47 -0
  49. data/spec/models/error_model_spec.rb +59 -0
  50. data/spec/models/invoice_line_spec.rb +95 -0
  51. data/spec/models/invoice_line_tax_spec.rb +65 -0
  52. data/spec/models/invoice_recipient_preflight_spec.rb +59 -0
  53. data/spec/models/invoice_recipient_spec.rb +59 -0
  54. data/spec/models/invoice_submission_invoice_spec.rb +159 -0
  55. data/spec/models/invoice_submission_result_spec.rb +53 -0
  56. data/spec/models/invoice_submission_spec.rb +99 -0
  57. data/spec/models/legal_entity_identifier_spec.rb +65 -0
  58. data/spec/models/legal_entity_spec.rb +95 -0
  59. data/spec/models/logos_spec.rb +65 -0
  60. data/spec/models/party_address_spec.rb +101 -0
  61. data/spec/models/party_contact_spec.rb +65 -0
  62. data/spec/models/party_spec.rb +65 -0
  63. data/spec/models/preflight_invoice_recipient_result_spec.rb +57 -0
  64. data/spec/models/public_identifier_spec.rb +59 -0
  65. data/spec/models/public_identifiers_spec.rb +47 -0
  66. data/spec/models/shop_account_input_spec.rb +77 -0
  67. data/spec/models/shop_account_request_input_spec.rb +77 -0
  68. data/spec/models/shop_account_request_spec.rb +77 -0
  69. data/spec/models/shop_account_request_update_spec.rb +71 -0
  70. data/spec/models/shop_account_result_spec.rb +95 -0
  71. data/spec/models/shop_account_update_spec.rb +65 -0
  72. data/spec/models/shop_spec.rb +77 -0
  73. data/spec/spec_helper.rb +122 -0
  74. metadata +79 -10
  75. data/lib/storecove/models/swagger-codegen +0 -2799
@@ -0,0 +1,70 @@
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 'spec_helper'
25
+ require 'json'
26
+
27
+ # Unit tests for StorecoveApi::InvoiceSubmissionsApi
28
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
29
+ # Please update as you see appropriate
30
+ describe 'InvoiceSubmissionsApi' do
31
+ before do
32
+ # run before each test
33
+ @instance = StorecoveApi::InvoiceSubmissionsApi.new
34
+ end
35
+
36
+ after do
37
+ # run after each test
38
+ end
39
+
40
+ describe 'test an instance of InvoiceSubmissionsApi' do
41
+ it 'should create an instact of InvoiceSubmissionsApi' do
42
+ expect(@instance).to be_instance_of(StorecoveApi::InvoiceSubmissionsApi)
43
+ end
44
+ end
45
+
46
+ # unit tests for create
47
+ # Submit a new invoice
48
+ # Submit an invoice for delivery. include::examples/invoice_submissions/create.adoc[]
49
+ # @param invoice_submission Invoice to submit
50
+ # @param [Hash] opts the optional parameters
51
+ # @return [InvoiceSubmissionResult]
52
+ describe 'create test' do
53
+ it "should work" do
54
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
55
+ end
56
+ end
57
+
58
+ # unit tests for preflight
59
+ # Preflight an invoice recipient
60
+ # Check whether Storecove can deliver an invoice for a list of ids. include::examples/invoice_submissions/preflight.adoc[]
61
+ # @param invoice_recipient_preflight The invoice recipient to preflight
62
+ # @param [Hash] opts the optional parameters
63
+ # @return [PreflightInvoiceRecipientResult]
64
+ describe 'preflight test' do
65
+ it "should work" do
66
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
67
+ end
68
+ end
69
+
70
+ end
@@ -0,0 +1,107 @@
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 'spec_helper'
25
+ require 'json'
26
+
27
+ # Unit tests for StorecoveApi::ShopAccountRequestsApi
28
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
29
+ # Please update as you see appropriate
30
+ describe 'ShopAccountRequestsApi' do
31
+ before do
32
+ # run before each test
33
+ @instance = StorecoveApi::ShopAccountRequestsApi.new
34
+ end
35
+
36
+ after do
37
+ # run after each test
38
+ end
39
+
40
+ describe 'test an instance of ShopAccountRequestsApi' do
41
+ it 'should create an instact of ShopAccountRequestsApi' do
42
+ expect(@instance).to be_instance_of(StorecoveApi::ShopAccountRequestsApi)
43
+ end
44
+ end
45
+
46
+ # unit tests for all
47
+ # Get ShopAccountRequests
48
+ # Get all ShopAccountRequests
49
+ # @param external_user_id Filter by the external_user_id
50
+ # @param [Hash] opts the optional parameters
51
+ # @return [Array<ShopAccountRequest>]
52
+ describe 'all test' do
53
+ it "should work" do
54
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
55
+ end
56
+ end
57
+
58
+ # unit tests for create
59
+ # Create ShopAccountRequest
60
+ # Create a new ShopAccountRequest
61
+ # @param shop_account_request ShopAccountRequest to add
62
+ # @param [Hash] opts the optional parameters
63
+ # @return [ShopAccountRequest]
64
+ describe 'create test' do
65
+ it "should work" do
66
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
67
+ end
68
+ end
69
+
70
+ # unit tests for destroy
71
+ # Delete ShopAccountRequest
72
+ # Delete a specific ShopAccountRequest
73
+ # @param id shop_account_request id
74
+ # @param [Hash] opts the optional parameters
75
+ # @return [nil]
76
+ describe 'destroy test' do
77
+ it "should work" do
78
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
79
+ end
80
+ end
81
+
82
+ # unit tests for get
83
+ # Show a specific ShopAccountRequest
84
+ # Show a specific ShopAccountRequest
85
+ # @param id shop_account_request id
86
+ # @param [Hash] opts the optional parameters
87
+ # @return [ShopAccountRequest]
88
+ describe 'get test' do
89
+ it "should work" do
90
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
91
+ end
92
+ end
93
+
94
+ # unit tests for update
95
+ # Update ShopAccountRequest
96
+ # Update a specific ShopAccountRequest
97
+ # @param id shop_account_request id
98
+ # @param shop_account_request ShopAccountRequest updates
99
+ # @param [Hash] opts the optional parameters
100
+ # @return [ShopAccountRequest]
101
+ describe 'update test' do
102
+ it "should work" do
103
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
104
+ end
105
+ end
106
+
107
+ end
@@ -0,0 +1,118 @@
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 'spec_helper'
25
+ require 'json'
26
+
27
+ # Unit tests for StorecoveApi::ShopAccountsApi
28
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
29
+ # Please update as you see appropriate
30
+ describe 'ShopAccountsApi' do
31
+ before do
32
+ # run before each test
33
+ @instance = StorecoveApi::ShopAccountsApi.new
34
+ end
35
+
36
+ after do
37
+ # run after each test
38
+ end
39
+
40
+ describe 'test an instance of ShopAccountsApi' do
41
+ it 'should create an instact of ShopAccountsApi' do
42
+ expect(@instance).to be_instance_of(StorecoveApi::ShopAccountsApi)
43
+ end
44
+ end
45
+
46
+ # unit tests for all
47
+ # Get ShopAccounts for an entity
48
+ # Retrieve all active ShopAccounts for one of your entities. include::examples/shop_accounts/all.adoc[]
49
+ # @param external_user_id Filter by the external_user_id
50
+ # @param [Hash] opts the optional parameters
51
+ # @return [Array<ShopAccountResult>]
52
+ describe 'all test' do
53
+ it "should work" do
54
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
55
+ end
56
+ end
57
+
58
+ # unit tests for auth_failures
59
+ # Get ShopAccounts with authorization failures
60
+ # Get ShopAccounts with authorization failures. include::examples/shop_accounts/auth_failures.adoc[]
61
+ # @param [Hash] opts the optional parameters
62
+ # @return [Array<ShopAccountResult>]
63
+ describe 'auth_failures test' do
64
+ it "should work" do
65
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
66
+ end
67
+ end
68
+
69
+ # unit tests for create
70
+ # Create ShopAccount
71
+ # Create a new ShopAccount. include::examples/shop_accounts/create.adoc[]
72
+ # @param shop_account ShopAccount to add
73
+ # @param [Hash] opts the optional parameters
74
+ # @return [ShopAccountResult]
75
+ describe 'create test' do
76
+ it "should work" do
77
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
78
+ end
79
+ end
80
+
81
+ # unit tests for destroy
82
+ # Delete ShopAccount
83
+ #
84
+ # @param id shop_account id
85
+ # @param [Hash] opts the optional parameters
86
+ # @return [nil]
87
+ describe 'destroy test' do
88
+ it "should work" do
89
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
90
+ end
91
+ end
92
+
93
+ # unit tests for get
94
+ # Get ShopAccount
95
+ # Get a specific ShopAccount. include::examples/shop_accounts/get.adoc[]
96
+ # @param id shop_account id
97
+ # @param [Hash] opts the optional parameters
98
+ # @return [ShopAccountResult]
99
+ describe 'get test' do
100
+ it "should work" do
101
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
102
+ end
103
+ end
104
+
105
+ # unit tests for update
106
+ # Update ShopAccount
107
+ # Update a specific ShopAccount. include::examples/shop_accounts/update.adoc[]
108
+ # @param id shop_account id
109
+ # @param shop_account ShopAccount updates
110
+ # @param [Hash] opts the optional parameters
111
+ # @return [ShopAccountResult]
112
+ describe 'update test' do
113
+ it "should work" do
114
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
115
+ end
116
+ end
117
+
118
+ end
@@ -0,0 +1,57 @@
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 'spec_helper'
25
+ require 'json'
26
+
27
+ # Unit tests for StorecoveApi::ShopsApi
28
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
29
+ # Please update as you see appropriate
30
+ describe 'ShopsApi' do
31
+ before do
32
+ # run before each test
33
+ @instance = StorecoveApi::ShopsApi.new
34
+ end
35
+
36
+ after do
37
+ # run after each test
38
+ end
39
+
40
+ describe 'test an instance of ShopsApi' do
41
+ it 'should create an instact of ShopsApi' do
42
+ expect(@instance).to be_instance_of(StorecoveApi::ShopsApi)
43
+ end
44
+ end
45
+
46
+ # unit tests for all
47
+ # Get Shops
48
+ # Get all available shops. include::examples/shops/all.adoc[]
49
+ # @param [Hash] opts the optional parameters
50
+ # @return [Array<Shop>]
51
+ describe 'all test' do
52
+ it "should work" do
53
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
54
+ end
55
+ end
56
+
57
+ end
@@ -0,0 +1,237 @@
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 'spec_helper'
25
+
26
+ describe StorecoveApi::ApiClient do
27
+ context 'initialization' do
28
+ context 'URL stuff' do
29
+ context 'host' do
30
+ it 'removes http from host' do
31
+ StorecoveApi.configure { |c| c.host = 'http://example.com' }
32
+ expect(StorecoveApi::Configuration.default.host).to eq('example.com')
33
+ end
34
+
35
+ it 'removes https from host' do
36
+ StorecoveApi.configure { |c| c.host = 'https://wookiee.com' }
37
+ expect(StorecoveApi::ApiClient.default.config.host).to eq('wookiee.com')
38
+ end
39
+
40
+ it 'removes trailing path from host' do
41
+ StorecoveApi.configure { |c| c.host = 'hobo.com/v4' }
42
+ expect(StorecoveApi::Configuration.default.host).to eq('hobo.com')
43
+ end
44
+ end
45
+
46
+ context 'base_path' do
47
+ it "prepends a slash to base_path" do
48
+ StorecoveApi.configure { |c| c.base_path = 'v4/dog' }
49
+ expect(StorecoveApi::Configuration.default.base_path).to eq('/v4/dog')
50
+ end
51
+
52
+ it "doesn't prepend a slash if one is already there" do
53
+ StorecoveApi.configure { |c| c.base_path = '/v4/dog' }
54
+ expect(StorecoveApi::Configuration.default.base_path).to eq('/v4/dog')
55
+ end
56
+
57
+ it "ends up as a blank string if nil" do
58
+ StorecoveApi.configure { |c| c.base_path = nil }
59
+ expect(StorecoveApi::Configuration.default.base_path).to eq('')
60
+ end
61
+ end
62
+ end
63
+ end
64
+
65
+ describe "params_encoding in #build_request" do
66
+ let(:config) { StorecoveApi::Configuration.new }
67
+ let(:api_client) { StorecoveApi::ApiClient.new(config) }
68
+
69
+ it "defaults to nil" do
70
+ expect(StorecoveApi::Configuration.default.params_encoding).to eq(nil)
71
+ expect(config.params_encoding).to eq(nil)
72
+
73
+ request = api_client.build_request(:get, '/test')
74
+ expect(request.options[:params_encoding]).to eq(nil)
75
+ end
76
+
77
+ it "can be customized" do
78
+ config.params_encoding = :multi
79
+ request = api_client.build_request(:get, '/test')
80
+ expect(request.options[:params_encoding]).to eq(:multi)
81
+ end
82
+ end
83
+
84
+ describe "timeout in #build_request" do
85
+ let(:config) { StorecoveApi::Configuration.new }
86
+ let(:api_client) { StorecoveApi::ApiClient.new(config) }
87
+
88
+ it "defaults to 0" do
89
+ expect(StorecoveApi::Configuration.default.timeout).to eq(0)
90
+ expect(config.timeout).to eq(0)
91
+
92
+ request = api_client.build_request(:get, '/test')
93
+ expect(request.options[:timeout]).to eq(0)
94
+ end
95
+
96
+ it "can be customized" do
97
+ config.timeout = 100
98
+ request = api_client.build_request(:get, '/test')
99
+ expect(request.options[:timeout]).to eq(100)
100
+ end
101
+ end
102
+
103
+ describe "#deserialize" do
104
+ it "handles Array<Integer>" do
105
+ api_client = StorecoveApi::ApiClient.new
106
+ headers = {'Content-Type' => 'application/json'}
107
+ response = double('response', headers: headers, body: '[12, 34]')
108
+ data = api_client.deserialize(response, 'Array<Integer>')
109
+ expect(data).to be_instance_of(Array)
110
+ expect(data).to eq([12, 34])
111
+ end
112
+
113
+ it "handles Array<Array<Integer>>" do
114
+ api_client = StorecoveApi::ApiClient.new
115
+ headers = {'Content-Type' => 'application/json'}
116
+ response = double('response', headers: headers, body: '[[12, 34], [56]]')
117
+ data = api_client.deserialize(response, 'Array<Array<Integer>>')
118
+ expect(data).to be_instance_of(Array)
119
+ expect(data).to eq([[12, 34], [56]])
120
+ end
121
+
122
+ it "handles Hash<String, String>" do
123
+ api_client = StorecoveApi::ApiClient.new
124
+ headers = {'Content-Type' => 'application/json'}
125
+ response = double('response', headers: headers, body: '{"message": "Hello"}')
126
+ data = api_client.deserialize(response, 'Hash<String, String>')
127
+ expect(data).to be_instance_of(Hash)
128
+ expect(data).to eq({:message => 'Hello'})
129
+ end
130
+ end
131
+
132
+ describe "#object_to_hash" do
133
+ it "ignores nils and includes empty arrays" do
134
+ # uncomment below to test object_to_hash for model
135
+ #api_client = StorecoveApi::ApiClient.new
136
+ #_model = StorecoveApi::ModelName.new
137
+ # update the model attribute below
138
+ #_model.id = 1
139
+ # update the expected value (hash) below
140
+ #expected = {id: 1, name: '', tags: []}
141
+ #expect(api_client.object_to_hash(_model)).to eq(expected)
142
+ end
143
+ end
144
+
145
+ describe "#build_collection_param" do
146
+ let(:param) { ['aa', 'bb', 'cc'] }
147
+ let(:api_client) { StorecoveApi::ApiClient.new }
148
+
149
+ it "works for csv" do
150
+ expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
151
+ end
152
+
153
+ it "works for ssv" do
154
+ expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
155
+ end
156
+
157
+ it "works for tsv" do
158
+ expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
159
+ end
160
+
161
+ it "works for pipes" do
162
+ expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
163
+ end
164
+
165
+ it "works for multi" do
166
+ expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
167
+ end
168
+
169
+ it "fails for invalid collection format" do
170
+ expect(proc { api_client.build_collection_param(param, :INVALID) }).to raise_error(RuntimeError, 'unknown collection format: :INVALID')
171
+ end
172
+ end
173
+
174
+ describe "#json_mime?" do
175
+ let(:api_client) { StorecoveApi::ApiClient.new }
176
+
177
+ it "works" do
178
+ expect(api_client.json_mime?(nil)).to eq false
179
+ expect(api_client.json_mime?('')).to eq false
180
+
181
+ expect(api_client.json_mime?('application/json')).to eq true
182
+ expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
183
+ expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
184
+
185
+ expect(api_client.json_mime?('application/xml')).to eq false
186
+ expect(api_client.json_mime?('text/plain')).to eq false
187
+ expect(api_client.json_mime?('application/jsonp')).to eq false
188
+ end
189
+ end
190
+
191
+ describe "#select_header_accept" do
192
+ let(:api_client) { StorecoveApi::ApiClient.new }
193
+
194
+ it "works" do
195
+ expect(api_client.select_header_accept(nil)).to be_nil
196
+ expect(api_client.select_header_accept([])).to be_nil
197
+
198
+ expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
199
+ expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
200
+ expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
201
+
202
+ expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
203
+ expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
204
+ end
205
+ end
206
+
207
+ describe "#select_header_content_type" do
208
+ let(:api_client) { StorecoveApi::ApiClient.new }
209
+
210
+ it "works" do
211
+ expect(api_client.select_header_content_type(nil)).to eq('application/json')
212
+ expect(api_client.select_header_content_type([])).to eq('application/json')
213
+
214
+ expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
215
+ expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
216
+ expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
217
+ expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
218
+ expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
219
+ end
220
+ end
221
+
222
+ describe "#sanitize_filename" do
223
+ let(:api_client) { StorecoveApi::ApiClient.new }
224
+
225
+ it "works" do
226
+ expect(api_client.sanitize_filename('sun')).to eq('sun')
227
+ expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
228
+ expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
229
+ expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
230
+ expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
231
+ expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
232
+ expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
233
+ expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
234
+ expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
235
+ end
236
+ end
237
+ end
@@ -0,0 +1,53 @@
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 'spec_helper'
25
+
26
+ describe StorecoveApi::Configuration do
27
+ let(:config) { StorecoveApi::Configuration.default }
28
+
29
+ before(:each) do
30
+ # uncomment below to setup host and base_path
31
+ #require 'URI'
32
+ #uri = URI.parse("https://api.storecove.com/api/v2")
33
+ #StorecoveApi.configure do |c|
34
+ # c.host = uri.host
35
+ # c.base_path = uri.path
36
+ #end
37
+ end
38
+
39
+ describe '#base_url' do
40
+ it 'should have the default value' do
41
+ # uncomment below to test default value of the base path
42
+ #expect(config.base_url).to eq("https://api.storecove.com/api/v2")
43
+ end
44
+
45
+ it 'should remove trailing slashes' do
46
+ [nil, '', '/', '//'].each do |base_path|
47
+ config.base_path = base_path
48
+ # uncomment below to test trailing slashes
49
+ #expect(config.base_url).to eq("https://api.storecove.com/api/v2")
50
+ end
51
+ end
52
+ end
53
+ end