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,129 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GoCardless::Resources::Payment do
|
4
|
+
describe "initialising" do
|
5
|
+
let(:data) do
|
6
|
+
{
|
7
|
+
|
8
|
+
|
9
|
+
"amount" => "amount-input",
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
"amount_refunded" => "amount_refunded-input",
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
"charge_date" => "charge_date-input",
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
"created_at" => "created_at-input",
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
"currency" => "currency-input",
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
"description" => "description-input",
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
"id" => "id-input",
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
"links" => {
|
38
|
+
|
39
|
+
"creditor" => "creditor-input",
|
40
|
+
|
41
|
+
"mandate" => "mandate-input",
|
42
|
+
|
43
|
+
"payout" => "payout-input",
|
44
|
+
|
45
|
+
"subscription" => "subscription-input",
|
46
|
+
|
47
|
+
},
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
"metadata" => "metadata-input",
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
"reference" => "reference-input",
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
"status" => "status-input",
|
60
|
+
|
61
|
+
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
it "can be initialized from an uneveloped response" do
|
66
|
+
resource = described_class.new(data)
|
67
|
+
|
68
|
+
|
69
|
+
expect(resource.amount).to eq("amount-input")
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
expect(resource.amount_refunded).to eq("amount_refunded-input")
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
expect(resource.charge_date).to eq("charge_date-input")
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
expect(resource.created_at).to eq("created_at-input")
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
expect(resource.currency).to eq("currency-input")
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
expect(resource.description).to eq("description-input")
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
expect(resource.id).to eq("id-input")
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
expect(resource.links.creditor).to eq("creditor-input")
|
99
|
+
|
100
|
+
expect(resource.links.mandate).to eq("mandate-input")
|
101
|
+
|
102
|
+
expect(resource.links.payout).to eq("payout-input")
|
103
|
+
|
104
|
+
expect(resource.links.subscription).to eq("subscription-input")
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
expect(resource.metadata).to eq("metadata-input")
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
expect(resource.reference).to eq("reference-input")
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
expect(resource.status).to eq("status-input")
|
118
|
+
|
119
|
+
|
120
|
+
end
|
121
|
+
|
122
|
+
describe "#to_h" do
|
123
|
+
it "returns a hash representing the resource" do
|
124
|
+
expect(described_class.new(data).to_h).to eq(data)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GoCardless::Resources::Payout do
|
4
|
+
describe "initialising" do
|
5
|
+
let(:data) do
|
6
|
+
{
|
7
|
+
|
8
|
+
|
9
|
+
"amount" => "amount-input",
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
"created_at" => "created_at-input",
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
"currency" => "currency-input",
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
"id" => "id-input",
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
"links" => {
|
26
|
+
|
27
|
+
"creditor" => "creditor-input",
|
28
|
+
|
29
|
+
"creditor_bank_account" => "creditor_bank_account-input",
|
30
|
+
|
31
|
+
},
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
"reference" => "reference-input",
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
"status" => "status-input",
|
40
|
+
|
41
|
+
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
it "can be initialized from an uneveloped response" do
|
46
|
+
resource = described_class.new(data)
|
47
|
+
|
48
|
+
|
49
|
+
expect(resource.amount).to eq("amount-input")
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
expect(resource.created_at).to eq("created_at-input")
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
expect(resource.currency).to eq("currency-input")
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
expect(resource.id).to eq("id-input")
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
expect(resource.links.creditor).to eq("creditor-input")
|
67
|
+
|
68
|
+
expect(resource.links.creditor_bank_account).to eq("creditor_bank_account-input")
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
expect(resource.reference).to eq("reference-input")
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
expect(resource.status).to eq("status-input")
|
78
|
+
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
describe "#to_h" do
|
83
|
+
it "returns a hash representing the resource" do
|
84
|
+
expect(described_class.new(data).to_h).to eq(data)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GoCardless::Resources::PublishableApiKey do
|
4
|
+
describe "initialising" do
|
5
|
+
let(:data) do
|
6
|
+
{
|
7
|
+
|
8
|
+
|
9
|
+
"created_at" => "created_at-input",
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
"enabled" => "enabled-input",
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
"id" => "id-input",
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
"key" => "key-input",
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
"name" => "name-input",
|
26
|
+
|
27
|
+
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
it "can be initialized from an uneveloped response" do
|
32
|
+
resource = described_class.new(data)
|
33
|
+
|
34
|
+
|
35
|
+
expect(resource.created_at).to eq("created_at-input")
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
expect(resource.enabled).to eq("enabled-input")
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
expect(resource.id).to eq("id-input")
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
expect(resource.key).to eq("key-input")
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
expect(resource.name).to eq("name-input")
|
52
|
+
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
describe "#to_h" do
|
57
|
+
it "returns a hash representing the resource" do
|
58
|
+
expect(described_class.new(data).to_h).to eq(data)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
@@ -0,0 +1,97 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GoCardless::Resources::RedirectFlow do
|
4
|
+
describe "initialising" do
|
5
|
+
let(:data) do
|
6
|
+
{
|
7
|
+
|
8
|
+
|
9
|
+
"created_at" => "created_at-input",
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
"description" => "description-input",
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
"id" => "id-input",
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
"links" => {
|
22
|
+
|
23
|
+
"creditor" => "creditor-input",
|
24
|
+
|
25
|
+
"mandate" => "mandate-input",
|
26
|
+
|
27
|
+
},
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
"redirect_url" => "redirect_url-input",
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
"scheme" => "scheme-input",
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
"session_token" => "session_token-input",
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
"success_redirect_url" => "success_redirect_url-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.description).to eq("description-input")
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
expect(resource.id).to eq("id-input")
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
expect(resource.links.creditor).to eq("creditor-input")
|
67
|
+
|
68
|
+
expect(resource.links.mandate).to eq("mandate-input")
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
expect(resource.redirect_url).to eq("redirect_url-input")
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
expect(resource.scheme).to eq("scheme-input")
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
expect(resource.session_token).to eq("session_token-input")
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
expect(resource.success_redirect_url).to eq("success_redirect_url-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
|
+
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GoCardless::Resources::Refund do
|
4
|
+
describe "initialising" do
|
5
|
+
let(:data) do
|
6
|
+
{
|
7
|
+
|
8
|
+
|
9
|
+
"amount" => "amount-input",
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
"created_at" => "created_at-input",
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
"currency" => "currency-input",
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
"id" => "id-input",
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
"links" => {
|
26
|
+
|
27
|
+
"payment" => "payment-input",
|
28
|
+
|
29
|
+
},
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
"metadata" => "metadata-input",
|
34
|
+
|
35
|
+
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
it "can be initialized from an uneveloped response" do
|
40
|
+
resource = described_class.new(data)
|
41
|
+
|
42
|
+
|
43
|
+
expect(resource.amount).to eq("amount-input")
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
expect(resource.created_at).to eq("created_at-input")
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
expect(resource.currency).to eq("currency-input")
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
expect(resource.id).to eq("id-input")
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
expect(resource.links.payment).to eq("payment-input")
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
expect(resource.metadata).to eq("metadata-input")
|
66
|
+
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
describe "#to_h" do
|
71
|
+
it "returns a hash representing the resource" do
|
72
|
+
expect(described_class.new(data).to_h).to eq(data)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|