jortt 2.0.0 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-version +1 -1
- data/.travis.yml +1 -3
- data/README.md +86 -48
- data/Rakefile +0 -1
- data/jortt.gemspec +24 -13
- data/lib/jortt.rb +21 -0
- data/lib/jortt/client.rb +121 -0
- data/lib/jortt/client/customers.rb +91 -0
- data/lib/jortt/client/error.rb +33 -0
- data/lib/jortt/client/invoices.rb +65 -0
- data/lib/jortt/client/ledger_accounts.rb +27 -0
- data/lib/jortt/client/version.rb +6 -0
- 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/_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 +119 -0
- data/spec/jortt/client/ledger_accounts_spec.rb +19 -0
- data/spec/jortt/client_spec.rb +22 -0
- data/spec/{freemle_spec.rb → jortt_spec.rb} +2 -3
- data/spec/spec_helper.rb +22 -10
- metadata +99 -42
- data/.rubocop.yml +0 -26
- data/lib/freemle.rb +0 -22
- data/lib/freemle/client.rb +0 -69
- data/lib/freemle/client/resource.rb +0 -140
- data/lib/freemle/client/version.rb +0 -7
- data/spec/freemle/client/resource_spec.rb +0 -31
- data/spec/freemle/client_spec.rb +0 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4034de85abfce8b8e5116576441272434c1435d4d51c7f86a2c01d7f87da5506
|
4
|
+
data.tar.gz: 764eba179889e670fc8f0c1a7620dfcefdba8735612ef002c67c7ce4817eea66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aaa6c20cfeedfdf18f2eeafa90e46ae7c8e0402bad48ad6b3849d10ca1caaa919697b7e7881e9333b41426cecd235f9f78206737c535f8f4e6ccafca92e7c96c
|
7
|
+
data.tar.gz: 022c967a77e8d5ac6db87ed7ba8eb4613de35d0ac62f09762476f2423e5a97333bcb5c7b4c28ac780595d0d9945e52a2e8fa401e1fe24c77cd941eafdf1ca596
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.1
|
1
|
+
2.7.1
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,86 +1,122 @@
|
|
1
|
-
#
|
1
|
+
# Jortt REST API client
|
2
2
|
|
3
3
|
[![Inline docs](
|
4
|
-
http://inch-ci.org/github/jorttbv/
|
4
|
+
http://inch-ci.org/github/jorttbv/jortt-ruby.svg?branch=master&style=flat
|
5
5
|
)](http://inch-ci.org/github/jorttbv/jortt-ruby)
|
6
6
|
[![Code Climate](
|
7
7
|
http://img.shields.io/codeclimate/github/jorttbv/jortt-ruby.svg?style=flat
|
8
8
|
)](https://codeclimate.com/github/jorttbv/jortt-ruby)
|
9
|
-
[![Coverage
|
10
|
-
|
11
|
-
)](https://
|
9
|
+
[![Code Coverage](
|
10
|
+
https://codecov.io/github/jorttbv/jortt-ruby/coverage.svg?branch=master
|
11
|
+
)](https://codecov.io/github/jorttbv/jortt-ruby?branch=master)
|
12
12
|
[![Build Status](
|
13
13
|
http://img.shields.io/travis/jorttbv/jortt-ruby.svg?style=flat
|
14
14
|
)](https://travis-ci.org/jorttbv/jortt-ruby)
|
15
15
|
|
16
16
|
A Ruby interface to the [Jortt](https://www.jortt.nl/) REST API.
|
17
17
|
|
18
|
-
|
18
|
+
Check https://developer.jortt.nl/ for more info.
|
19
19
|
|
20
|
-
|
20
|
+
> 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)
|
21
21
|
|
22
|
-
|
22
|
+
## Usage examples
|
23
|
+
|
24
|
+
To create a jortt client:
|
23
25
|
```ruby
|
24
|
-
|
25
|
-
app_name: "application-name-as-chosen-on-jortt.nl",
|
26
|
-
api_key: "api-key-as-provided-by-jortt.nl"
|
27
|
-
)
|
26
|
+
jortt = Jortt.client('<your-client-id>', '<your-client-secret>')
|
28
27
|
```
|
29
28
|
|
30
29
|
### Customers
|
31
30
|
|
32
|
-
|
31
|
+
All customers (`jortt.customers.index(page: 2)`) returns:
|
33
32
|
```ruby
|
34
33
|
[{
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
country_code: "NL"
|
41
|
-
}
|
42
|
-
},
|
43
|
-
company_name: 'ttroj',
|
44
|
-
address: {
|
45
|
-
street: "Jorttweg",
|
46
|
-
...
|
47
|
-
}
|
34
|
+
"id": "f8fd3e4e-da1c-43a7-892f-1410ac13e38a",
|
35
|
+
"is_private": true,
|
36
|
+
"customer_name": "Jortt",
|
37
|
+
"address_street": "Rozengracht 75a",
|
38
|
+
...
|
48
39
|
}]
|
49
40
|
```
|
50
41
|
|
51
42
|
Adding customers:
|
52
43
|
```ruby
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
address: {
|
58
|
-
street: "Transistorstraat 71C",
|
59
|
-
postal_code: "1322 CK",
|
60
|
-
city: "Almere",
|
61
|
-
country_code: "NL"
|
62
|
-
}
|
44
|
+
jortt.customers.create(
|
45
|
+
"is_private": true,
|
46
|
+
"customer_name": "Jortt",
|
47
|
+
...
|
63
48
|
)
|
64
49
|
```
|
65
50
|
|
66
51
|
### Invoices
|
52
|
+
Get invoices by ID (`jortt.invoices.get('934d59dd-76f6-4716-9e0f-82a618e1be21')`) returns:
|
53
|
+
```ruby
|
54
|
+
{
|
55
|
+
"invoice_id": "934d59dd-76f6-4716-9e0f-82a618e1be21",
|
56
|
+
"recipient": {
|
57
|
+
"company_name": "Zilverline B.V.",
|
58
|
+
"attn": null,
|
59
|
+
"address": {
|
60
|
+
"street": "Cruquisweg 109F",
|
61
|
+
"city": "Amsterdam",
|
62
|
+
"postal_code": "1111SX",
|
63
|
+
"country": {
|
64
|
+
"code": "NL",
|
65
|
+
"name": "Nederland"
|
66
|
+
}
|
67
|
+
},
|
68
|
+
"email": "ben@jortt.nl",
|
69
|
+
"customer_id": "e1c5e15b-e34e-423e-a291-4ed43226a190",
|
70
|
+
"extra_information": null,
|
71
|
+
...
|
72
|
+
}
|
73
|
+
...
|
74
|
+
}
|
75
|
+
```
|
76
|
+
|
77
|
+
|
78
|
+
Searching invoices (`jortt.invoices.index(query: '202001-002')`) returns:
|
79
|
+
```ruby
|
80
|
+
[{
|
81
|
+
"id": "f8fd3e4e-da1c-43a7-892f-1410ac13e38a",
|
82
|
+
"invoice_status": "draft",
|
83
|
+
"customer_id": "f8fd3e4e-da1c-43a7-892f-1410ac13e38a",
|
84
|
+
"invoice_number": "202001-002",
|
85
|
+
"invoice_date": "2020-02-23",
|
86
|
+
...
|
87
|
+
}]
|
88
|
+
|
89
|
+
```
|
90
|
+
|
67
91
|
|
68
92
|
Adding invoices:
|
69
93
|
```ruby
|
70
|
-
|
71
|
-
customer_id: "
|
72
|
-
|
73
|
-
|
94
|
+
jortt.invoices.create(
|
95
|
+
customer_id: "f8fd3e4e-da1c-43a7-892f-1410ac13e38a",
|
96
|
+
invoice_date: "2020-02-23",
|
97
|
+
delivery_period: "2020-02-01",
|
98
|
+
payment_term: 14,
|
99
|
+
net_amounts: true,
|
100
|
+
send_method: "email",
|
101
|
+
introduction: "example",
|
102
|
+
remarks: "example",
|
103
|
+
payment_method: "pay_later",
|
74
104
|
line_items: [
|
75
|
-
{
|
76
|
-
|
105
|
+
{
|
106
|
+
description: "this is a description example",
|
107
|
+
units: 3.14,
|
108
|
+
amount_per_unit: {
|
109
|
+
value: "365.00",
|
110
|
+
currency: "EUR"
|
111
|
+
},
|
112
|
+
vat: 21,
|
113
|
+
ledger_account_id: "f8fd3e4e-da1c-43a7-892f-1410ac13e38a"
|
114
|
+
}
|
115
|
+
],
|
116
|
+
reference: "123"
|
77
117
|
)
|
78
118
|
```
|
79
119
|
|
80
|
-
## Documentation
|
81
|
-
|
82
|
-
Check https://app.jortt.nl/api-documentatie for more info.
|
83
|
-
|
84
120
|
## Development
|
85
121
|
|
86
122
|
### Running tests
|
@@ -90,10 +126,12 @@ Check https://app.jortt.nl/api-documentatie for more info.
|
|
90
126
|
### Building the gem
|
91
127
|
|
92
128
|
`rake build` and then `rake install` to test it locally (`irb` followed
|
93
|
-
by `require '
|
129
|
+
by `require 'jortt/client'` and do your stuff).
|
94
130
|
|
95
131
|
### Releasing the gem
|
96
132
|
|
97
133
|
Make a fix, commit and push. Make sure the build is green. Then bump the
|
98
|
-
version (edit `lib/
|
134
|
+
version (edit `lib/jortt/client/version.rb`). Now `rake release` and follow
|
99
135
|
the instructions (you need a rubygems.org account and permissions ;-)).
|
136
|
+
|
137
|
+
Otherwise `gem build jortt.gemspec` and `gem push jortt-[version].gem`.
|
data/Rakefile
CHANGED
data/jortt.gemspec
CHANGED
@@ -1,15 +1,25 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require '
|
4
|
+
require 'jortt/client/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'jortt'
|
8
|
-
spec.version =
|
9
|
-
spec.authors = [
|
10
|
-
|
8
|
+
spec.version = Jortt::Client::VERSION
|
9
|
+
spec.authors = [
|
10
|
+
'Bob Forma',
|
11
|
+
'Michael Franken',
|
12
|
+
'Lars Vonk',
|
13
|
+
'Stephan van Diepen',
|
14
|
+
]
|
15
|
+
spec.email = [
|
16
|
+
'bforma@zilverline.com',
|
17
|
+
'mfranken@zilverline.com',
|
18
|
+
'lvonk@zilverline.com',
|
19
|
+
'svdiepen@zilverline.com',
|
20
|
+
]
|
11
21
|
spec.summary = 'jortt.nl REST API client'
|
12
|
-
spec.homepage = 'https://
|
22
|
+
spec.homepage = 'https://app.jortt.nl/api-documentatie'
|
13
23
|
spec.license = 'MIT'
|
14
24
|
|
15
25
|
spec.files = `git ls-files -z`.split("\x0")
|
@@ -17,13 +27,14 @@ Gem::Specification.new do |spec|
|
|
17
27
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
28
|
spec.require_paths = ['lib']
|
19
29
|
|
20
|
-
spec.add_runtime_dependency 'rest-client', '~>
|
30
|
+
spec.add_runtime_dependency 'rest-client', '~> 2.0'
|
31
|
+
spec.add_runtime_dependency 'oauth2', '~> 1.4.4'
|
21
32
|
|
22
|
-
spec.add_development_dependency 'bundler', '~>
|
23
|
-
spec.add_development_dependency '
|
24
|
-
spec.add_development_dependency 'rake', '~>
|
25
|
-
spec.add_development_dependency 'rspec', '~>
|
26
|
-
spec.add_development_dependency '
|
27
|
-
spec.add_development_dependency '
|
28
|
-
spec.add_development_dependency '
|
33
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
34
|
+
spec.add_development_dependency 'codecov', '~> 0.1'
|
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'
|
29
40
|
end
|
data/lib/jortt.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'jortt/client'
|
2
|
+
require 'jortt/client/version'
|
3
|
+
|
4
|
+
##
|
5
|
+
# This module contains everything needed to setup a connection to the Jortt
|
6
|
+
# API. It's only method returns a configured Jortt::Client.
|
7
|
+
module Jortt
|
8
|
+
|
9
|
+
# Convenient way to initialize a jortt client.
|
10
|
+
#
|
11
|
+
# @see {Jortt::Client.initialize}
|
12
|
+
#
|
13
|
+
# @return [ Jortt::Client ] a new jortt client instance
|
14
|
+
#
|
15
|
+
# @since 1.0.1
|
16
|
+
def client(*args)
|
17
|
+
Jortt::Client.new(*args)
|
18
|
+
end
|
19
|
+
module_function :client
|
20
|
+
|
21
|
+
end
|
data/lib/jortt/client.rb
ADDED
@@ -0,0 +1,121 @@
|
|
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'
|
7
|
+
|
8
|
+
module Jortt
|
9
|
+
##
|
10
|
+
# This class is the main interface used to communicate with the Jortt API.
|
11
|
+
# It is by the {Jortt} module to create configured instances.
|
12
|
+
class Client
|
13
|
+
SITE = 'https://api.jortt.nl'
|
14
|
+
OAUTH_PROVIDER_URL = 'https://app.jortt.nl/oauth-provider/oauth'
|
15
|
+
|
16
|
+
attr_accessor :token
|
17
|
+
|
18
|
+
# Initialize a Jortt client.
|
19
|
+
#
|
20
|
+
# @example
|
21
|
+
# Jortt::Client.new(
|
22
|
+
# "my-client-id",
|
23
|
+
# "my-client-secret"
|
24
|
+
# )
|
25
|
+
#
|
26
|
+
# @params [ Hash ] opts Options for the client,
|
27
|
+
# optionally including base_url.
|
28
|
+
#
|
29
|
+
# @return [ Jortt::Client ]
|
30
|
+
#
|
31
|
+
# @since 1.0.0
|
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")
|
43
|
+
end
|
44
|
+
|
45
|
+
# Access the customer resource to perform operations.
|
46
|
+
#
|
47
|
+
# @example
|
48
|
+
# client.customers
|
49
|
+
#
|
50
|
+
# @return [ Jortt::Client::Customers ] entry to the customer resource.
|
51
|
+
#
|
52
|
+
# @since 1.0.0
|
53
|
+
def customers
|
54
|
+
@customers ||= Jortt::Client::Customers.new(self)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Access the invoices resource to perform operations.
|
58
|
+
#
|
59
|
+
# @example
|
60
|
+
# client.invoices
|
61
|
+
#
|
62
|
+
# @return [ Jortt::Client::Invoices ] entry to the invoice resource.
|
63
|
+
#
|
64
|
+
# @since 1.0.0
|
65
|
+
def invoices
|
66
|
+
@invoices ||= Jortt::Client::Invoices.new(self)
|
67
|
+
end
|
68
|
+
|
69
|
+
# Access the ledger_accounts resource.
|
70
|
+
#
|
71
|
+
# @example
|
72
|
+
# client.ledger_accounts
|
73
|
+
#
|
74
|
+
# @return [ Jortt::Client::LedgerAccounts ] entry to the leger_accounts resource.
|
75
|
+
#
|
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)
|
118
|
+
end
|
119
|
+
|
120
|
+
end
|
121
|
+
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
|