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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecf319e84ed4dfe44efbdbccfa3b78fd3a2d21fa
|
4
|
+
data.tar.gz: 62778f5f199f97beda830c8135d76c9b3b9db140
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c44529e6d3b9d177f5c4cceded3dfb02dae73ee6c7ef5427e28574e6bb5466b804d01d4b519e60c91a948dc9b4409320701746214a4ae3f8d4e88239757a85a6
|
7
|
+
data.tar.gz: d0539445ad58e6dbb99e1394466261ed8e8d7b415148bf5f55ff48e0cbbe8f440d68aead63008f30bc7f0ba921b8507e447004711476c614f32eec157db7aebc
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,7 +1,17 @@
|
|
1
|
-
# Ruby Client for GoCardless
|
1
|
+
# Ruby Client for the GoCardless API
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
A Ruby client for the GoCardless API. For full details of the GoCardless API, see the [API docs](https://developer.gocardless.com/pro/).
|
4
|
+
|
5
|
+
[](http://badge.fury.io/rb/gocardless_pro)
|
6
|
+
[](https://travis-ci.org/gocardless/gocardless-pro-ruby)
|
7
|
+
|
8
|
+
|
9
|
+
## Usage Examples
|
10
|
+
|
11
|
+
This README will use `customers` throughout but each of the resources in the
|
12
|
+
[API](https://developer.gocardless.com/pro/) is available in this library.
|
13
|
+
|
14
|
+
### Installation
|
5
15
|
|
6
16
|
Add this line to your application's Gemfile:
|
7
17
|
|
@@ -15,16 +25,11 @@ And then load it into your application:
|
|
15
25
|
require 'gocardless_pro'
|
16
26
|
```
|
17
27
|
|
18
|
-
## Usage Examples
|
19
|
-
|
20
|
-
- In the case of a single response, the client will return you an instance of the resource
|
21
|
-
- In the case of list responses, the client will return an instance of `ListResponse`.
|
22
|
-
- You can also call `#all` to get a lazily paginated list of resource that will deal with making extra API requests to paginate through all the data
|
23
|
-
|
24
28
|
### Initialising the client
|
25
29
|
|
26
30
|
The client is initialised with an Access Token.
|
27
|
-
You can also pass in `environment` as `:sandbox` to make requests to the sandbox
|
31
|
+
You can also pass in `environment` as `:sandbox` to make requests to the sandbox
|
32
|
+
environment rather than production.
|
28
33
|
|
29
34
|
```rb
|
30
35
|
@client = GoCardlessPro::Client.new(
|
@@ -34,41 +39,61 @@ You can also pass in `environment` as `:sandbox` to make requests to the sandbox
|
|
34
39
|
|
35
40
|
### GET requests
|
36
41
|
|
37
|
-
You can
|
42
|
+
You can get details about one or many resources in the API by calling the
|
43
|
+
`#get`, `#list` and `#all` methods.
|
44
|
+
|
45
|
+
#### Getting a single resource
|
46
|
+
|
47
|
+
To request a single resource, use the `#get` method:
|
38
48
|
|
39
49
|
```rb
|
40
|
-
@client.customers.
|
50
|
+
@client.customers.get(customer_id)
|
41
51
|
```
|
42
52
|
|
43
|
-
|
53
|
+
A call to `get` returns an instance of the resource:
|
44
54
|
|
45
|
-
|
55
|
+
```rb
|
56
|
+
p @client.customers.get(customer_id).given_name
|
57
|
+
```
|
58
|
+
|
59
|
+
#### Getting a list of resources
|
60
|
+
|
61
|
+
To get a list of resources, use the `#list` method:
|
46
62
|
|
47
63
|
```rb
|
48
|
-
@client.customers.list
|
64
|
+
@client.customers.list
|
49
65
|
```
|
50
66
|
|
51
67
|
A call to `list` returns an instance of `GoCardlessPro::ListResponse`. You can call `records` on this to iterate through results:
|
52
68
|
|
53
69
|
```rb
|
54
|
-
@client.customers.list.records do |customer|
|
70
|
+
@client.customers.list.records.each do |customer|
|
55
71
|
p customer.given_name
|
56
72
|
end
|
57
73
|
```
|
58
74
|
|
59
|
-
|
75
|
+
If you need to pass any options, the last (or in the absence of URL params, the only) argument is an options hash. This is used to pass query parameters for `GET` requests:
|
60
76
|
|
61
77
|
```rb
|
62
|
-
@client.customers.
|
78
|
+
@client.customers.list(params: { limit: 400 })
|
63
79
|
```
|
64
80
|
|
65
|
-
|
81
|
+
#### Getting all resources
|
82
|
+
|
83
|
+
If you want to get all of the records for a given resource type, you can use the
|
84
|
+
`#all` method to get a lazily paginated list. `#all` will deal with making extra
|
85
|
+
API requests to paginate through all the data for you:
|
66
86
|
|
67
87
|
```rb
|
68
|
-
@client.customers.
|
88
|
+
@client.customers.all.each do |customer|
|
89
|
+
p customer.given_name
|
90
|
+
end
|
69
91
|
```
|
70
92
|
|
71
|
-
|
93
|
+
#### Raw response details
|
94
|
+
|
95
|
+
In addition to providing details of the requested resource(s), all GET requests
|
96
|
+
give you access the following properties of the response:
|
72
97
|
|
73
98
|
- `status`
|
74
99
|
- `headers`
|
@@ -88,15 +113,34 @@ For POST and PUT requests you need to pass in the body in under the `params` key
|
|
88
113
|
)
|
89
114
|
```
|
90
115
|
|
91
|
-
|
116
|
+
If any parameters are required they come first:
|
92
117
|
|
93
118
|
```rb
|
94
119
|
@client.customers.update(customer_id, {...})
|
95
120
|
```
|
96
121
|
|
122
|
+
### Custom headers
|
123
|
+
|
124
|
+
Custom headers can be provided for a POST request under the `headers` key.
|
125
|
+
|
126
|
+
The most common use of a custom header would be to set an [idempotency key](https://developer.gocardless.com/pro/#making-requests-idempotency-keys) when making a request:
|
127
|
+
|
128
|
+
```rb
|
129
|
+
@client.customers.create(
|
130
|
+
params: {
|
131
|
+
first_name: "Pete",
|
132
|
+
last_name: "Hamilton",
|
133
|
+
...
|
134
|
+
},
|
135
|
+
headers: {
|
136
|
+
"Idempotency-Key": "1f9630a9-0487-418d-bd37-8b77793c9985"
|
137
|
+
}
|
138
|
+
)
|
139
|
+
```
|
140
|
+
|
97
141
|
### Handling failures
|
98
142
|
|
99
|
-
When
|
143
|
+
When the API returns an error, the client will raise a corresponding one. There are four classes of error which could be thrown, allof which subclass `GoCardlessPro::Error`:
|
100
144
|
|
101
145
|
- `GoCardlessPro::GoCardlessError`
|
102
146
|
- `GoCardlessPro::InvalidApiUsageError`
|
@@ -105,7 +149,7 @@ When an API returns an error, the client __will raise__ an error that correspond
|
|
105
149
|
|
106
150
|
These errors are fully documented in the [API documentation](https://developer.gocardless.com/pro/#overview-errors).
|
107
151
|
|
108
|
-
|
152
|
+
All errors have the following methods to facilitate access to information in the API response:
|
109
153
|
|
110
154
|
- `#documentation_url`
|
111
155
|
- `#message`
|
@@ -123,12 +167,11 @@ OAuth simply provides a means by which you obtain an access token - once you hav
|
|
123
167
|
We recommend using the [oauth2](https://github.com/intridea/oauth2) gem to handle the authorisation process and gain a token. For an example of this in action, see our [open-source OAuth demo app](https://github.com/gocardless/oauth-demo/blob/master/app.rb#L46).
|
124
168
|
|
125
169
|
## Supporting Ruby < 2.0.0
|
126
|
-
|
127
170
|
The client only supports Ruby >= 2.0.0 out of the box due to our use of
|
128
171
|
Enumerable::Lazy for lazy loading of paginated API resources.
|
129
172
|
|
130
|
-
|
131
|
-
[backports](https://github.com/marcandre/backports)
|
173
|
+
If you wish to use this gem with a previous ruby version, you should be able to
|
174
|
+
do so with the [backports](https://github.com/marcandre/backports) gem:
|
132
175
|
|
133
176
|
1. Add backports to your Gemfile
|
134
177
|
```gem 'backports'```
|
@@ -137,4 +180,4 @@ However, support for previous ruby versions can be added using a gem such as
|
|
137
180
|
|
138
181
|
## Contributing
|
139
182
|
|
140
|
-
This client is auto-generated from Crank, a toolchain that we hope to
|
183
|
+
This client is auto-generated from Crank, a toolchain that we hope to open source soon. For now, issues should be reported on this repository. __Please do not modify the source code yourself, your changes will be overriden!__
|
data/gocardless_pro.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
|
20
20
|
spec.add_development_dependency 'rspec', '~> 3.1'
|
21
21
|
spec.add_development_dependency 'webmock', '~> 1.18'
|
22
|
-
spec.add_development_dependency 'rubocop', '~> 0.
|
22
|
+
spec.add_development_dependency 'rubocop', '~> 0.35.1'
|
23
23
|
spec.add_development_dependency 'yard', '~> 0.8.7.6'
|
24
24
|
|
25
25
|
spec.add_dependency 'faraday', ['>= 0.8.9', '< 0.10']
|
@@ -8,7 +8,7 @@ require 'uri'
|
|
8
8
|
require 'base64'
|
9
9
|
|
10
10
|
module GoCardlessPro
|
11
|
-
# GoCardless
|
11
|
+
# GoCardless API
|
12
12
|
class ApiService
|
13
13
|
# Initialize an APIService
|
14
14
|
#
|
@@ -20,7 +20,9 @@ module GoCardlessPro
|
|
20
20
|
@url = url
|
21
21
|
root_url, @path_prefix = unpack_url(url)
|
22
22
|
http_adapter = options[:http_adapter] || [:net_http]
|
23
|
-
|
23
|
+
connection_options = options[:connection_options]
|
24
|
+
|
25
|
+
@connection = Faraday.new(root_url, connection_options) do |faraday|
|
24
26
|
faraday.adapter(*http_adapter)
|
25
27
|
end
|
26
28
|
|
@@ -74,6 +74,7 @@ module GoCardlessPro
|
|
74
74
|
# @option options [Symbol] :environment the environment to connect to - one of `:live` or `:sandbox`.
|
75
75
|
# @option options [Symbol] :access_token the API token
|
76
76
|
# @option options [Symbol] :url the full URL used to make requests to. If you specify this, it will be used over the `environment` option.
|
77
|
+
# @option options [Symbol] :connection_options `Faraday` connection options hash, e.g. `{ request: { timeout: 3 } }`.
|
77
78
|
# @return [Client] A client configured to use the API with HTTP Basic
|
78
79
|
# authentication.
|
79
80
|
#
|
@@ -125,7 +126,7 @@ module GoCardlessPro
|
|
125
126
|
begin
|
126
127
|
gem_name = 'gocardless_pro'
|
127
128
|
gem_info = "#{gem_name}"
|
128
|
-
gem_info += "/v#{
|
129
|
+
gem_info += "/v#{GoCardlessPro::VERSION}" if defined?(GoCardlessPro::VERSION)
|
129
130
|
|
130
131
|
ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
|
131
132
|
|
data/lib/gocardless_pro/error.rb
CHANGED
@@ -6,6 +6,7 @@ module GoCardlessPro
|
|
6
6
|
# intialize a new error
|
7
7
|
# @param error the error from the API
|
8
8
|
def initialize(error)
|
9
|
+
fail ArgumentError, 'GoCardless errors expect a hash' unless error.is_a?(Hash)
|
9
10
|
@error = error
|
10
11
|
end
|
11
12
|
|
@@ -19,6 +20,16 @@ module GoCardlessPro
|
|
19
20
|
@error['message']
|
20
21
|
end
|
21
22
|
|
23
|
+
def to_s
|
24
|
+
if errors.any?
|
25
|
+
errors
|
26
|
+
.map { |err| "#{err['field']} #{err['message']}" }
|
27
|
+
.join(', ')
|
28
|
+
else
|
29
|
+
@error['message']
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
22
33
|
# access the type from the response
|
23
34
|
def type
|
24
35
|
@error['type']
|
@@ -36,7 +47,7 @@ module GoCardlessPro
|
|
36
47
|
|
37
48
|
# access the errors from the response
|
38
49
|
def errors
|
39
|
-
@error
|
50
|
+
@error.fetch('errors', [])
|
40
51
|
end
|
41
52
|
end
|
42
53
|
end
|
@@ -26,6 +26,8 @@ module GoCardlessPro
|
|
26
26
|
|
27
27
|
attr_reader :next_possible_charge_date
|
28
28
|
|
29
|
+
attr_reader :payments_require_approval
|
30
|
+
|
29
31
|
attr_reader :reference
|
30
32
|
|
31
33
|
attr_reader :scheme
|
@@ -41,6 +43,7 @@ module GoCardlessPro
|
|
41
43
|
@links = object['links']
|
42
44
|
@metadata = object['metadata']
|
43
45
|
@next_possible_charge_date = object['next_possible_charge_date']
|
46
|
+
@payments_require_approval = object['payments_require_approval']
|
44
47
|
@reference = object['reference']
|
45
48
|
@scheme = object['scheme']
|
46
49
|
@status = object['status']
|
@@ -20,6 +20,8 @@ module GoCardlessPro
|
|
20
20
|
class Payout
|
21
21
|
attr_reader :amount
|
22
22
|
|
23
|
+
attr_reader :arrival_date
|
24
|
+
|
23
25
|
attr_reader :created_at
|
24
26
|
|
25
27
|
attr_reader :currency
|
@@ -35,6 +37,7 @@ module GoCardlessPro
|
|
35
37
|
@object = object
|
36
38
|
|
37
39
|
@amount = object['amount']
|
40
|
+
@arrival_date = object['arrival_date']
|
38
41
|
@created_at = object['created_at']
|
39
42
|
@currency = object['currency']
|
40
43
|
@id = object['id']
|
@@ -11,27 +11,28 @@ require 'uri'
|
|
11
11
|
module GoCardlessPro
|
12
12
|
# A module containing classes for each of the resources in the GC Api
|
13
13
|
module Resources
|
14
|
-
# Redirect flows enable you to use GoCardless
|
14
|
+
# Redirect flows enable you to use GoCardless' [hosted payment
|
15
15
|
# pages](https://pay-sandbox.gocardless.com/AL000000AKFPFF) to set up mandates
|
16
16
|
# with your customers. These pages are fully compliant and have been
|
17
|
-
# translated into Dutch, French, German, Italian, Portuguese and
|
18
|
-
#
|
17
|
+
# translated into Dutch, French, German, Italian, Portuguese, Spanish and
|
18
|
+
# Swedish.
|
19
19
|
#
|
20
20
|
# The overall flow is:
|
21
21
|
#
|
22
|
-
# 1. You
|
23
|
-
# a redirect flow for your customer, and
|
24
|
-
# redirect url, e.g.
|
22
|
+
# 1. You
|
23
|
+
# [create](#create-a-redirect-flow) a redirect flow for your customer, and
|
24
|
+
# redirect them to the returned redirect url, e.g.
|
25
|
+
# `https://pay.gocardless.com/flow/RE123`.
|
26
|
+
#
|
27
|
+
# 2. Your customer supplies
|
28
|
+
# their name, email, address, and bank account details, and submits the form.
|
29
|
+
# This securely stores their details, and redirects them back to your
|
30
|
+
# `success_redirect_url` with `redirect_flow_id=RE123` in the querystring.
|
25
31
|
#
|
26
|
-
# 2. Your
|
27
|
-
# customer supplies their name, email, address, and bank account details, and
|
28
|
-
# submits the form. This securely stores their details, and redirects them
|
29
|
-
# back to your `success_redirect_url` with `redirect_flow_id=RE123` in the
|
30
|
-
# querystring.
|
31
32
|
#
|
32
|
-
# 3. You [complete](#complete-a-redirect-flow) the
|
33
|
-
#
|
34
|
-
#
|
33
|
+
# 3. You [complete](#complete-a-redirect-flow) the redirect flow, which
|
34
|
+
# creates a [customer](#core-endpoints-customers), [customer bank
|
35
|
+
# account](#core-endpoints-customer-bank-accounts), and
|
35
36
|
# [mandate](#core-endpoints-mandates), and returns the ID of the mandate. You
|
36
37
|
# may wish to create a [subscription](#core-endpoints-subscriptions) or
|
37
38
|
# [payment](#core-endpoints-payments) at this point.
|
@@ -12,8 +12,17 @@ module GoCardlessPro
|
|
12
12
|
class BankDetailsLookupsService < BaseService
|
13
13
|
# Performs a bank details lookup.
|
14
14
|
#
|
15
|
+
# As part of the lookup a modulus check and
|
16
|
+
# reachability check are performed.
|
17
|
+
#
|
15
18
|
# Bank account details may be supplied
|
16
19
|
# using [local details](#appendix-local-bank-details) or an IBAN.
|
20
|
+
#
|
21
|
+
# _Note:_
|
22
|
+
# Usage of this endpoint is monitored. If your organisation relies on GoCardless
|
23
|
+
# for
|
24
|
+
# modulus or reachability checking but not for payment collection, please
|
25
|
+
# get in touch.
|
17
26
|
# Example URL: /bank_details_lookups
|
18
27
|
# @param options [Hash] parameters as a hash, under a params key.
|
19
28
|
def create(options = {})
|
@@ -25,6 +34,7 @@ module GoCardlessPro
|
|
25
34
|
response = make_request(:post, path, options)
|
26
35
|
|
27
36
|
return if response.body.nil?
|
37
|
+
|
28
38
|
Resources::BankDetailsLookup.new(unenvelope_body(response.body), response)
|
29
39
|
end
|
30
40
|
|
@@ -22,6 +22,7 @@ module GoCardlessPro
|
|
22
22
|
response = make_request(:post, path, options)
|
23
23
|
|
24
24
|
return if response.body.nil?
|
25
|
+
|
25
26
|
Resources::CreditorBankAccount.new(unenvelope_body(response.body), response)
|
26
27
|
end
|
27
28
|
|
@@ -59,11 +60,12 @@ module GoCardlessPro
|
|
59
60
|
# @param identity # Unique identifier, beginning with "BA".
|
60
61
|
# @param options [Hash] parameters as a hash, under a params key.
|
61
62
|
def get(identity, options = {})
|
62
|
-
path = sub_url('/creditor_bank_accounts/:identity',
|
63
|
+
path = sub_url('/creditor_bank_accounts/:identity', 'identity' => identity)
|
63
64
|
|
64
65
|
response = make_request(:get, path, options)
|
65
66
|
|
66
67
|
return if response.body.nil?
|
68
|
+
|
67
69
|
Resources::CreditorBankAccount.new(unenvelope_body(response.body), response)
|
68
70
|
end
|
69
71
|
|
@@ -80,7 +82,7 @@ module GoCardlessPro
|
|
80
82
|
# @param identity # Unique identifier, beginning with "BA".
|
81
83
|
# @param options [Hash] parameters as a hash, under a params key.
|
82
84
|
def disable(identity, options = {})
|
83
|
-
path = sub_url('/creditor_bank_accounts/:identity/actions/disable',
|
85
|
+
path = sub_url('/creditor_bank_accounts/:identity/actions/disable', 'identity' => identity)
|
84
86
|
|
85
87
|
params = options.delete(:params) || {}
|
86
88
|
options[:params] = {}
|
@@ -88,6 +90,7 @@ module GoCardlessPro
|
|
88
90
|
response = make_request(:post, path, options)
|
89
91
|
|
90
92
|
return if response.body.nil?
|
93
|
+
|
91
94
|
Resources::CreditorBankAccount.new(unenvelope_body(response.body), response)
|
92
95
|
end
|
93
96
|
|
@@ -22,6 +22,7 @@ module GoCardlessPro
|
|
22
22
|
response = make_request(:post, path, options)
|
23
23
|
|
24
24
|
return if response.body.nil?
|
25
|
+
|
25
26
|
Resources::Creditor.new(unenvelope_body(response.body), response)
|
26
27
|
end
|
27
28
|
|
@@ -59,11 +60,12 @@ module GoCardlessPro
|
|
59
60
|
# @param identity # Unique identifier, beginning with "CR".
|
60
61
|
# @param options [Hash] parameters as a hash, under a params key.
|
61
62
|
def get(identity, options = {})
|
62
|
-
path = sub_url('/creditors/:identity',
|
63
|
+
path = sub_url('/creditors/:identity', 'identity' => identity)
|
63
64
|
|
64
65
|
response = make_request(:get, path, options)
|
65
66
|
|
66
67
|
return if response.body.nil?
|
68
|
+
|
67
69
|
Resources::Creditor.new(unenvelope_body(response.body), response)
|
68
70
|
end
|
69
71
|
|
@@ -74,7 +76,7 @@ module GoCardlessPro
|
|
74
76
|
# @param identity # Unique identifier, beginning with "CR".
|
75
77
|
# @param options [Hash] parameters as a hash, under a params key.
|
76
78
|
def update(identity, options = {})
|
77
|
-
path = sub_url('/creditors/:identity',
|
79
|
+
path = sub_url('/creditors/:identity', 'identity' => identity)
|
78
80
|
|
79
81
|
params = options.delete(:params) || {}
|
80
82
|
options[:params] = {}
|
@@ -82,6 +84,7 @@ module GoCardlessPro
|
|
82
84
|
response = make_request(:put, path, options)
|
83
85
|
|
84
86
|
return if response.body.nil?
|
87
|
+
|
85
88
|
Resources::Creditor.new(unenvelope_body(response.body), response)
|
86
89
|
end
|
87
90
|
|