gocardless_pro 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.
- checksums.yaml +4 -4
- data/.travis.yml +12 -0
- data/README.md +71 -28
- data/gocardless_pro.gemspec +1 -1
- data/lib/gocardless_pro/api_service.rb +4 -2
- data/lib/gocardless_pro/client.rb +2 -1
- data/lib/gocardless_pro/error.rb +12 -1
- data/lib/gocardless_pro/resources/mandate.rb +3 -0
- data/lib/gocardless_pro/resources/payout.rb +3 -0
- data/lib/gocardless_pro/resources/redirect_flow.rb +15 -14
- data/lib/gocardless_pro/services/bank_details_lookups_service.rb +10 -0
- data/lib/gocardless_pro/services/creditor_bank_accounts_service.rb +5 -2
- data/lib/gocardless_pro/services/creditors_service.rb +5 -2
- data/lib/gocardless_pro/services/customer_bank_accounts_service.rb +7 -3
- data/lib/gocardless_pro/services/customers_service.rb +5 -2
- data/lib/gocardless_pro/services/events_service.rb +2 -1
- data/lib/gocardless_pro/services/mandate_pdfs_service.rb +2 -1
- data/lib/gocardless_pro/services/mandates_service.rb +10 -5
- data/lib/gocardless_pro/services/payments_service.rb +11 -6
- data/lib/gocardless_pro/services/payouts_service.rb +2 -1
- data/lib/gocardless_pro/services/redirect_flows_service.rb +6 -3
- data/lib/gocardless_pro/services/refunds_service.rb +5 -2
- data/lib/gocardless_pro/services/subscriptions_service.rb +7 -3
- data/lib/gocardless_pro/version.rb +1 -1
- data/spec/api_response_spec.rb +4 -4
- data/spec/api_service_spec.rb +41 -43
- data/spec/client_spec.rb +2 -2
- data/spec/error_spec.rb +27 -18
- data/spec/resources/bank_details_lookup_spec.rb +19 -34
- data/spec/resources/creditor_bank_account_spec.rb +54 -99
- data/spec/resources/creditor_spec.rb +66 -115
- data/spec/resources/customer_bank_account_spec.rb +54 -99
- data/spec/resources/customer_spec.rb +71 -138
- data/spec/resources/event_spec.rb +74 -107
- data/spec/resources/mandate_pdf_spec.rb +15 -26
- data/spec/resources/mandate_spec.rb +54 -87
- data/spec/resources/payment_spec.rb +70 -119
- data/spec/resources/payout_spec.rb +50 -79
- data/spec/resources/redirect_flow_spec.rb +58 -95
- data/spec/resources/refund_spec.rb +42 -75
- data/spec/resources/subscription_spec.rb +82 -155
- data/spec/response_spec.rb +45 -46
- data/spec/services/bank_details_lookups_service_spec.rb +55 -60
- data/spec/services/creditor_bank_accounts_service_spec.rb +303 -347
- data/spec/services/creditors_service_spec.rb +290 -333
- data/spec/services/customer_bank_accounts_service_spec.rb +332 -380
- data/spec/services/customers_service_spec.rb +347 -400
- data/spec/services/events_service_spec.rb +154 -184
- data/spec/services/mandate_pdfs_service_spec.rb +52 -57
- data/spec/services/mandates_service_spec.rb +374 -410
- data/spec/services/payments_service_spec.rb +404 -461
- data/spec/services/payouts_service_spec.rb +161 -184
- data/spec/services/redirect_flows_service_spec.rb +188 -205
- data/spec/services/refunds_service_spec.rb +245 -280
- data/spec/services/subscriptions_service_spec.rb +423 -485
- data/spec/spec_helper.rb +46 -48
- metadata +22 -20
data/spec/api_service_spec.rb
CHANGED
@@ -1,72 +1,70 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe GoCardlessPro::ApiService do
|
4
|
-
subject(:service) { described_class.new(
|
4
|
+
subject(:service) { described_class.new('https://api.example.com', 'secret_token') }
|
5
5
|
|
6
|
-
it
|
7
|
-
stub = stub_request(:get, 'https://api.example.com/customers')
|
8
|
-
|
9
|
-
service.make_request(:get,
|
6
|
+
it 'uses basic auth' do
|
7
|
+
stub = stub_request(:get, 'https://api.example.com/customers')
|
8
|
+
.with(headers: { 'Authorization' => 'Bearer secret_token' })
|
9
|
+
service.make_request(:get, '/customers')
|
10
10
|
expect(stub).to have_been_requested
|
11
11
|
end
|
12
12
|
|
13
|
-
describe
|
14
|
-
it
|
13
|
+
describe 'making a get request without any parameters' do
|
14
|
+
it 'is expected to call the correct stub' do
|
15
15
|
stub = stub_request(:get, /.*api.example.com\/customers/)
|
16
|
-
service.make_request(:get,
|
16
|
+
service.make_request(:get, '/customers')
|
17
17
|
expect(stub).to have_been_requested
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
describe
|
22
|
-
it
|
21
|
+
describe 'making a get request with query parameters' do
|
22
|
+
it 'correctly passes the query parameters' do
|
23
23
|
stub = stub_request(:get, /.*api.example.com\/customers\?a=1&b=2/)
|
24
|
-
service.make_request(:get,
|
24
|
+
service.make_request(:get, '/customers', params: { a: 1, b: 2 })
|
25
25
|
expect(stub).to have_been_requested
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
describe
|
30
|
-
it
|
31
|
-
stub = stub_request(:post, /.*api.example.com\/customers/)
|
32
|
-
|
33
|
-
service.make_request(:post,
|
34
|
-
|
35
|
-
|
36
|
-
|
29
|
+
describe 'making a post request with some data' do
|
30
|
+
it 'passes the data in as the post body' do
|
31
|
+
stub = stub_request(:post, /.*api.example.com\/customers/)
|
32
|
+
.with(body: { given_name: 'Jack', family_name: 'Franklin' })
|
33
|
+
service.make_request(:post, '/customers', params: {
|
34
|
+
given_name: 'Jack',
|
35
|
+
family_name: 'Franklin'
|
36
|
+
})
|
37
37
|
expect(stub).to have_been_requested
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
describe
|
42
|
-
it
|
43
|
-
stub = stub_request(:post, /.*api.example.com\/customers/)
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
41
|
+
describe 'making a post request with data and custom header' do
|
42
|
+
it 'passes the data in as the post body' do
|
43
|
+
stub = stub_request(:post, /.*api.example.com\/customers/)
|
44
|
+
.with(
|
45
|
+
body: { given_name: 'Jack', family_name: 'Franklin' },
|
46
|
+
headers: { 'Foo' => 'Bar' }
|
47
|
+
)
|
48
48
|
|
49
|
-
service.make_request(:post,
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
}
|
57
|
-
})
|
49
|
+
service.make_request(:post, '/customers', params: {
|
50
|
+
given_name: 'Jack',
|
51
|
+
family_name: 'Franklin'
|
52
|
+
},
|
53
|
+
headers: {
|
54
|
+
'Foo' => 'Bar'
|
55
|
+
})
|
58
56
|
expect(stub).to have_been_requested
|
59
57
|
end
|
60
58
|
end
|
61
59
|
|
62
|
-
describe
|
63
|
-
it
|
64
|
-
stub = stub_request(:put, /.*api.example.com\/customers\/CU123/)
|
65
|
-
|
66
|
-
service.make_request(:put,
|
67
|
-
|
68
|
-
|
69
|
-
|
60
|
+
describe 'making a put request with some data' do
|
61
|
+
it 'passes the data in as the request body' do
|
62
|
+
stub = stub_request(:put, /.*api.example.com\/customers\/CU123/)
|
63
|
+
.with(body: { given_name: 'Jack', family_name: 'Franklin' })
|
64
|
+
service.make_request(:put, '/customers/CU123', params: {
|
65
|
+
given_name: 'Jack',
|
66
|
+
family_name: 'Franklin'
|
67
|
+
})
|
70
68
|
expect(stub).to have_been_requested
|
71
69
|
end
|
72
70
|
end
|
data/spec/client_spec.rb
CHANGED
@@ -10,10 +10,10 @@ describe GoCardlessPro::Client do
|
|
10
10
|
}
|
11
11
|
end
|
12
12
|
|
13
|
-
context
|
13
|
+
context 'when initialised without an Access Token' do
|
14
14
|
let(:environment) { :live }
|
15
15
|
let(:token) { nil }
|
16
16
|
|
17
|
-
it { is_expected.to raise_error(
|
17
|
+
it { is_expected.to raise_error('No Access Token given to GoCardless Client') }
|
18
18
|
end
|
19
19
|
end
|
data/spec/error_spec.rb
CHANGED
@@ -5,40 +5,49 @@ describe GoCardlessPro::Error do
|
|
5
5
|
|
6
6
|
let(:api_error) do
|
7
7
|
{
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
'documentation_url' => 'https://developer.gocardless.com/pro#validation_failed',
|
9
|
+
'message' => 'Validation failed',
|
10
|
+
'type' => 'validation_failed',
|
11
|
+
'code' => 422,
|
12
|
+
'request_id' => 'dd50eaaf-8213-48fe-90d6-5466872efbc4',
|
13
|
+
'errors' => [
|
14
14
|
{
|
15
|
-
|
16
|
-
|
15
|
+
'message' => 'must be a number',
|
16
|
+
'field' => 'branch_code'
|
17
17
|
}, {
|
18
|
-
|
19
|
-
|
18
|
+
'message' => 'is the wrong length (should be 8 characters)',
|
19
|
+
'field' => 'branch_code'
|
20
20
|
}
|
21
21
|
]
|
22
22
|
}
|
23
23
|
end
|
24
24
|
|
25
25
|
specify do
|
26
|
-
expect(error.documentation_url).to eq(
|
26
|
+
expect(error.documentation_url).to eq('https://developer.gocardless.com/pro#validation_failed')
|
27
27
|
end
|
28
28
|
|
29
|
-
specify { expect(error.message).to eq(
|
30
|
-
specify
|
29
|
+
specify { expect(error.message).to eq('Validation failed') }
|
30
|
+
specify do
|
31
|
+
expect(error.to_s)
|
32
|
+
.to eq('branch_code must be a number, '\
|
33
|
+
'branch_code is the wrong length (should be 8 characters)')
|
34
|
+
end
|
35
|
+
specify { expect(error.type).to eq('validation_failed') }
|
31
36
|
specify { expect(error.code).to eq(422) }
|
32
|
-
specify { expect(error.request_id).to eq(
|
37
|
+
specify { expect(error.request_id).to eq('dd50eaaf-8213-48fe-90d6-5466872efbc4') }
|
33
38
|
specify do
|
34
39
|
expect(error.errors).to eq([
|
35
40
|
{
|
36
|
-
|
37
|
-
|
41
|
+
'message' => 'must be a number',
|
42
|
+
'field' => 'branch_code'
|
38
43
|
}, {
|
39
|
-
|
40
|
-
|
44
|
+
'message' => 'is the wrong length (should be 8 characters)',
|
45
|
+
'field' => 'branch_code'
|
41
46
|
}
|
42
47
|
])
|
43
48
|
end
|
49
|
+
|
50
|
+
context 'when initializing an error with a string' do
|
51
|
+
specify { expect { described_class.new('FOO') }.to raise_error(ArgumentError) }
|
52
|
+
end
|
44
53
|
end
|
@@ -1,51 +1,36 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe GoCardlessPro::Resources::BankDetailsLookup do
|
4
|
-
describe
|
4
|
+
describe 'initialising' do
|
5
5
|
let(:data) do
|
6
6
|
{
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
"bic" => "bic-input",
|
18
|
-
|
19
|
-
|
7
|
+
|
8
|
+
'available_debit_schemes' => 'available_debit_schemes-input',
|
9
|
+
|
10
|
+
'bank_name' => 'bank_name-input',
|
11
|
+
|
12
|
+
'bic' => 'bic-input'
|
13
|
+
|
20
14
|
}
|
21
15
|
end
|
22
16
|
|
23
|
-
it
|
17
|
+
it 'can be initialized from an unenveloped response' do
|
24
18
|
resource = described_class.new(data)
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
expect(resource.bank_name).to eq("bank_name-input")
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
expect(resource.bic).to eq("bic-input")
|
36
|
-
|
37
|
-
|
19
|
+
|
20
|
+
expect(resource.available_debit_schemes).to eq('available_debit_schemes-input')
|
21
|
+
|
22
|
+
expect(resource.bank_name).to eq('bank_name-input')
|
23
|
+
|
24
|
+
expect(resource.bic).to eq('bic-input')
|
38
25
|
end
|
39
26
|
|
40
|
-
it
|
41
|
-
data[
|
27
|
+
it 'can handle new attributes without erroring' do
|
28
|
+
data['foo'] = 'bar'
|
42
29
|
expect { described_class.new(data) }.to_not raise_error
|
43
30
|
end
|
44
31
|
|
45
|
-
|
46
|
-
|
47
|
-
describe "#to_h" do
|
48
|
-
it "returns a hash representing the resource" do
|
32
|
+
describe '#to_h' do
|
33
|
+
it 'returns a hash representing the resource' do
|
49
34
|
expect(described_class.new(data).to_h).to eq(data)
|
50
35
|
end
|
51
36
|
end
|
@@ -1,123 +1,78 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe GoCardlessPro::Resources::CreditorBankAccount do
|
4
|
-
describe
|
4
|
+
describe 'initialising' do
|
5
5
|
let(:data) do
|
6
6
|
{
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
"currency" => "currency-input",
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
"enabled" => "enabled-input",
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
"id" => "id-input",
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
"links" => {
|
42
|
-
|
43
|
-
"creditor" => "creditor-input",
|
44
|
-
|
7
|
+
|
8
|
+
'account_holder_name' => 'account_holder_name-input',
|
9
|
+
|
10
|
+
'account_number_ending' => 'account_number_ending-input',
|
11
|
+
|
12
|
+
'bank_name' => 'bank_name-input',
|
13
|
+
|
14
|
+
'country_code' => 'country_code-input',
|
15
|
+
|
16
|
+
'created_at' => 'created_at-input',
|
17
|
+
|
18
|
+
'currency' => 'currency-input',
|
19
|
+
|
20
|
+
'enabled' => 'enabled-input',
|
21
|
+
|
22
|
+
'id' => 'id-input',
|
23
|
+
|
24
|
+
'links' => {
|
25
|
+
|
26
|
+
'creditor' => 'creditor-input'
|
27
|
+
|
45
28
|
},
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
"metadata" => "metadata-input",
|
50
|
-
|
51
|
-
|
29
|
+
|
30
|
+
'metadata' => 'metadata-input'
|
31
|
+
|
52
32
|
}
|
53
33
|
end
|
54
34
|
|
55
|
-
it
|
35
|
+
it 'can be initialized from an unenveloped response' do
|
56
36
|
resource = described_class.new(data)
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
expect(resource.currency).to eq("currency-input")
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
expect(resource.enabled).to eq("enabled-input")
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
expect(resource.id).to eq("id-input")
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
expect(resource.links.creditor).to eq("creditor-input")
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
expect(resource.metadata).to eq("metadata-input")
|
98
|
-
|
99
|
-
|
37
|
+
|
38
|
+
expect(resource.account_holder_name).to eq('account_holder_name-input')
|
39
|
+
|
40
|
+
expect(resource.account_number_ending).to eq('account_number_ending-input')
|
41
|
+
|
42
|
+
expect(resource.bank_name).to eq('bank_name-input')
|
43
|
+
|
44
|
+
expect(resource.country_code).to eq('country_code-input')
|
45
|
+
|
46
|
+
expect(resource.created_at).to eq('created_at-input')
|
47
|
+
|
48
|
+
expect(resource.currency).to eq('currency-input')
|
49
|
+
|
50
|
+
expect(resource.enabled).to eq('enabled-input')
|
51
|
+
|
52
|
+
expect(resource.id).to eq('id-input')
|
53
|
+
|
54
|
+
expect(resource.links.creditor).to eq('creditor-input')
|
55
|
+
|
56
|
+
expect(resource.metadata).to eq('metadata-input')
|
100
57
|
end
|
101
58
|
|
102
|
-
it
|
103
|
-
data[
|
59
|
+
it 'can handle new attributes without erroring' do
|
60
|
+
data['foo'] = 'bar'
|
104
61
|
expect { described_class.new(data) }.to_not raise_error
|
105
62
|
end
|
106
63
|
|
107
|
-
|
108
|
-
|
109
|
-
data["links"]["foo"] = "bar"
|
64
|
+
it 'can handle new link attributes without erroring' do
|
65
|
+
data['links']['foo'] = 'bar'
|
110
66
|
expect { described_class.new(data) }.to_not raise_error
|
111
67
|
end
|
112
68
|
|
113
|
-
it
|
114
|
-
data[
|
69
|
+
it 'can handle a nil links value' do
|
70
|
+
data['links'] = nil
|
115
71
|
expect { described_class.new(data).links }.to_not raise_error
|
116
72
|
end
|
117
|
-
|
118
73
|
|
119
|
-
describe
|
120
|
-
it
|
74
|
+
describe '#to_h' do
|
75
|
+
it 'returns a hash representing the resource' do
|
121
76
|
expect(described_class.new(data).to_h).to eq(data)
|
122
77
|
end
|
123
78
|
end
|
@@ -1,139 +1,90 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe GoCardlessPro::Resources::Creditor do
|
4
|
-
describe
|
4
|
+
describe 'initialising' do
|
5
5
|
let(:data) do
|
6
6
|
{
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
"id" => "id-input",
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
"links" => {
|
38
|
-
|
39
|
-
"default_eur_payout_account" => "default_eur_payout_account-input",
|
40
|
-
|
41
|
-
"default_gbp_payout_account" => "default_gbp_payout_account-input",
|
42
|
-
|
43
|
-
"default_sek_payout_account" => "default_sek_payout_account-input",
|
44
|
-
|
7
|
+
|
8
|
+
'address_line1' => 'address_line1-input',
|
9
|
+
|
10
|
+
'address_line2' => 'address_line2-input',
|
11
|
+
|
12
|
+
'address_line3' => 'address_line3-input',
|
13
|
+
|
14
|
+
'city' => 'city-input',
|
15
|
+
|
16
|
+
'country_code' => 'country_code-input',
|
17
|
+
|
18
|
+
'created_at' => 'created_at-input',
|
19
|
+
|
20
|
+
'id' => 'id-input',
|
21
|
+
|
22
|
+
'links' => {
|
23
|
+
|
24
|
+
'default_eur_payout_account' => 'default_eur_payout_account-input',
|
25
|
+
|
26
|
+
'default_gbp_payout_account' => 'default_gbp_payout_account-input',
|
27
|
+
|
28
|
+
'default_sek_payout_account' => 'default_sek_payout_account-input'
|
29
|
+
|
45
30
|
},
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
"postal_code" => "postal_code-input",
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
"region" => "region-input",
|
58
|
-
|
59
|
-
|
31
|
+
|
32
|
+
'name' => 'name-input',
|
33
|
+
|
34
|
+
'postal_code' => 'postal_code-input',
|
35
|
+
|
36
|
+
'region' => 'region-input'
|
37
|
+
|
60
38
|
}
|
61
39
|
end
|
62
40
|
|
63
|
-
it
|
41
|
+
it 'can be initialized from an unenveloped response' do
|
64
42
|
resource = described_class.new(data)
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
expect(resource.id).to eq("id-input")
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
expect(resource.links.default_eur_payout_account).to eq("default_eur_payout_account-input")
|
97
|
-
|
98
|
-
expect(resource.links.default_gbp_payout_account).to eq("default_gbp_payout_account-input")
|
99
|
-
|
100
|
-
expect(resource.links.default_sek_payout_account).to eq("default_sek_payout_account-input")
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
expect(resource.name).to eq("name-input")
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
expect(resource.postal_code).to eq("postal_code-input")
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
expect(resource.region).to eq("region-input")
|
114
|
-
|
115
|
-
|
43
|
+
|
44
|
+
expect(resource.address_line1).to eq('address_line1-input')
|
45
|
+
|
46
|
+
expect(resource.address_line2).to eq('address_line2-input')
|
47
|
+
|
48
|
+
expect(resource.address_line3).to eq('address_line3-input')
|
49
|
+
|
50
|
+
expect(resource.city).to eq('city-input')
|
51
|
+
|
52
|
+
expect(resource.country_code).to eq('country_code-input')
|
53
|
+
|
54
|
+
expect(resource.created_at).to eq('created_at-input')
|
55
|
+
|
56
|
+
expect(resource.id).to eq('id-input')
|
57
|
+
|
58
|
+
expect(resource.links.default_eur_payout_account).to eq('default_eur_payout_account-input')
|
59
|
+
|
60
|
+
expect(resource.links.default_gbp_payout_account).to eq('default_gbp_payout_account-input')
|
61
|
+
|
62
|
+
expect(resource.links.default_sek_payout_account).to eq('default_sek_payout_account-input')
|
63
|
+
|
64
|
+
expect(resource.name).to eq('name-input')
|
65
|
+
|
66
|
+
expect(resource.postal_code).to eq('postal_code-input')
|
67
|
+
|
68
|
+
expect(resource.region).to eq('region-input')
|
116
69
|
end
|
117
70
|
|
118
|
-
it
|
119
|
-
data[
|
71
|
+
it 'can handle new attributes without erroring' do
|
72
|
+
data['foo'] = 'bar'
|
120
73
|
expect { described_class.new(data) }.to_not raise_error
|
121
74
|
end
|
122
75
|
|
123
|
-
|
124
|
-
|
125
|
-
data["links"]["foo"] = "bar"
|
76
|
+
it 'can handle new link attributes without erroring' do
|
77
|
+
data['links']['foo'] = 'bar'
|
126
78
|
expect { described_class.new(data) }.to_not raise_error
|
127
79
|
end
|
128
80
|
|
129
|
-
it
|
130
|
-
data[
|
81
|
+
it 'can handle a nil links value' do
|
82
|
+
data['links'] = nil
|
131
83
|
expect { described_class.new(data).links }.to_not raise_error
|
132
84
|
end
|
133
|
-
|
134
85
|
|
135
|
-
describe
|
136
|
-
it
|
86
|
+
describe '#to_h' do
|
87
|
+
it 'returns a hash representing the resource' do
|
137
88
|
expect(described_class.new(data).to_h).to eq(data)
|
138
89
|
end
|
139
90
|
end
|