jortt 4.2.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 +45 -151
- data/Rakefile +0 -1
- data/jortt.gemspec +6 -6
- data/lib/jortt.rb +0 -1
- data/lib/jortt/client.rb +65 -16
- data/lib/jortt/client/customers.rb +56 -49
- data/lib/jortt/client/error.rb +33 -0
- data/lib/jortt/client/invoices.rb +41 -38
- 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/_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 +82 -37
- data/spec/jortt/client/invoices_spec.rb +105 -26
- data/spec/jortt/client/ledger_accounts_spec.rb +19 -0
- data/spec/jortt/client_spec.rb +5 -27
- data/spec/jortt_spec.rb +2 -3
- data/spec/spec_helper.rb +18 -4
- metadata +72 -37
- data/.rubocop.yml +0 -26
- data/lib/jortt/client/invoice.rb +0 -50
- data/spec/jortt/client/invoice_spec.rb +0 -23
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
|
+
2.7.1
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -15,74 +15,36 @@ http://img.shields.io/travis/jorttbv/jortt-ruby.svg?style=flat
|
|
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
|
+
|
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
|
+
|
22
|
+
## Usage examples
|
19
23
|
|
20
24
|
To create a jortt client:
|
21
25
|
```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
|
-
)
|
26
|
+
jortt = Jortt.client('<your-client-id>', '<your-client-secret>')
|
26
27
|
```
|
27
28
|
|
28
29
|
### Customers
|
29
30
|
|
30
|
-
All customers (`jortt.customers.
|
31
|
-
```ruby
|
32
|
-
[{
|
33
|
-
company_name: 'Jortt',
|
34
|
-
address: {
|
35
|
-
street: "Transistorstraat 71C",
|
36
|
-
postal_code: "1322 CK",
|
37
|
-
city: "Almere",
|
38
|
-
country_code: "NL"
|
39
|
-
}
|
40
|
-
},
|
41
|
-
{
|
42
|
-
company_name: 'Zilverline',
|
43
|
-
address: {
|
44
|
-
street: "Cruquiusweg",
|
45
|
-
...
|
46
|
-
}
|
47
|
-
},
|
48
|
-
...
|
49
|
-
page: 2,
|
50
|
-
per_page: 25
|
51
|
-
]
|
52
|
-
```
|
53
|
-
|
54
|
-
Searching customers (`jortt.customers.search('Jortt')`) returns:
|
31
|
+
All customers (`jortt.customers.index(page: 2)`) returns:
|
55
32
|
```ruby
|
56
33
|
[{
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
country_code: "NL"
|
63
|
-
}
|
64
|
-
},
|
65
|
-
{
|
66
|
-
company_name: 'ttroj',
|
67
|
-
address: {
|
68
|
-
street: "Jorttweg",
|
69
|
-
...
|
70
|
-
}
|
34
|
+
"id": "f8fd3e4e-da1c-43a7-892f-1410ac13e38a",
|
35
|
+
"is_private": true,
|
36
|
+
"customer_name": "Jortt",
|
37
|
+
"address_street": "Rozengracht 75a",
|
38
|
+
...
|
71
39
|
}]
|
72
40
|
```
|
73
41
|
|
74
42
|
Adding customers:
|
75
43
|
```ruby
|
76
44
|
jortt.customers.create(
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
address: {
|
81
|
-
street: "Transistorstraat 71C",
|
82
|
-
postal_code: "1322 CK",
|
83
|
-
city: "Almere",
|
84
|
-
country_code: "NL"
|
85
|
-
}
|
45
|
+
"is_private": true,
|
46
|
+
"customer_name": "Jortt",
|
47
|
+
...
|
86
48
|
)
|
87
49
|
```
|
88
50
|
|
@@ -113,80 +75,16 @@ Get invoices by ID (`jortt.invoices.get('934d59dd-76f6-4716-9e0f-82a618e1be21')`
|
|
113
75
|
```
|
114
76
|
|
115
77
|
|
116
|
-
Searching invoices (`jortt.invoices.
|
78
|
+
Searching invoices (`jortt.invoices.index(query: '202001-002')`) returns:
|
117
79
|
```ruby
|
118
|
-
[
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
"city": "Amsterdam",
|
127
|
-
"postal_code": "1111SX",
|
128
|
-
"country": {
|
129
|
-
"code": "NL",
|
130
|
-
"name": "Nederland"
|
131
|
-
}
|
132
|
-
},
|
133
|
-
"email": "ben@jortt.nl",
|
134
|
-
"customer_id": "e1c5e15b-e34e-423e-a291-4ed43226a190",
|
135
|
-
"extra_information": null,
|
136
|
-
"shift_vat": null,
|
137
|
-
"vat_number": null,
|
138
|
-
"payment_term": 30
|
139
|
-
},
|
140
|
-
"recipient_in_eu": true,
|
141
|
-
"organization": {
|
142
|
-
"company_name": "Jortt BV",
|
143
|
-
"company_name_line_2": null,
|
144
|
-
"address": {
|
145
|
-
"street": "Straat 1",
|
146
|
-
"city": "Amsterdam",
|
147
|
-
"postal_code": "1000 AA",
|
148
|
-
"country": {
|
149
|
-
"code": "NL",
|
150
|
-
"name": "Nederland"
|
151
|
-
}
|
152
|
-
},
|
153
|
-
"phonenumber": null,
|
154
|
-
"bank_information": {
|
155
|
-
"bic": "RABONL2U",
|
156
|
-
"iban": "NL50RABO0150000001",
|
157
|
-
"in_the_name_of": "Jortt B.V.",
|
158
|
-
"description": null
|
159
|
-
},
|
160
|
-
"coc_number": "unique number",
|
161
|
-
"vat_number": "NL821898279B01",
|
162
|
-
"profession": null,
|
163
|
-
"healthcare_data": null,
|
164
|
-
"free_of_vat": false,
|
165
|
-
"finance_email": "Jortt BV <compleet@jortt.nl>"
|
166
|
-
},
|
167
|
-
"line_items": [
|
168
|
-
{
|
169
|
-
"description": "Scrum",
|
170
|
-
"vat": "0.21",
|
171
|
-
"amount": "-100.0",
|
172
|
-
"total_amount_ex_vat": "-100.0",
|
173
|
-
"currency": "EUR",
|
174
|
-
"quantity": "1.0"
|
175
|
-
}
|
176
|
-
],
|
177
|
-
"invoice_currency": null,
|
178
|
-
"invoice_total": "-100.0",
|
179
|
-
"invoice_total_incl_vat": "-121.0",
|
180
|
-
"invoice_number": "201607-011",
|
181
|
-
"invoice_status": "paid",
|
182
|
-
"invoice_due_date": "2016-08-06",
|
183
|
-
"invoice_date": "2016-07-07",
|
184
|
-
"invoice_delivery_period": "2016-07-01",
|
185
|
-
"invoice_remarks": null,
|
186
|
-
"invoice_language": "nl",
|
187
|
-
"invoice_reference": null
|
188
|
-
}
|
189
|
-
]
|
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
|
+
}]
|
190
88
|
|
191
89
|
```
|
192
90
|
|
@@ -194,35 +92,31 @@ Searching invoices (`jortt.invoices.search('201606-012')`) returns:
|
|
194
92
|
Adding invoices:
|
195
93
|
```ruby
|
196
94
|
jortt.invoices.create(
|
197
|
-
customer_id: "
|
198
|
-
|
199
|
-
|
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",
|
200
104
|
line_items: [
|
201
|
-
{
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
},
|
214
|
-
invoice_date: Date.today, # optional
|
215
|
-
payment_term: 7, # optional
|
216
|
-
language: 'nl', # optional
|
217
|
-
send_method: 'email', # optional
|
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"
|
218
117
|
)
|
219
118
|
```
|
220
119
|
|
221
|
-
|
222
|
-
## Documentation
|
223
|
-
|
224
|
-
Check https://app.jortt.nl/api-documentatie for more info.
|
225
|
-
|
226
120
|
## Development
|
227
121
|
|
228
122
|
### Running tests
|
data/Rakefile
CHANGED
data/jortt.gemspec
CHANGED
@@ -28,13 +28,13 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.require_paths = ['lib']
|
29
29
|
|
30
30
|
spec.add_runtime_dependency 'rest-client', '~> 2.0'
|
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.
|
35
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
36
|
+
spec.add_development_dependency 'rspec', '~> 3.7'
|
36
37
|
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'
|
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,23 +1,26 @@
|
|
1
|
-
|
1
|
+
require 'oauth2'
|
2
|
+
|
3
|
+
require 'jortt/client/error'
|
2
4
|
require 'jortt/client/customers'
|
3
5
|
require 'jortt/client/invoices'
|
4
|
-
require 'jortt/client/
|
6
|
+
require 'jortt/client/ledger_accounts'
|
5
7
|
|
6
8
|
module Jortt
|
7
9
|
##
|
8
10
|
# This class is the main interface used to communicate with the Jortt API.
|
9
11
|
# It is by the {Jortt} module to create configured instances.
|
10
12
|
class Client
|
11
|
-
|
13
|
+
SITE = 'https://api.jortt.nl'
|
14
|
+
OAUTH_PROVIDER_URL = 'https://app.jortt.nl/oauth-provider/oauth'
|
12
15
|
|
13
|
-
attr_accessor :
|
16
|
+
attr_accessor :token
|
14
17
|
|
15
18
|
# Initialize a Jortt client.
|
16
19
|
#
|
17
20
|
# @example
|
18
21
|
# Jortt::Client.new(
|
19
|
-
#
|
20
|
-
#
|
22
|
+
# "my-client-id",
|
23
|
+
# "my-client-secret"
|
21
24
|
# )
|
22
25
|
#
|
23
26
|
# @params [ Hash ] opts Options for the client,
|
@@ -26,10 +29,17 @@ module Jortt
|
|
26
29
|
# @return [ Jortt::Client ]
|
27
30
|
#
|
28
31
|
# @since 1.0.0
|
29
|
-
def initialize(opts)
|
30
|
-
|
31
|
-
|
32
|
-
|
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")
|
33
43
|
end
|
34
44
|
|
35
45
|
# Access the customer resource to perform operations.
|
@@ -56,16 +66,55 @@ module Jortt
|
|
56
66
|
@invoices ||= Jortt::Client::Invoices.new(self)
|
57
67
|
end
|
58
68
|
|
59
|
-
# Access
|
69
|
+
# Access the ledger_accounts resource.
|
60
70
|
#
|
61
71
|
# @example
|
62
|
-
# client.
|
72
|
+
# client.ledger_accounts
|
63
73
|
#
|
64
|
-
# @
|
74
|
+
# @return [ Jortt::Client::LedgerAccounts ] entry to the leger_accounts resource.
|
65
75
|
#
|
66
|
-
# @
|
67
|
-
def
|
68
|
-
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)
|
69
118
|
end
|
70
119
|
|
71
120
|
end
|
@@ -1,84 +1,91 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
require 'rest-client'
|
3
|
-
|
4
1
|
module Jortt # :nodoc:
|
5
2
|
class Client # :nodoc:
|
6
|
-
|
7
3
|
##
|
8
4
|
# Exposes the operations available for a collection of customers.
|
9
5
|
#
|
10
6
|
# @see { Jortt::Client.customers }
|
11
7
|
class Customers
|
8
|
+
attr_accessor :client
|
9
|
+
|
10
|
+
def initialize(client)
|
11
|
+
@client = client
|
12
|
+
end
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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)
|
19
23
|
end
|
20
24
|
|
21
25
|
##
|
22
|
-
# Returns
|
26
|
+
# Returns a customer using the GET /customers/{customer_id} endpoint.
|
27
|
+
# https://developer.jortt.nl/#get-customer-by-id
|
23
28
|
#
|
24
29
|
# @example
|
25
|
-
#
|
30
|
+
# client.customers.show("9afcd96e-caf8-40a1-96c9-1af16d0bc804")
|
26
31
|
#
|
27
|
-
def
|
28
|
-
|
29
|
-
JSON.parse(res.body)
|
30
|
-
end
|
32
|
+
def show(id)
|
33
|
+
client.get("/customers/#{id}")
|
31
34
|
end
|
32
35
|
|
33
36
|
##
|
34
37
|
# Creates a Customer using the POST /customers endpoint.
|
35
|
-
#
|
38
|
+
# https://developer.jortt.nl/#create-customer
|
36
39
|
#
|
37
40
|
# @example
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
42
|
-
#
|
43
|
-
#
|
44
|
-
# street: "Street 100", # mandatory
|
45
|
-
# postal_code: "1000 AA", # mandatory
|
46
|
-
# city: "Amsterdam", # mandatory
|
47
|
-
# country_code: "NL" # mandatory
|
48
|
-
# }
|
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'
|
49
47
|
# )
|
48
|
+
#
|
50
49
|
def create(payload)
|
51
|
-
|
52
|
-
JSON.parse(response.body)
|
53
|
-
end
|
50
|
+
client.post('/customers', payload)
|
54
51
|
end
|
55
52
|
|
56
|
-
|
57
|
-
#
|
58
|
-
#
|
59
|
-
# customers.search('Zilverline')
|
53
|
+
##
|
54
|
+
# Updates a Customer using the PUT /customers/{customer_id} endpoint.
|
55
|
+
# https://developer.jortt.nl/#update-customer
|
60
56
|
#
|
61
57
|
# @example
|
62
|
-
# customers.
|
63
|
-
#
|
64
|
-
#
|
58
|
+
# client.customers.update(
|
59
|
+
# "9afcd96e-caf8-40a1-96c9-1af16d0bc804",
|
60
|
+
# { address_extra_information: 'foobar' }
|
61
|
+
# )
|
65
62
|
#
|
66
|
-
|
67
|
-
|
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
|
68
70
|
#
|
69
|
-
# @
|
71
|
+
# @example
|
72
|
+
# client.customers.delete("9afcd96e-caf8-40a1-96c9-1af16d0bc804")
|
70
73
|
#
|
71
|
-
|
72
|
-
|
73
|
-
resource.get(params: {query: query}) do |response|
|
74
|
-
JSON.parse(response.body)
|
75
|
-
end
|
74
|
+
def delete(id)
|
75
|
+
client.delete("/customers/#{id}")
|
76
76
|
end
|
77
77
|
|
78
|
-
|
79
|
-
|
80
|
-
|
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
|
+
#
|
81
85
|
|
86
|
+
def direct_debit_mandate(id)
|
87
|
+
client.post("/customers/#{id}/direct_debit_mandate")
|
88
|
+
end
|
82
89
|
end
|
83
90
|
end
|
84
91
|
end
|