gocardless_pro 0.3.0
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 +7 -0
- data/.rspec +2 -0
- data/Gemfile +2 -0
- data/LICENSE.txt +22 -0
- data/README.md +146 -0
- data/circle.yml +3 -0
- data/demo.rb +9 -0
- data/gocardless_pro.gemspec +26 -0
- data/lib/gocardless_pro.rb +73 -0
- data/lib/gocardless_pro/api_service.rb +58 -0
- data/lib/gocardless_pro/client.rb +135 -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 +29 -0
- data/lib/gocardless_pro/paginator.rb +43 -0
- data/lib/gocardless_pro/request.rb +69 -0
- data/lib/gocardless_pro/resources/creditor.rb +84 -0
- data/lib/gocardless_pro/resources/creditor_bank_account.rb +78 -0
- data/lib/gocardless_pro/resources/customer.rb +75 -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 +87 -0
- data/lib/gocardless_pro/resources/payout.rb +66 -0
- data/lib/gocardless_pro/resources/redirect_flow.rb +106 -0
- data/lib/gocardless_pro/resources/refund.rb +71 -0
- data/lib/gocardless_pro/resources/subscription.rb +155 -0
- data/lib/gocardless_pro/response.rb +77 -0
- data/lib/gocardless_pro/services/base_service.rb +28 -0
- data/lib/gocardless_pro/services/creditor_bank_accounts_service.rb +119 -0
- data/lib/gocardless_pro/services/creditors_service.rb +113 -0
- data/lib/gocardless_pro/services/customer_bank_accounts_service.rb +154 -0
- data/lib/gocardless_pro/services/customers_service.rb +113 -0
- data/lib/gocardless_pro/services/events_service.rb +80 -0
- data/lib/gocardless_pro/services/helpers_service.rb +99 -0
- data/lib/gocardless_pro/services/mandates_service.rb +173 -0
- data/lib/gocardless_pro/services/payments_service.rb +168 -0
- data/lib/gocardless_pro/services/payouts_service.rb +82 -0
- data/lib/gocardless_pro/services/redirect_flows_service.rb +98 -0
- data/lib/gocardless_pro/services/refunds_service.rb +132 -0
- data/lib/gocardless_pro/services/subscriptions_service.rb +134 -0
- data/lib/gocardless_pro/version.rb +8 -0
- data/spec/api_service_spec.rb +73 -0
- data/spec/client_spec.rb +19 -0
- data/spec/error_spec.rb +44 -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 +135 -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/redirect_flow_spec.rb +97 -0
- data/spec/resources/refund_spec.rb +77 -0
- data/spec/resources/subscription_spec.rb +165 -0
- data/spec/response_spec.rb +89 -0
- data/spec/services/creditor_bank_accounts_service_spec.rb +413 -0
- data/spec/services/creditors_service_spec.rb +388 -0
- data/spec/services/customer_bank_accounts_service_spec.rb +452 -0
- data/spec/services/customers_service_spec.rb +429 -0
- data/spec/services/events_service_spec.rb +217 -0
- data/spec/services/helpers_service_spec.rb +122 -0
- data/spec/services/mandates_service_spec.rb +495 -0
- data/spec/services/payments_service_spec.rb +546 -0
- data/spec/services/payouts_service_spec.rb +217 -0
- data/spec/services/redirect_flows_service_spec.rb +254 -0
- data/spec/services/refunds_service_spec.rb +323 -0
- data/spec/services/subscriptions_service_spec.rb +557 -0
- data/spec/spec_helper.rb +91 -0
- metadata +224 -0
@@ -0,0 +1,113 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GoCardlessPro::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 GoCardlessPro::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 GoCardlessPro::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
|
+
|
@@ -0,0 +1,129 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GoCardlessPro::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 GoCardlessPro::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
|
+
|