digital_femsa 1.1.0 → 1.1.1
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 +2 -0
- data/Gemfile.lock +104 -0
- data/README.md +4 -4
- data/VERSION +1 -1
- data/config-ruby.json +1 -1
- data/digital_femsa.gemspec +1 -1
- data/lib/digital_femsa/models/webhook_request.rb +247 -8
- data/lib/digital_femsa/version.rb +1 -1
- data/spec/api/balances_api_spec.rb +24 -22
- data/spec/api/charges_api_spec.rb +92 -49
- data/spec/api/companies_api_spec.rb +57 -35
- data/spec/api/customers_api_spec.rb +115 -99
- data/spec/api/events_api_spec.rb +72 -48
- data/spec/api/generated_apis_coverage_spec.rb +94 -0
- data/spec/api/logs_api_spec.rb +57 -38
- data/spec/api/orders_api_spec.rb +134 -108
- data/spec/api/payment_link_api_spec.rb +91 -81
- data/spec/api/payment_methods_api_spec.rb +102 -65
- data/spec/api/transactions_api_spec.rb +63 -41
- data/spec/api/transfers_api_spec.rb +57 -38
- data/spec/api/webhook_keys_api_spec.rb +87 -68
- data/spec/api/webhooks_api_spec.rb +110 -79
- data/spec/api_client_spec.rb +259 -0
- data/spec/models/generated_models_coverage_spec.rb +152 -0
- data/spec/models/webhook_request_ssrf_protection_spec.rb +275 -0
- data/spec/spec_helper.rb +37 -0
- metadata +28 -25
|
@@ -13,68 +13,111 @@ Generator version: 7.5.0
|
|
|
13
13
|
require 'spec_helper'
|
|
14
14
|
require 'json'
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
before do
|
|
21
|
-
# run before each test
|
|
22
|
-
@api_instance = DigitalFemsa::ChargesApi.new
|
|
23
|
-
end
|
|
16
|
+
RSpec.describe DigitalFemsa::ChargesApi do
|
|
17
|
+
let(:config) { DigitalFemsa::Configuration.new }
|
|
18
|
+
let(:api_client) { instance_double(DigitalFemsa::ApiClient) }
|
|
19
|
+
let(:api_instance) { described_class.new(api_client) }
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
before do
|
|
22
|
+
allow(api_client).to receive(:config).and_return(config)
|
|
23
|
+
allow(api_client).to receive(:select_header_accept).and_return('application/vnd.app-v2.1.0+json')
|
|
24
|
+
allow(api_client).to receive(:select_header_content_type).and_return('application/json')
|
|
25
|
+
allow(api_client).to receive(:object_to_http_body) { |value| value.to_json }
|
|
27
26
|
end
|
|
28
27
|
|
|
29
28
|
describe 'test an instance of ChargesApi' do
|
|
30
|
-
it '
|
|
31
|
-
expect(
|
|
29
|
+
it 'creates an instance of ChargesApi' do
|
|
30
|
+
expect(api_instance).to be_instance_of(DigitalFemsa::ChargesApi)
|
|
32
31
|
end
|
|
33
32
|
end
|
|
34
33
|
|
|
35
|
-
#
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
# @option opts [Integer] :limit The numbers of items to return, the maximum value is 250
|
|
41
|
-
# @option opts [String] :search General order search, e.g. by mail, reference etc.
|
|
42
|
-
# @option opts [String] :_next next page
|
|
43
|
-
# @option opts [String] :previous previous page
|
|
44
|
-
# @return [GetChargesResponse]
|
|
45
|
-
describe 'get_charges test' do
|
|
46
|
-
it 'should work' do
|
|
47
|
-
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
34
|
+
describe '#get_charges_with_http_info' do
|
|
35
|
+
it 'raises for limit higher than 250' do
|
|
36
|
+
expect do
|
|
37
|
+
api_instance.get_charges_with_http_info(limit: 251)
|
|
38
|
+
end.to raise_error(ArgumentError, /must be smaller than or equal to 250/)
|
|
48
39
|
end
|
|
49
|
-
end
|
|
50
40
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
41
|
+
it 'raises for limit lower than 1' do
|
|
42
|
+
expect do
|
|
43
|
+
api_instance.get_charges_with_http_info(limit: 0)
|
|
44
|
+
end.to raise_error(ArgumentError, /must be greater than or equal to 1/)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
it 'maps list filters into query params' do
|
|
48
|
+
expect(api_client).to receive(:call_api).with(:GET, '/charges', hash_including(
|
|
49
|
+
operation: :'ChargesApi.get_charges',
|
|
50
|
+
query_params: {
|
|
51
|
+
limit: 10,
|
|
52
|
+
next: 'next_token',
|
|
53
|
+
previous: 'prev_token',
|
|
54
|
+
search: 'ord_123'
|
|
55
|
+
},
|
|
56
|
+
return_type: 'GetChargesResponse'
|
|
57
|
+
)).and_return([:list, 200, {}])
|
|
58
|
+
|
|
59
|
+
data = api_instance.get_charges(
|
|
60
|
+
limit: 10,
|
|
61
|
+
_next: 'next_token',
|
|
62
|
+
previous: 'prev_token',
|
|
63
|
+
search: 'ord_123'
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
expect(data).to eq(:list)
|
|
63
67
|
end
|
|
64
68
|
end
|
|
65
69
|
|
|
66
|
-
#
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
describe '#orders_create_charge_with_http_info' do
|
|
71
|
+
it 'raises when id is missing' do
|
|
72
|
+
expect do
|
|
73
|
+
api_instance.orders_create_charge_with_http_info(nil, { amount: 1000 })
|
|
74
|
+
end.to raise_error(ArgumentError, /Missing the required parameter 'id'/)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
it 'raises when charge_request is missing' do
|
|
78
|
+
expect do
|
|
79
|
+
api_instance.orders_create_charge_with_http_info('ord_123', nil)
|
|
80
|
+
end.to raise_error(ArgumentError, /Missing the required parameter 'charge_request'/)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
it 'builds escaped path and sends charge payload' do
|
|
84
|
+
payload = { amount: 1500, currency: 'MXN' }
|
|
85
|
+
|
|
86
|
+
expect(api_client).to receive(:call_api).with(:POST, '/orders/ord%2F123/charges', hash_including(
|
|
87
|
+
operation: :'ChargesApi.orders_create_charge',
|
|
88
|
+
body: payload.to_json,
|
|
89
|
+
return_type: 'ChargeOrderResponse'
|
|
90
|
+
)).and_return([:created, 201, {}])
|
|
91
|
+
|
|
92
|
+
data = api_instance.orders_create_charge('ord/123', payload)
|
|
93
|
+
expect(data).to eq(:created)
|
|
77
94
|
end
|
|
78
95
|
end
|
|
79
96
|
|
|
97
|
+
describe '#update_charge_with_http_info' do
|
|
98
|
+
it 'raises when id is missing' do
|
|
99
|
+
expect do
|
|
100
|
+
api_instance.update_charge_with_http_info(nil, { reference_id: 'ref_1' })
|
|
101
|
+
end.to raise_error(ArgumentError, /Missing the required parameter 'id'/)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
it 'raises when charge_update_request is missing' do
|
|
105
|
+
expect do
|
|
106
|
+
api_instance.update_charge_with_http_info('chg_123', nil)
|
|
107
|
+
end.to raise_error(ArgumentError, /Missing the required parameter 'charge_update_request'/)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
it 'sends PUT request with serialized payload' do
|
|
111
|
+
payload = { reference_id: 'new_reference' }
|
|
112
|
+
|
|
113
|
+
expect(api_client).to receive(:call_api).with(:PUT, '/charges/chg_123', hash_including(
|
|
114
|
+
operation: :'ChargesApi.update_charge',
|
|
115
|
+
body: payload.to_json,
|
|
116
|
+
return_type: 'ChargeResponse'
|
|
117
|
+
)).and_return([:updated, 200, {}])
|
|
118
|
+
|
|
119
|
+
data = api_instance.update_charge('chg_123', payload)
|
|
120
|
+
expect(data).to eq(:updated)
|
|
121
|
+
end
|
|
122
|
+
end
|
|
80
123
|
end
|
|
@@ -13,51 +13,73 @@ Generator version: 7.5.0
|
|
|
13
13
|
require 'spec_helper'
|
|
14
14
|
require 'json'
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
before do
|
|
21
|
-
# run before each test
|
|
22
|
-
@api_instance = DigitalFemsa::CompaniesApi.new
|
|
23
|
-
end
|
|
16
|
+
RSpec.describe DigitalFemsa::CompaniesApi do
|
|
17
|
+
let(:config) { DigitalFemsa::Configuration.new }
|
|
18
|
+
let(:api_client) { instance_double(DigitalFemsa::ApiClient) }
|
|
19
|
+
let(:api_instance) { described_class.new(api_client) }
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
before do
|
|
22
|
+
allow(api_client).to receive(:config).and_return(config)
|
|
23
|
+
allow(api_client).to receive(:select_header_accept).and_return('application/vnd.app-v2.1.0+json')
|
|
27
24
|
end
|
|
28
25
|
|
|
29
26
|
describe 'test an instance of CompaniesApi' do
|
|
30
|
-
it '
|
|
31
|
-
expect(
|
|
27
|
+
it 'creates an instance of CompaniesApi' do
|
|
28
|
+
expect(api_instance).to be_instance_of(DigitalFemsa::CompaniesApi)
|
|
32
29
|
end
|
|
33
30
|
end
|
|
34
31
|
|
|
35
|
-
#
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
# @option opts [Integer] :limit The numbers of items to return, the maximum value is 250
|
|
41
|
-
# @option opts [String] :search General order search, e.g. by mail, reference etc.
|
|
42
|
-
# @option opts [String] :_next next page
|
|
43
|
-
# @option opts [String] :previous previous page
|
|
44
|
-
# @return [GetCompaniesResponse]
|
|
45
|
-
describe 'get_companies test' do
|
|
46
|
-
it 'should work' do
|
|
47
|
-
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
32
|
+
describe '#get_companies_with_http_info' do
|
|
33
|
+
it 'raises for limit higher than 250' do
|
|
34
|
+
expect do
|
|
35
|
+
api_instance.get_companies_with_http_info(limit: 251)
|
|
36
|
+
end.to raise_error(ArgumentError, /must be smaller than or equal to 250/)
|
|
48
37
|
end
|
|
49
|
-
end
|
|
50
38
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
39
|
+
it 'raises for limit lower than 1' do
|
|
40
|
+
expect do
|
|
41
|
+
api_instance.get_companies_with_http_info(limit: 0)
|
|
42
|
+
end.to raise_error(ArgumentError, /must be greater than or equal to 1/)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it 'maps pagination and search into query params' do
|
|
46
|
+
expect(api_client).to receive(:call_api).with(:GET, '/companies', hash_including(
|
|
47
|
+
operation: :'CompaniesApi.get_companies',
|
|
48
|
+
query_params: {
|
|
49
|
+
limit: 25,
|
|
50
|
+
search: 'subsidiary',
|
|
51
|
+
next: 'next_token',
|
|
52
|
+
previous: 'prev_token'
|
|
53
|
+
},
|
|
54
|
+
return_type: 'GetCompaniesResponse'
|
|
55
|
+
)).and_return([:companies, 200, {}])
|
|
56
|
+
|
|
57
|
+
data = api_instance.get_companies(
|
|
58
|
+
limit: 25,
|
|
59
|
+
search: 'subsidiary',
|
|
60
|
+
_next: 'next_token',
|
|
61
|
+
previous: 'prev_token'
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
expect(data).to eq(:companies)
|
|
60
65
|
end
|
|
61
66
|
end
|
|
62
67
|
|
|
68
|
+
describe '#get_company_with_http_info' do
|
|
69
|
+
it 'raises when id is missing' do
|
|
70
|
+
expect do
|
|
71
|
+
api_instance.get_company_with_http_info(nil)
|
|
72
|
+
end.to raise_error(ArgumentError, /Missing the required parameter 'id'/)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
it 'sends GET request with escaped company id path' do
|
|
76
|
+
expect(api_client).to receive(:call_api).with(:GET, '/companies/com%2F123', hash_including(
|
|
77
|
+
operation: :'CompaniesApi.get_company',
|
|
78
|
+
return_type: 'CompanyResponse'
|
|
79
|
+
)).and_return([:company, 200, {}])
|
|
80
|
+
|
|
81
|
+
data = api_instance.get_company('com/123')
|
|
82
|
+
expect(data).to eq(:company)
|
|
83
|
+
end
|
|
84
|
+
end
|
|
63
85
|
end
|
|
@@ -13,128 +13,144 @@ Generator version: 7.5.0
|
|
|
13
13
|
require 'spec_helper'
|
|
14
14
|
require 'json'
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
before do
|
|
21
|
-
# run before each test
|
|
22
|
-
@api_instance = DigitalFemsa::CustomersApi.new
|
|
23
|
-
end
|
|
16
|
+
RSpec.describe DigitalFemsa::CustomersApi do
|
|
17
|
+
let(:config) { DigitalFemsa::Configuration.new }
|
|
18
|
+
let(:api_client) { instance_double(DigitalFemsa::ApiClient) }
|
|
19
|
+
let(:api_instance) { described_class.new(api_client) }
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
before do
|
|
22
|
+
allow(api_client).to receive(:config).and_return(config)
|
|
23
|
+
allow(api_client).to receive(:select_header_accept).and_return('application/vnd.app-v2.1.0+json')
|
|
24
|
+
allow(api_client).to receive(:select_header_content_type).and_return('application/json')
|
|
25
|
+
allow(api_client).to receive(:object_to_http_body) { |value| value.to_json }
|
|
27
26
|
end
|
|
28
27
|
|
|
29
28
|
describe 'test an instance of CustomersApi' do
|
|
30
|
-
it '
|
|
31
|
-
expect(
|
|
29
|
+
it 'creates an instance of CustomersApi' do
|
|
30
|
+
expect(api_instance).to be_instance_of(DigitalFemsa::CustomersApi)
|
|
32
31
|
end
|
|
33
32
|
end
|
|
34
33
|
|
|
35
|
-
#
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
# @option opts [String] :accept_language Use for knowing which language to use
|
|
41
|
-
# @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request.
|
|
42
|
-
# @return [CustomerResponse]
|
|
43
|
-
describe 'create_customer test' do
|
|
44
|
-
it 'should work' do
|
|
45
|
-
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
34
|
+
describe '#create_customer_with_http_info' do
|
|
35
|
+
it 'raises when customer is missing' do
|
|
36
|
+
expect do
|
|
37
|
+
api_instance.create_customer_with_http_info(nil)
|
|
38
|
+
end.to raise_error(ArgumentError, /Missing the required parameter 'customer'/)
|
|
46
39
|
end
|
|
47
|
-
end
|
|
48
40
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
41
|
+
it 'sends POST request with serialized customer body' do
|
|
42
|
+
payload = { name: 'Vicente', email: 'vicente@example.com' }
|
|
43
|
+
|
|
44
|
+
expect(api_client).to receive(:call_api).with(:POST, '/customers', hash_including(
|
|
45
|
+
operation: :'CustomersApi.create_customer',
|
|
46
|
+
body: payload.to_json,
|
|
47
|
+
return_type: 'CustomerResponse'
|
|
48
|
+
)).and_return([:created, 201, {}])
|
|
49
|
+
|
|
50
|
+
data = api_instance.create_customer(payload)
|
|
51
|
+
expect(data).to eq(:created)
|
|
61
52
|
end
|
|
62
53
|
end
|
|
63
54
|
|
|
64
|
-
#
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
# @option opts [String] :accept_language Use for knowing which language to use
|
|
70
|
-
# @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request.
|
|
71
|
-
# @return [CustomerResponse]
|
|
72
|
-
describe 'delete_customer_by_id test' do
|
|
73
|
-
it 'should work' do
|
|
74
|
-
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
55
|
+
describe '#create_customer_fiscal_entities_with_http_info' do
|
|
56
|
+
it 'raises when id is missing' do
|
|
57
|
+
expect do
|
|
58
|
+
api_instance.create_customer_fiscal_entities_with_http_info(nil, { rfc: 'XAXX010101000' })
|
|
59
|
+
end.to raise_error(ArgumentError, /Missing the required parameter 'id'/)
|
|
75
60
|
end
|
|
76
|
-
end
|
|
77
61
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
# @param [Hash] opts the optional parameters
|
|
83
|
-
# @option opts [String] :accept_language Use for knowing which language to use
|
|
84
|
-
# @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request.
|
|
85
|
-
# @return [CustomerResponse]
|
|
86
|
-
describe 'get_customer_by_id test' do
|
|
87
|
-
it 'should work' do
|
|
88
|
-
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
62
|
+
it 'raises when fiscal entity payload is missing' do
|
|
63
|
+
expect do
|
|
64
|
+
api_instance.create_customer_fiscal_entities_with_http_info('cus_123', nil)
|
|
65
|
+
end.to raise_error(ArgumentError, /Missing the required parameter 'customer_fiscal_entities_request'/)
|
|
89
66
|
end
|
|
90
|
-
end
|
|
91
67
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
describe 'get_customers test' do
|
|
104
|
-
it 'should work' do
|
|
105
|
-
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
68
|
+
it 'builds escaped path and sends POST request' do
|
|
69
|
+
payload = { rfc: 'XAXX010101000' }
|
|
70
|
+
|
|
71
|
+
expect(api_client).to receive(:call_api).with(:POST, '/customers/cus%2F123/fiscal_entities', hash_including(
|
|
72
|
+
operation: :'CustomersApi.create_customer_fiscal_entities',
|
|
73
|
+
body: payload.to_json,
|
|
74
|
+
return_type: 'CreateCustomerFiscalEntitiesResponse'
|
|
75
|
+
)).and_return([:created, 201, {}])
|
|
76
|
+
|
|
77
|
+
data = api_instance.create_customer_fiscal_entities('cus/123', payload)
|
|
78
|
+
expect(data).to eq(:created)
|
|
106
79
|
end
|
|
107
80
|
end
|
|
108
81
|
|
|
109
|
-
#
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
82
|
+
describe '#delete_customer_by_id_with_http_info' do
|
|
83
|
+
it 'raises when id is missing' do
|
|
84
|
+
expect do
|
|
85
|
+
api_instance.delete_customer_by_id_with_http_info(nil)
|
|
86
|
+
end.to raise_error(ArgumentError, /Missing the required parameter 'id'/)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
it 'sends DELETE request to customer resource' do
|
|
90
|
+
expect(api_client).to receive(:call_api).with(:DELETE, '/customers/cus_123', hash_including(
|
|
91
|
+
operation: :'CustomersApi.delete_customer_by_id',
|
|
92
|
+
return_type: 'CustomerResponse'
|
|
93
|
+
)).and_return([:deleted, 200, {}])
|
|
94
|
+
|
|
95
|
+
data = api_instance.delete_customer_by_id('cus_123')
|
|
96
|
+
expect(data).to eq(:deleted)
|
|
121
97
|
end
|
|
122
98
|
end
|
|
123
99
|
|
|
124
|
-
#
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
100
|
+
describe '#get_customers_with_http_info' do
|
|
101
|
+
it 'raises for limit higher than 250' do
|
|
102
|
+
expect do
|
|
103
|
+
api_instance.get_customers_with_http_info(limit: 251)
|
|
104
|
+
end.to raise_error(ArgumentError, /must be smaller than or equal to 250/)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
it 'raises for limit lower than 1' do
|
|
108
|
+
expect do
|
|
109
|
+
api_instance.get_customers_with_http_info(limit: 0)
|
|
110
|
+
end.to raise_error(ArgumentError, /must be greater than or equal to 1/)
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
it 'maps pagination and search filters to query params' do
|
|
114
|
+
expect(api_client).to receive(:call_api).with(:GET, '/customers', hash_including(
|
|
115
|
+
operation: :'CustomersApi.get_customers',
|
|
116
|
+
query_params: {
|
|
117
|
+
limit: 20,
|
|
118
|
+
search: 'vicente',
|
|
119
|
+
next: 'next_token',
|
|
120
|
+
previous: 'prev_token'
|
|
121
|
+
},
|
|
122
|
+
return_type: 'CustomersResponse'
|
|
123
|
+
)).and_return([:list, 200, {}])
|
|
124
|
+
|
|
125
|
+
data = api_instance.get_customers(
|
|
126
|
+
limit: 20,
|
|
127
|
+
search: 'vicente',
|
|
128
|
+
_next: 'next_token',
|
|
129
|
+
previous: 'prev_token'
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
expect(data).to eq(:list)
|
|
137
133
|
end
|
|
138
134
|
end
|
|
139
135
|
|
|
136
|
+
describe '#update_customer_fiscal_entities_with_http_info' do
|
|
137
|
+
it 'raises when fiscal_entities_id is missing' do
|
|
138
|
+
expect do
|
|
139
|
+
api_instance.update_customer_fiscal_entities_with_http_info('cus_123', nil, { business_name: 'Test SA' })
|
|
140
|
+
end.to raise_error(ArgumentError, /Missing the required parameter 'fiscal_entities_id'/)
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
it 'sends PUT request with expected path and body' do
|
|
144
|
+
payload = { business_name: 'Test SA' }
|
|
145
|
+
|
|
146
|
+
expect(api_client).to receive(:call_api).with(:PUT, '/customers/cus_123/fiscal_entities/fis_123', hash_including(
|
|
147
|
+
operation: :'CustomersApi.update_customer_fiscal_entities',
|
|
148
|
+
body: payload.to_json,
|
|
149
|
+
return_type: 'UpdateCustomerFiscalEntitiesResponse'
|
|
150
|
+
)).and_return([:updated, 200, {}])
|
|
151
|
+
|
|
152
|
+
data = api_instance.update_customer_fiscal_entities('cus_123', 'fis_123', payload)
|
|
153
|
+
expect(data).to eq(:updated)
|
|
154
|
+
end
|
|
155
|
+
end
|
|
140
156
|
end
|