jortt 3.0.0 → 6.0.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 +5 -5
- data/.github/workflows/rspec.yml +40 -0
- data/.ruby-version +1 -1
- data/README.md +81 -46
- data/Rakefile +0 -1
- data/jortt.gemspec +10 -10
- data/lib/jortt.rb +0 -1
- data/lib/jortt/client.rb +75 -23
- data/lib/jortt/client/customers.rb +91 -0
- data/lib/jortt/client/error.rb +33 -0
- data/lib/jortt/client/invoices.rb +80 -0
- data/lib/jortt/client/ledger_accounts.rb +27 -0
- data/lib/jortt/client/version.rb +1 -2
- data/spec/fixtures/vcr_cassettes/Jortt/_client/1_1_1.yml +64 -0
- data/spec/fixtures/vcr_cassettes/Jortt_Client/configured/_customers/1_1_1_1.yml +64 -0
- data/spec/fixtures/vcr_cassettes/Jortt_Client/configured/_invoices/1_1_2_1.yml +64 -0
- data/spec/fixtures/vcr_cassettes/Jortt_Client/configured/_ledger_accounts/1_1_3_1.yml +64 -0
- data/spec/fixtures/vcr_cassettes/Jortt_Client_Customers/_create/faulty_payload/shows_a_nice_error.yml +413 -0
- data/spec/fixtures/vcr_cassettes/Jortt_Client_Customers/_create/valid_payload/creates_the_customer.yml +505 -0
- data/spec/fixtures/vcr_cassettes/Jortt_Client_Customers/_delete/deletes_the_customer.yml +505 -0
- data/spec/fixtures/vcr_cassettes/Jortt_Client_Customers/_direct_debit_mandate/sends_direct_debit_mandate_to_the_customer_or_responds_with_an_error_when_not_possible.yml +470 -0
- data/spec/fixtures/vcr_cassettes/Jortt_Client_Customers/_index/query/returns_the_queried_customers.yml +464 -0
- data/spec/fixtures/vcr_cassettes/Jortt_Client_Customers/_index/without_params/returns_customers.yml +415 -0
- data/spec/fixtures/vcr_cassettes/Jortt_Client_Customers/_show/returns_the_customer.yml +464 -0
- data/spec/fixtures/vcr_cassettes/Jortt_Client_Customers/_update/updates_the_customer.yml +603 -0
- data/spec/fixtures/vcr_cassettes/Jortt_Client_Invoices/_create/creates_the_invoice.yml +170 -0
- data/spec/fixtures/vcr_cassettes/Jortt_Client_Invoices/_credit/credits_the_invoice.yml +374 -0
- data/spec/fixtures/vcr_cassettes/Jortt_Client_Invoices/_download/returns_the_invoice_download_link.yml +168 -0
- data/spec/fixtures/vcr_cassettes/Jortt_Client_Invoices/_index/invoice_status/returns_those_invoices.yml +776 -0
- data/spec/fixtures/vcr_cassettes/Jortt_Client_Invoices/_index/query/returns_the_queried_invoices.yml +315 -0
- data/spec/fixtures/vcr_cassettes/Jortt_Client_Invoices/_show/returns_the_invoice.yml +421 -0
- data/spec/fixtures/vcr_cassettes/Jortt_Client_LedgerAccounts/_index/returns_invoices.yml +118 -0
- data/spec/jortt/client/customers_spec.rb +104 -0
- data/spec/jortt/client/invoices_spec.rb +129 -0
- data/spec/jortt/client/ledger_accounts_spec.rb +19 -0
- data/spec/jortt/client_spec.rb +9 -30
- data/spec/{freemle_spec.rb → jortt_spec.rb} +2 -3
- data/spec/spec_helper.rb +18 -4
- metadata +95 -46
- data/.rubocop.yml +0 -26
- data/.travis.yml +0 -7
- data/lib/jortt/client/resource.rb +0 -140
- data/spec/jortt/client/resource_spec.rb +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 513ee8d9eecbb8920fc1024eb60212600d50b1dd7bc0e13a7be95a7c9df1a6c9
|
4
|
+
data.tar.gz: 20a09a4838015eaba9bd913067cd036eb64d0d15552f1c03888cffbbbd6ff0ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1b18f11a38b33492c1e57f724d2203583a8e8fbfa7950d9d56bbd18d378aa62ff88658865eb41196cb5fb15f9b5451b3db26158a52c546f6324efec6cd80265
|
7
|
+
data.tar.gz: 1f6adbbbb1e36f567115c6f71b0e6c10bc2b8027703de48d840b6652022d6e621911b706f2089abe04ed421e8d84203565747a404adc56317867fac0637590b9
|
@@ -0,0 +1,40 @@
|
|
1
|
+
name: rspec
|
2
|
+
|
3
|
+
on:
|
4
|
+
[push]
|
5
|
+
|
6
|
+
env:
|
7
|
+
RACK_ENV: test
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
build:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
include:
|
15
|
+
- ruby-version: 3.0.0
|
16
|
+
- ruby-version: 2.7
|
17
|
+
|
18
|
+
steps:
|
19
|
+
- name: Checkout code
|
20
|
+
uses: actions/checkout@v2
|
21
|
+
- name: Set up Ruby
|
22
|
+
uses: actions/setup-ruby@v1
|
23
|
+
with:
|
24
|
+
ruby-version: ${{ matrix.ruby-version }}
|
25
|
+
- name: Cache bundler
|
26
|
+
uses: actions/cache@v2
|
27
|
+
with:
|
28
|
+
path: vendor/bundle
|
29
|
+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
30
|
+
restore-keys: |
|
31
|
+
${{ runner.os }}-gems-
|
32
|
+
- name: Install bundler
|
33
|
+
run: |
|
34
|
+
gem install bundler
|
35
|
+
- name: Install ruby dependencies
|
36
|
+
run: |
|
37
|
+
bundle config path vendor/bundle
|
38
|
+
bundle install --jobs 4
|
39
|
+
- name: Run tests
|
40
|
+
run: bundle exec rspec
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.0.0
|
data/README.md
CHANGED
@@ -1,84 +1,117 @@
|
|
1
1
|
# Jortt REST API client
|
2
2
|
|
3
|
-
[
|
6
|
-
[](https://codeclimate.com/github/jorttbv/jortt-ruby)
|
3
|
+
[](https://codeclimate.com/github/codeclimate/codeclimate/maintainability)
|
9
4
|
[](https://codecov.io/github/jorttbv/jortt-ruby?branch=master)
|
12
|
-
[
|
7
|
+
[](https://github.com/jorttbv/jortt-ruby/actions)
|
15
8
|
|
16
9
|
A Ruby interface to the [Jortt](https://www.jortt.nl/) REST API.
|
17
10
|
|
18
|
-
|
11
|
+
Check https://developer.jortt.nl/ for more info.
|
12
|
+
|
13
|
+
> THIS VERSION IS FOR THE NEW OAUTH API. STILL ON THE LEGACY API? USE VERSION 4.x OF THIS GEM: [CLICK HERE](https://github.com/jorttbv/jortt-ruby/tree/v4.2.0)
|
14
|
+
|
15
|
+
> THIS VERSION ONLY WORKS FOR CLIENT CREDENTIALS CURRENTLY.
|
16
|
+
|
17
|
+
## Usage examples
|
19
18
|
|
20
19
|
To create a jortt client:
|
21
20
|
```ruby
|
22
|
-
jortt = Jortt.client(
|
23
|
-
app_name: "application-name-as-chosen-on-jortt.nl",
|
24
|
-
api_key: "api-key-as-provided-by-jortt.nl"
|
25
|
-
)
|
21
|
+
jortt = Jortt.client('<your-client-id>', '<your-client-secret>')
|
26
22
|
```
|
27
23
|
|
28
24
|
### Customers
|
29
25
|
|
30
|
-
|
26
|
+
All customers (`jortt.customers.index(page: 2)`) returns:
|
31
27
|
```ruby
|
32
28
|
[{
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
country_code: "NL"
|
39
|
-
}
|
40
|
-
},
|
41
|
-
company_name: 'ttroj',
|
42
|
-
address: {
|
43
|
-
street: "Jorttweg",
|
44
|
-
...
|
45
|
-
}
|
29
|
+
"id": "f8fd3e4e-da1c-43a7-892f-1410ac13e38a",
|
30
|
+
"is_private": true,
|
31
|
+
"customer_name": "Jortt",
|
32
|
+
"address_street": "Rozengracht 75a",
|
33
|
+
...
|
46
34
|
}]
|
47
35
|
```
|
48
36
|
|
49
37
|
Adding customers:
|
50
38
|
```ruby
|
51
39
|
jortt.customers.create(
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
address: {
|
56
|
-
street: "Transistorstraat 71C",
|
57
|
-
postal_code: "1322 CK",
|
58
|
-
city: "Almere",
|
59
|
-
country_code: "NL"
|
60
|
-
}
|
40
|
+
"is_private": true,
|
41
|
+
"customer_name": "Jortt",
|
42
|
+
...
|
61
43
|
)
|
62
44
|
```
|
63
45
|
|
64
46
|
### Invoices
|
47
|
+
Get invoices by ID (`jortt.invoices.get('934d59dd-76f6-4716-9e0f-82a618e1be21')`) returns:
|
48
|
+
```ruby
|
49
|
+
{
|
50
|
+
"invoice_id": "934d59dd-76f6-4716-9e0f-82a618e1be21",
|
51
|
+
"recipient": {
|
52
|
+
"company_name": "Zilverline B.V.",
|
53
|
+
"attn": null,
|
54
|
+
"address": {
|
55
|
+
"street": "Cruquisweg 109F",
|
56
|
+
"city": "Amsterdam",
|
57
|
+
"postal_code": "1111SX",
|
58
|
+
"country": {
|
59
|
+
"code": "NL",
|
60
|
+
"name": "Nederland"
|
61
|
+
}
|
62
|
+
},
|
63
|
+
"email": "ben@jortt.nl",
|
64
|
+
"customer_id": "e1c5e15b-e34e-423e-a291-4ed43226a190",
|
65
|
+
"extra_information": null,
|
66
|
+
...
|
67
|
+
}
|
68
|
+
...
|
69
|
+
}
|
70
|
+
```
|
71
|
+
|
72
|
+
|
73
|
+
Searching invoices (`jortt.invoices.index(query: '202001-002')`) returns:
|
74
|
+
```ruby
|
75
|
+
[{
|
76
|
+
"id": "f8fd3e4e-da1c-43a7-892f-1410ac13e38a",
|
77
|
+
"invoice_status": "draft",
|
78
|
+
"customer_id": "f8fd3e4e-da1c-43a7-892f-1410ac13e38a",
|
79
|
+
"invoice_number": "202001-002",
|
80
|
+
"invoice_date": "2020-02-23",
|
81
|
+
...
|
82
|
+
}]
|
83
|
+
|
84
|
+
```
|
85
|
+
|
65
86
|
|
66
87
|
Adding invoices:
|
67
88
|
```ruby
|
68
89
|
jortt.invoices.create(
|
69
|
-
customer_id: "
|
70
|
-
|
71
|
-
|
90
|
+
customer_id: "f8fd3e4e-da1c-43a7-892f-1410ac13e38a",
|
91
|
+
invoice_date: "2020-02-23",
|
92
|
+
delivery_period: "2020-02-01",
|
93
|
+
payment_term: 14,
|
94
|
+
net_amounts: true,
|
95
|
+
send_method: "email",
|
96
|
+
introduction: "example",
|
97
|
+
remarks: "example",
|
98
|
+
payment_method: "pay_later",
|
72
99
|
line_items: [
|
73
|
-
{
|
74
|
-
|
100
|
+
{
|
101
|
+
description: "this is a description example",
|
102
|
+
units: 3.14,
|
103
|
+
amount_per_unit: {
|
104
|
+
value: "365.00",
|
105
|
+
currency: "EUR"
|
106
|
+
},
|
107
|
+
vat: 21,
|
108
|
+
ledger_account_id: "f8fd3e4e-da1c-43a7-892f-1410ac13e38a"
|
109
|
+
}
|
110
|
+
],
|
111
|
+
reference: "123"
|
75
112
|
)
|
76
113
|
```
|
77
114
|
|
78
|
-
## Documentation
|
79
|
-
|
80
|
-
Check https://app.jortt.nl/api-documentatie for more info.
|
81
|
-
|
82
115
|
## Development
|
83
116
|
|
84
117
|
### Running tests
|
@@ -95,3 +128,5 @@ by `require 'jortt/client'` and do your stuff).
|
|
95
128
|
Make a fix, commit and push. Make sure the build is green. Then bump the
|
96
129
|
version (edit `lib/jortt/client/version.rb`). Now `rake release` and follow
|
97
130
|
the instructions (you need a rubygems.org account and permissions ;-)).
|
131
|
+
|
132
|
+
Otherwise `gem build jortt.gemspec` and `gem push jortt-[version].gem`.
|
data/Rakefile
CHANGED
data/jortt.gemspec
CHANGED
@@ -8,13 +8,13 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Jortt::Client::VERSION
|
9
9
|
spec.authors = [
|
10
10
|
'Bob Forma',
|
11
|
-
'
|
11
|
+
'Michael Franken',
|
12
12
|
'Lars Vonk',
|
13
13
|
'Stephan van Diepen',
|
14
14
|
]
|
15
15
|
spec.email = [
|
16
16
|
'bforma@zilverline.com',
|
17
|
-
'
|
17
|
+
'mfranken@zilverline.com',
|
18
18
|
'lvonk@zilverline.com',
|
19
19
|
'svdiepen@zilverline.com',
|
20
20
|
]
|
@@ -27,14 +27,14 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
28
28
|
spec.require_paths = ['lib']
|
29
29
|
|
30
|
-
spec.add_runtime_dependency 'rest-client', '
|
30
|
+
spec.add_runtime_dependency 'rest-client', ['>= 2.0', '< 2.2']
|
31
|
+
spec.add_runtime_dependency 'oauth2', '~> 1.4.4'
|
31
32
|
|
32
|
-
spec.add_development_dependency 'bundler', '~>
|
33
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
33
34
|
spec.add_development_dependency 'codecov', '~> 0.1'
|
34
|
-
spec.add_development_dependency 'rake', '~>
|
35
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
36
|
-
spec.add_development_dependency 'rspec-its', '~> 1.2
|
37
|
-
spec.add_development_dependency 'webmock', '~>
|
38
|
-
spec.add_development_dependency '
|
39
|
-
spec.add_development_dependency 'rubocop-rspec', '~> 1.1.0'
|
35
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
36
|
+
spec.add_development_dependency 'rspec', '~> 3.7'
|
37
|
+
spec.add_development_dependency 'rspec-its', '~> 1.2'
|
38
|
+
spec.add_development_dependency 'webmock', '~> 3.3'
|
39
|
+
spec.add_development_dependency 'vcr', '~> 6.0'
|
40
40
|
end
|
data/lib/jortt.rb
CHANGED
data/lib/jortt/client.rb
CHANGED
@@ -1,21 +1,26 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require 'oauth2'
|
2
|
+
|
3
|
+
require 'jortt/client/error'
|
4
|
+
require 'jortt/client/customers'
|
5
|
+
require 'jortt/client/invoices'
|
6
|
+
require 'jortt/client/ledger_accounts'
|
3
7
|
|
4
8
|
module Jortt
|
5
9
|
##
|
6
10
|
# This class is the main interface used to communicate with the Jortt API.
|
7
11
|
# It is by the {Jortt} module to create configured instances.
|
8
12
|
class Client
|
9
|
-
|
13
|
+
SITE = 'https://api.jortt.nl'
|
14
|
+
OAUTH_PROVIDER_URL = 'https://app.jortt.nl/oauth-provider/oauth'
|
10
15
|
|
11
|
-
attr_accessor :
|
16
|
+
attr_accessor :token
|
12
17
|
|
13
18
|
# Initialize a Jortt client.
|
14
19
|
#
|
15
20
|
# @example
|
16
21
|
# Jortt::Client.new(
|
17
|
-
#
|
18
|
-
#
|
22
|
+
# "my-client-id",
|
23
|
+
# "my-client-secret"
|
19
24
|
# )
|
20
25
|
#
|
21
26
|
# @params [ Hash ] opts Options for the client,
|
@@ -24,45 +29,92 @@ module Jortt
|
|
24
29
|
# @return [ Jortt::Client ]
|
25
30
|
#
|
26
31
|
# @since 1.0.0
|
27
|
-
def initialize(opts)
|
28
|
-
|
29
|
-
|
30
|
-
|
32
|
+
def initialize(id, secret, opts = {})
|
33
|
+
oauth_provider_url = opts[:oauth_provider_url] || OAUTH_PROVIDER_URL
|
34
|
+
|
35
|
+
client = OAuth2::Client.new(id, secret,
|
36
|
+
site: opts[:site] || SITE,
|
37
|
+
token_url: "#{oauth_provider_url}/token",
|
38
|
+
authorize_url: "#{oauth_provider_url}/authorize",
|
39
|
+
auth_scheme: :basic_auth
|
40
|
+
)
|
41
|
+
|
42
|
+
@token = client.client_credentials.get_token(scope: "invoices:read invoices:write customers:read customers:write")
|
31
43
|
end
|
32
44
|
|
33
|
-
# Access the customer resource.
|
45
|
+
# Access the customer resource to perform operations.
|
34
46
|
#
|
35
47
|
# @example
|
36
48
|
# client.customers
|
37
49
|
#
|
38
|
-
# @return [ Jortt::Client::
|
50
|
+
# @return [ Jortt::Client::Customers ] entry to the customer resource.
|
39
51
|
#
|
40
52
|
# @since 1.0.0
|
41
53
|
def customers
|
42
|
-
@customers ||=
|
54
|
+
@customers ||= Jortt::Client::Customers.new(self)
|
43
55
|
end
|
44
56
|
|
45
|
-
# Access the
|
57
|
+
# Access the invoices resource to perform operations.
|
46
58
|
#
|
47
59
|
# @example
|
48
60
|
# client.invoices
|
49
61
|
#
|
50
|
-
# @return [ Jortt::Client::
|
62
|
+
# @return [ Jortt::Client::Invoices ] entry to the invoice resource.
|
51
63
|
#
|
52
64
|
# @since 1.0.0
|
53
65
|
def invoices
|
54
|
-
@invoices ||=
|
66
|
+
@invoices ||= Jortt::Client::Invoices.new(self)
|
55
67
|
end
|
56
68
|
|
57
|
-
|
58
|
-
|
59
|
-
#
|
69
|
+
# Access the ledger_accounts resource.
|
70
|
+
#
|
71
|
+
# @example
|
72
|
+
# client.ledger_accounts
|
60
73
|
#
|
61
|
-
# @return [ Jortt::Client::
|
74
|
+
# @return [ Jortt::Client::LedgerAccounts ] entry to the leger_accounts resource.
|
62
75
|
#
|
63
|
-
# @since
|
64
|
-
def
|
65
|
-
Jortt::Client::
|
76
|
+
# @since 5.0.0
|
77
|
+
def ledger_accounts
|
78
|
+
Jortt::Client::LedgerAccounts.new(self)
|
79
|
+
end
|
80
|
+
|
81
|
+
def get(path, params = {})
|
82
|
+
handle_response { token.get(path, params: params) }
|
83
|
+
end
|
84
|
+
|
85
|
+
def post(path, params = {})
|
86
|
+
handle_response { token.post(path, params: params) }
|
87
|
+
end
|
88
|
+
|
89
|
+
def put(path, params = {})
|
90
|
+
handle_response { token.put(path, params: params) }
|
91
|
+
end
|
92
|
+
|
93
|
+
def delete(path)
|
94
|
+
handle_response { token.delete(path) }
|
95
|
+
end
|
96
|
+
|
97
|
+
def handle_response(&block)
|
98
|
+
response = yield
|
99
|
+
return true if response.status == 204
|
100
|
+
response.parsed.fetch('data')
|
101
|
+
rescue OAuth2::Error => e
|
102
|
+
raise Error.from_response(e.response)
|
103
|
+
end
|
104
|
+
|
105
|
+
def paginated(path, params = {})
|
106
|
+
page = 1
|
107
|
+
|
108
|
+
Enumerator.new do |yielder|
|
109
|
+
loop do
|
110
|
+
response = token.get(path, params: params.merge(page: page)).parsed
|
111
|
+
response['data'].each { |item| yielder << item }
|
112
|
+
break if response['_links']['next'].nil?
|
113
|
+
page += 1
|
114
|
+
end
|
115
|
+
end
|
116
|
+
rescue OAuth2::Error => e
|
117
|
+
raise Error.from_response(e.response)
|
66
118
|
end
|
67
119
|
|
68
120
|
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
module Jortt # :nodoc:
|
2
|
+
class Client # :nodoc:
|
3
|
+
##
|
4
|
+
# Exposes the operations available for a collection of customers.
|
5
|
+
#
|
6
|
+
# @see { Jortt::Client.customers }
|
7
|
+
class Customers
|
8
|
+
attr_accessor :client
|
9
|
+
|
10
|
+
def initialize(client)
|
11
|
+
@client = client
|
12
|
+
end
|
13
|
+
|
14
|
+
##
|
15
|
+
# Returns all customers using the GET /customers endpoint.
|
16
|
+
# https://developer.jortt.nl/#list-customers
|
17
|
+
#
|
18
|
+
# @example
|
19
|
+
# client.customers.index(query: 'Jane')
|
20
|
+
#
|
21
|
+
def index(query: nil)
|
22
|
+
client.paginated('/customers', query: query)
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# Returns a customer using the GET /customers/{customer_id} endpoint.
|
27
|
+
# https://developer.jortt.nl/#get-customer-by-id
|
28
|
+
#
|
29
|
+
# @example
|
30
|
+
# client.customers.show("9afcd96e-caf8-40a1-96c9-1af16d0bc804")
|
31
|
+
#
|
32
|
+
def show(id)
|
33
|
+
client.get("/customers/#{id}")
|
34
|
+
end
|
35
|
+
|
36
|
+
##
|
37
|
+
# Creates a Customer using the POST /customers endpoint.
|
38
|
+
# https://developer.jortt.nl/#create-customer
|
39
|
+
#
|
40
|
+
# @example
|
41
|
+
# client.customers.create(
|
42
|
+
# is_private: false,
|
43
|
+
# customer_name: 'Nuka-Cola Corporation',
|
44
|
+
# address_street: 'Vault 11',
|
45
|
+
# address_postal_code: '1111AA',
|
46
|
+
# address_city: 'Mojave Wasteland'
|
47
|
+
# )
|
48
|
+
#
|
49
|
+
def create(payload)
|
50
|
+
client.post('/customers', payload)
|
51
|
+
end
|
52
|
+
|
53
|
+
##
|
54
|
+
# Updates a Customer using the PUT /customers/{customer_id} endpoint.
|
55
|
+
# https://developer.jortt.nl/#update-customer
|
56
|
+
#
|
57
|
+
# @example
|
58
|
+
# client.customers.update(
|
59
|
+
# "9afcd96e-caf8-40a1-96c9-1af16d0bc804",
|
60
|
+
# { address_extra_information: 'foobar' }
|
61
|
+
# )
|
62
|
+
#
|
63
|
+
def update(id, payload)
|
64
|
+
client.put("/customers/#{id}", payload)
|
65
|
+
end
|
66
|
+
|
67
|
+
##
|
68
|
+
# Deletes a Customer using the DELETE /customers/{customer_id} endpoint.
|
69
|
+
# https://developer.jortt.nl/#delete-a-customer
|
70
|
+
#
|
71
|
+
# @example
|
72
|
+
# client.customers.delete("9afcd96e-caf8-40a1-96c9-1af16d0bc804")
|
73
|
+
#
|
74
|
+
def delete(id)
|
75
|
+
client.delete("/customers/#{id}")
|
76
|
+
end
|
77
|
+
|
78
|
+
##
|
79
|
+
# Send direct debit authorization to a Customer using POST /customers/{customer_id}/direct_debit_mandate.
|
80
|
+
# https://developer.jortt.nl/#send-direct-debit-authorization-to-a-customer
|
81
|
+
#
|
82
|
+
# @example
|
83
|
+
# client.customers.direct_debit_mandate("9afcd96e-caf8-40a1-96c9-1af16d0bc804")
|
84
|
+
#
|
85
|
+
|
86
|
+
def direct_debit_mandate(id)
|
87
|
+
client.post("/customers/#{id}/direct_debit_mandate")
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|