gocardless-pro 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +2 -0
- data/Gemfile +2 -0
- data/LICENSE.txt +22 -0
- data/README.md +132 -0
- data/circle.yml +18 -0
- data/demo.rb +10 -0
- data/gocardless-pro.gemspec +27 -0
- data/lib/gocardless-pro.rb +243 -0
- data/lib/gocardless-pro/api_service.rb +57 -0
- data/lib/gocardless-pro/error.rb +42 -0
- data/lib/gocardless-pro/error/gocardless_error.rb +5 -0
- data/lib/gocardless-pro/error/invalid_api_usage_error.rb +5 -0
- data/lib/gocardless-pro/error/invalid_state_error.rb +5 -0
- data/lib/gocardless-pro/error/validation_error.rb +5 -0
- data/lib/gocardless-pro/list_response.rb +34 -0
- data/lib/gocardless-pro/paginator.rb +37 -0
- data/lib/gocardless-pro/request.rb +69 -0
- data/lib/gocardless-pro/resources/api_key.rb +62 -0
- data/lib/gocardless-pro/resources/creditor.rb +83 -0
- data/lib/gocardless-pro/resources/creditor_bank_account.rb +78 -0
- data/lib/gocardless-pro/resources/customer.rb +72 -0
- data/lib/gocardless-pro/resources/customer_bank_account.rb +80 -0
- data/lib/gocardless-pro/resources/event.rb +75 -0
- data/lib/gocardless-pro/resources/helper.rb +29 -0
- data/lib/gocardless-pro/resources/mandate.rb +70 -0
- data/lib/gocardless-pro/resources/payment.rb +86 -0
- data/lib/gocardless-pro/resources/payout.rb +66 -0
- data/lib/gocardless-pro/resources/publishable_api_key.rb +51 -0
- data/lib/gocardless-pro/resources/redirect_flow.rb +104 -0
- data/lib/gocardless-pro/resources/refund.rb +70 -0
- data/lib/gocardless-pro/resources/role.rb +101 -0
- data/lib/gocardless-pro/resources/subscription.rb +152 -0
- data/lib/gocardless-pro/resources/user.rb +60 -0
- data/lib/gocardless-pro/response.rb +77 -0
- data/lib/gocardless-pro/services/api_key_service.rb +130 -0
- data/lib/gocardless-pro/services/base_service.rb +29 -0
- data/lib/gocardless-pro/services/creditor_bank_account_service.rb +122 -0
- data/lib/gocardless-pro/services/creditor_service.rb +112 -0
- data/lib/gocardless-pro/services/customer_bank_account_service.rb +153 -0
- data/lib/gocardless-pro/services/customer_service.rb +112 -0
- data/lib/gocardless-pro/services/event_service.rb +80 -0
- data/lib/gocardless-pro/services/helper_service.rb +97 -0
- data/lib/gocardless-pro/services/mandate_service.rb +170 -0
- data/lib/gocardless-pro/services/payment_service.rb +164 -0
- data/lib/gocardless-pro/services/payout_service.rb +80 -0
- data/lib/gocardless-pro/services/publishable_api_key_service.rb +130 -0
- data/lib/gocardless-pro/services/redirect_flow_service.rb +96 -0
- data/lib/gocardless-pro/services/refund_service.rb +126 -0
- data/lib/gocardless-pro/services/role_service.rb +127 -0
- data/lib/gocardless-pro/services/subscription_service.rb +133 -0
- data/lib/gocardless-pro/services/user_service.rb +148 -0
- data/lib/gocardless-pro/version.rb +8 -0
- data/spec/api_service_spec.rb +69 -0
- data/spec/client_spec.rb +29 -0
- data/spec/error_spec.rb +44 -0
- data/spec/resources/api_key_spec.rb +85 -0
- data/spec/resources/creditor_bank_account_spec.rb +109 -0
- data/spec/resources/creditor_spec.rb +125 -0
- data/spec/resources/customer_bank_account_spec.rb +109 -0
- data/spec/resources/customer_spec.rb +127 -0
- data/spec/resources/event_spec.rb +113 -0
- data/spec/resources/helper_spec.rb +23 -0
- data/spec/resources/mandate_spec.rb +97 -0
- data/spec/resources/payment_spec.rb +129 -0
- data/spec/resources/payout_spec.rb +89 -0
- data/spec/resources/publishable_api_key_spec.rb +63 -0
- data/spec/resources/redirect_flow_spec.rb +97 -0
- data/spec/resources/refund_spec.rb +77 -0
- data/spec/resources/role_spec.rb +63 -0
- data/spec/resources/subscription_spec.rb +157 -0
- data/spec/resources/user_spec.rb +85 -0
- data/spec/response_spec.rb +79 -0
- data/spec/services/api_key_service_spec.rb +362 -0
- data/spec/services/creditor_bank_account_service_spec.rb +365 -0
- data/spec/services/creditor_service_spec.rb +339 -0
- data/spec/services/customer_bank_account_service_spec.rb +404 -0
- data/spec/services/customer_service_spec.rb +365 -0
- data/spec/services/event_service_spec.rb +172 -0
- data/spec/services/helper_service_spec.rb +123 -0
- data/spec/services/mandate_service_spec.rb +449 -0
- data/spec/services/payment_service_spec.rb +497 -0
- data/spec/services/payout_service_spec.rb +172 -0
- data/spec/services/publishable_api_key_service_spec.rb +336 -0
- data/spec/services/redirect_flow_service_spec.rb +208 -0
- data/spec/services/refund_service_spec.rb +279 -0
- data/spec/services/role_service_spec.rb +336 -0
- data/spec/services/subscription_service_spec.rb +488 -0
- data/spec/services/user_service_spec.rb +433 -0
- data/spec/spec_helper.rb +91 -0
- metadata +255 -0
@@ -0,0 +1,109 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GoCardless::Resources::CustomerBankAccount do
|
4
|
+
describe "initialising" do
|
5
|
+
let(:data) do
|
6
|
+
{
|
7
|
+
|
8
|
+
|
9
|
+
"account_holder_name" => "account_holder_name-input",
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
"account_number_ending" => "account_number_ending-input",
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
"bank_name" => "bank_name-input",
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
"country_code" => "country_code-input",
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
"created_at" => "created_at-input",
|
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
|
+
"customer" => "customer-input",
|
44
|
+
|
45
|
+
},
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
"metadata" => "metadata-input",
|
50
|
+
|
51
|
+
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
it "can be initialized from an uneveloped response" do
|
56
|
+
resource = described_class.new(data)
|
57
|
+
|
58
|
+
|
59
|
+
expect(resource.account_holder_name).to eq("account_holder_name-input")
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
expect(resource.account_number_ending).to eq("account_number_ending-input")
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
expect(resource.bank_name).to eq("bank_name-input")
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
expect(resource.country_code).to eq("country_code-input")
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
expect(resource.created_at).to eq("created_at-input")
|
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.customer).to eq("customer-input")
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
expect(resource.metadata).to eq("metadata-input")
|
98
|
+
|
99
|
+
|
100
|
+
end
|
101
|
+
|
102
|
+
describe "#to_h" do
|
103
|
+
it "returns a hash representing the resource" do
|
104
|
+
expect(described_class.new(data).to_h).to eq(data)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
@@ -0,0 +1,127 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GoCardless::Resources::Customer do
|
4
|
+
describe "initialising" do
|
5
|
+
let(:data) do
|
6
|
+
{
|
7
|
+
|
8
|
+
|
9
|
+
"address_line1" => "address_line1-input",
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
"address_line2" => "address_line2-input",
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
"address_line3" => "address_line3-input",
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
"city" => "city-input",
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
"country_code" => "country_code-input",
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
"created_at" => "created_at-input",
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
"email" => "email-input",
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
"family_name" => "family_name-input",
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
"given_name" => "given_name-input",
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
"id" => "id-input",
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
"metadata" => "metadata-input",
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
"postal_code" => "postal_code-input",
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
"region" => "region-input",
|
58
|
+
|
59
|
+
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
it "can be initialized from an uneveloped response" do
|
64
|
+
resource = described_class.new(data)
|
65
|
+
|
66
|
+
|
67
|
+
expect(resource.address_line1).to eq("address_line1-input")
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
expect(resource.address_line2).to eq("address_line2-input")
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
expect(resource.address_line3).to eq("address_line3-input")
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
expect(resource.city).to eq("city-input")
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
expect(resource.country_code).to eq("country_code-input")
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
expect(resource.created_at).to eq("created_at-input")
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
expect(resource.email).to eq("email-input")
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
expect(resource.family_name).to eq("family_name-input")
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
expect(resource.given_name).to eq("given_name-input")
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
expect(resource.id).to eq("id-input")
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
expect(resource.metadata).to eq("metadata-input")
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
expect(resource.postal_code).to eq("postal_code-input")
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
expect(resource.region).to eq("region-input")
|
116
|
+
|
117
|
+
|
118
|
+
end
|
119
|
+
|
120
|
+
describe "#to_h" do
|
121
|
+
it "returns a hash representing the resource" do
|
122
|
+
expect(described_class.new(data).to_h).to eq(data)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
@@ -0,0 +1,113 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GoCardless::Resources::Event do
|
4
|
+
describe "initialising" do
|
5
|
+
let(:data) do
|
6
|
+
{
|
7
|
+
|
8
|
+
|
9
|
+
"action" => "action-input",
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
"created_at" => "created_at-input",
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
"details" => "details-input",
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
"id" => "id-input",
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
"links" => {
|
26
|
+
|
27
|
+
"mandate" => "mandate-input",
|
28
|
+
|
29
|
+
"new_customer_bank_account" => "new_customer_bank_account-input",
|
30
|
+
|
31
|
+
"parent_event" => "parent_event-input",
|
32
|
+
|
33
|
+
"payment" => "payment-input",
|
34
|
+
|
35
|
+
"payout" => "payout-input",
|
36
|
+
|
37
|
+
"previous_customer_bank_account" => "previous_customer_bank_account-input",
|
38
|
+
|
39
|
+
"refund" => "refund-input",
|
40
|
+
|
41
|
+
"subscription" => "subscription-input",
|
42
|
+
|
43
|
+
},
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
"metadata" => "metadata-input",
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
"resource_type" => "resource_type-input",
|
52
|
+
|
53
|
+
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
it "can be initialized from an uneveloped response" do
|
58
|
+
resource = described_class.new(data)
|
59
|
+
|
60
|
+
|
61
|
+
expect(resource.action).to eq("action-input")
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
expect(resource.created_at).to eq("created_at-input")
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
expect(resource.details).to eq("details-input")
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
expect(resource.id).to eq("id-input")
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
expect(resource.links.mandate).to eq("mandate-input")
|
79
|
+
|
80
|
+
expect(resource.links.new_customer_bank_account).to eq("new_customer_bank_account-input")
|
81
|
+
|
82
|
+
expect(resource.links.parent_event).to eq("parent_event-input")
|
83
|
+
|
84
|
+
expect(resource.links.payment).to eq("payment-input")
|
85
|
+
|
86
|
+
expect(resource.links.payout).to eq("payout-input")
|
87
|
+
|
88
|
+
expect(resource.links.previous_customer_bank_account).to eq("previous_customer_bank_account-input")
|
89
|
+
|
90
|
+
expect(resource.links.refund).to eq("refund-input")
|
91
|
+
|
92
|
+
expect(resource.links.subscription).to eq("subscription-input")
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
expect(resource.metadata).to eq("metadata-input")
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
expect(resource.resource_type).to eq("resource_type-input")
|
102
|
+
|
103
|
+
|
104
|
+
end
|
105
|
+
|
106
|
+
describe "#to_h" do
|
107
|
+
it "returns a hash representing the resource" do
|
108
|
+
expect(described_class.new(data).to_h).to eq(data)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GoCardless::Resources::Helper do
|
4
|
+
describe "initialising" do
|
5
|
+
let(:data) do
|
6
|
+
{
|
7
|
+
|
8
|
+
}
|
9
|
+
end
|
10
|
+
|
11
|
+
it "can be initialized from an uneveloped response" do
|
12
|
+
resource = described_class.new(data)
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "#to_h" do
|
17
|
+
it "returns a hash representing the resource" do
|
18
|
+
expect(described_class.new(data).to_h).to eq(data)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,97 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GoCardless::Resources::Mandate do
|
4
|
+
describe "initialising" do
|
5
|
+
let(:data) do
|
6
|
+
{
|
7
|
+
|
8
|
+
|
9
|
+
"created_at" => "created_at-input",
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
"id" => "id-input",
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
"links" => {
|
18
|
+
|
19
|
+
"creditor" => "creditor-input",
|
20
|
+
|
21
|
+
"customer_bank_account" => "customer_bank_account-input",
|
22
|
+
|
23
|
+
},
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
"metadata" => "metadata-input",
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
"next_possible_charge_date" => "next_possible_charge_date-input",
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
"reference" => "reference-input",
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
"scheme" => "scheme-input",
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
"status" => "status-input",
|
44
|
+
|
45
|
+
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
it "can be initialized from an uneveloped response" do
|
50
|
+
resource = described_class.new(data)
|
51
|
+
|
52
|
+
|
53
|
+
expect(resource.created_at).to eq("created_at-input")
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
expect(resource.id).to eq("id-input")
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
expect(resource.links.creditor).to eq("creditor-input")
|
63
|
+
|
64
|
+
expect(resource.links.customer_bank_account).to eq("customer_bank_account-input")
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
expect(resource.metadata).to eq("metadata-input")
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
expect(resource.next_possible_charge_date).to eq("next_possible_charge_date-input")
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
expect(resource.reference).to eq("reference-input")
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
expect(resource.scheme).to eq("scheme-input")
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
expect(resource.status).to eq("status-input")
|
86
|
+
|
87
|
+
|
88
|
+
end
|
89
|
+
|
90
|
+
describe "#to_h" do
|
91
|
+
it "returns a hash representing the resource" do
|
92
|
+
expect(described_class.new(data).to_h).to eq(data)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|