jortt 4.1.0 → 6.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/rspec.yml +27 -0
- data/.ruby-version +1 -1
- data/README.md +75 -133
- data/Rakefile +0 -1
- data/jortt.gemspec +7 -7
- data/lib/jortt/client/customers.rb +71 -42
- data/lib/jortt/client/error.rb +33 -0
- data/lib/jortt/client/invoices.rb +55 -31
- data/lib/jortt/client/ledger_accounts.rb +27 -0
- data/lib/jortt/client/version.rb +1 -2
- data/lib/jortt/client.rb +65 -16
- data/lib/jortt.rb +0 -1
- 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_Customers/_vat_percentages/returns_the_vat_percentages.yml +330 -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 +109 -20
- data/spec/jortt/client/invoices_spec.rb +118 -20
- 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 +85 -41
- data/.rubocop.yml +0 -26
- data/.travis.yml +0 -7
- data/lib/jortt/client/invoice.rb +0 -50
- data/spec/jortt/client/invoice_spec.rb +0 -23
metadata
CHANGED
@@ -1,46 +1,66 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jortt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Forma
|
8
8
|
- Michael Franken
|
9
9
|
- Lars Vonk
|
10
10
|
- Stephan van Diepen
|
11
|
-
autorequire:
|
11
|
+
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2021-09-29 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rest-client
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '2.0'
|
23
|
+
- - "<"
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '2.2'
|
26
|
+
type: :runtime
|
27
|
+
prerelease: false
|
28
|
+
version_requirements: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2.0'
|
33
|
+
- - "<"
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '2.2'
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: oauth2
|
18
38
|
requirement: !ruby/object:Gem::Requirement
|
19
39
|
requirements:
|
20
40
|
- - "~>"
|
21
41
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
42
|
+
version: 1.4.4
|
23
43
|
type: :runtime
|
24
44
|
prerelease: false
|
25
45
|
version_requirements: !ruby/object:Gem::Requirement
|
26
46
|
requirements:
|
27
47
|
- - "~>"
|
28
48
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
49
|
+
version: 1.4.4
|
30
50
|
- !ruby/object:Gem::Dependency
|
31
51
|
name: bundler
|
32
52
|
requirement: !ruby/object:Gem::Requirement
|
33
53
|
requirements:
|
34
54
|
- - "~>"
|
35
55
|
- !ruby/object:Gem::Version
|
36
|
-
version: '
|
56
|
+
version: '2.0'
|
37
57
|
type: :development
|
38
58
|
prerelease: false
|
39
59
|
version_requirements: !ruby/object:Gem::Requirement
|
40
60
|
requirements:
|
41
61
|
- - "~>"
|
42
62
|
- !ruby/object:Gem::Version
|
43
|
-
version: '
|
63
|
+
version: '2.0'
|
44
64
|
- !ruby/object:Gem::Dependency
|
45
65
|
name: codecov
|
46
66
|
requirement: !ruby/object:Gem::Requirement
|
@@ -61,28 +81,28 @@ dependencies:
|
|
61
81
|
requirements:
|
62
82
|
- - "~>"
|
63
83
|
- !ruby/object:Gem::Version
|
64
|
-
version: '
|
84
|
+
version: '13.0'
|
65
85
|
type: :development
|
66
86
|
prerelease: false
|
67
87
|
version_requirements: !ruby/object:Gem::Requirement
|
68
88
|
requirements:
|
69
89
|
- - "~>"
|
70
90
|
- !ruby/object:Gem::Version
|
71
|
-
version: '
|
91
|
+
version: '13.0'
|
72
92
|
- !ruby/object:Gem::Dependency
|
73
93
|
name: rspec
|
74
94
|
requirement: !ruby/object:Gem::Requirement
|
75
95
|
requirements:
|
76
96
|
- - "~>"
|
77
97
|
- !ruby/object:Gem::Version
|
78
|
-
version: '3.
|
98
|
+
version: '3.7'
|
79
99
|
type: :development
|
80
100
|
prerelease: false
|
81
101
|
version_requirements: !ruby/object:Gem::Requirement
|
82
102
|
requirements:
|
83
103
|
- - "~>"
|
84
104
|
- !ruby/object:Gem::Version
|
85
|
-
version: '3.
|
105
|
+
version: '3.7'
|
86
106
|
- !ruby/object:Gem::Dependency
|
87
107
|
name: rspec-its
|
88
108
|
requirement: !ruby/object:Gem::Requirement
|
@@ -103,43 +123,29 @@ dependencies:
|
|
103
123
|
requirements:
|
104
124
|
- - "~>"
|
105
125
|
- !ruby/object:Gem::Version
|
106
|
-
version: '
|
107
|
-
type: :development
|
108
|
-
prerelease: false
|
109
|
-
version_requirements: !ruby/object:Gem::Requirement
|
110
|
-
requirements:
|
111
|
-
- - "~>"
|
112
|
-
- !ruby/object:Gem::Version
|
113
|
-
version: '1.17'
|
114
|
-
- !ruby/object:Gem::Dependency
|
115
|
-
name: rubocop
|
116
|
-
requirement: !ruby/object:Gem::Requirement
|
117
|
-
requirements:
|
118
|
-
- - "~>"
|
119
|
-
- !ruby/object:Gem::Version
|
120
|
-
version: 0.24.1
|
126
|
+
version: '3.3'
|
121
127
|
type: :development
|
122
128
|
prerelease: false
|
123
129
|
version_requirements: !ruby/object:Gem::Requirement
|
124
130
|
requirements:
|
125
131
|
- - "~>"
|
126
132
|
- !ruby/object:Gem::Version
|
127
|
-
version:
|
133
|
+
version: '3.3'
|
128
134
|
- !ruby/object:Gem::Dependency
|
129
|
-
name:
|
135
|
+
name: vcr
|
130
136
|
requirement: !ruby/object:Gem::Requirement
|
131
137
|
requirements:
|
132
138
|
- - "~>"
|
133
139
|
- !ruby/object:Gem::Version
|
134
|
-
version: '
|
140
|
+
version: '6.0'
|
135
141
|
type: :development
|
136
142
|
prerelease: false
|
137
143
|
version_requirements: !ruby/object:Gem::Requirement
|
138
144
|
requirements:
|
139
145
|
- - "~>"
|
140
146
|
- !ruby/object:Gem::Version
|
141
|
-
version: '
|
142
|
-
description:
|
147
|
+
version: '6.0'
|
148
|
+
description:
|
143
149
|
email:
|
144
150
|
- bforma@zilverline.com
|
145
151
|
- mfranken@zilverline.com
|
@@ -149,10 +155,9 @@ executables: []
|
|
149
155
|
extensions: []
|
150
156
|
extra_rdoc_files: []
|
151
157
|
files:
|
158
|
+
- ".github/workflows/rspec.yml"
|
152
159
|
- ".gitignore"
|
153
|
-
- ".rubocop.yml"
|
154
160
|
- ".ruby-version"
|
155
|
-
- ".travis.yml"
|
156
161
|
- Gemfile
|
157
162
|
- LICENSE.txt
|
158
163
|
- README.md
|
@@ -161,12 +166,33 @@ files:
|
|
161
166
|
- lib/jortt.rb
|
162
167
|
- lib/jortt/client.rb
|
163
168
|
- lib/jortt/client/customers.rb
|
164
|
-
- lib/jortt/client/
|
169
|
+
- lib/jortt/client/error.rb
|
165
170
|
- lib/jortt/client/invoices.rb
|
171
|
+
- lib/jortt/client/ledger_accounts.rb
|
166
172
|
- lib/jortt/client/version.rb
|
173
|
+
- spec/fixtures/vcr_cassettes/Jortt/_client/1_1_1.yml
|
174
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client/configured/_customers/1_1_1_1.yml
|
175
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client/configured/_invoices/1_1_2_1.yml
|
176
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client/configured/_ledger_accounts/1_1_3_1.yml
|
177
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_Customers/_create/faulty_payload/shows_a_nice_error.yml
|
178
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_Customers/_create/valid_payload/creates_the_customer.yml
|
179
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_Customers/_delete/deletes_the_customer.yml
|
180
|
+
- 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
|
181
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_Customers/_index/query/returns_the_queried_customers.yml
|
182
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_Customers/_index/without_params/returns_customers.yml
|
183
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_Customers/_show/returns_the_customer.yml
|
184
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_Customers/_update/updates_the_customer.yml
|
185
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_Customers/_vat_percentages/returns_the_vat_percentages.yml
|
186
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_Invoices/_create/creates_the_invoice.yml
|
187
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_Invoices/_credit/credits_the_invoice.yml
|
188
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_Invoices/_download/returns_the_invoice_download_link.yml
|
189
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_Invoices/_index/invoice_status/returns_those_invoices.yml
|
190
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_Invoices/_index/query/returns_the_queried_invoices.yml
|
191
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_Invoices/_show/returns_the_invoice.yml
|
192
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_LedgerAccounts/_index/returns_invoices.yml
|
167
193
|
- spec/jortt/client/customers_spec.rb
|
168
|
-
- spec/jortt/client/invoice_spec.rb
|
169
194
|
- spec/jortt/client/invoices_spec.rb
|
195
|
+
- spec/jortt/client/ledger_accounts_spec.rb
|
170
196
|
- spec/jortt/client_spec.rb
|
171
197
|
- spec/jortt_spec.rb
|
172
198
|
- spec/spec_helper.rb
|
@@ -174,7 +200,7 @@ homepage: https://app.jortt.nl/api-documentatie
|
|
174
200
|
licenses:
|
175
201
|
- MIT
|
176
202
|
metadata: {}
|
177
|
-
post_install_message:
|
203
|
+
post_install_message:
|
178
204
|
rdoc_options: []
|
179
205
|
require_paths:
|
180
206
|
- lib
|
@@ -189,16 +215,34 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
215
|
- !ruby/object:Gem::Version
|
190
216
|
version: '0'
|
191
217
|
requirements: []
|
192
|
-
|
193
|
-
|
194
|
-
signing_key:
|
218
|
+
rubygems_version: 3.2.3
|
219
|
+
signing_key:
|
195
220
|
specification_version: 4
|
196
221
|
summary: jortt.nl REST API client
|
197
222
|
test_files:
|
223
|
+
- spec/fixtures/vcr_cassettes/Jortt/_client/1_1_1.yml
|
224
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client/configured/_customers/1_1_1_1.yml
|
225
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client/configured/_invoices/1_1_2_1.yml
|
226
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client/configured/_ledger_accounts/1_1_3_1.yml
|
227
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_Customers/_create/faulty_payload/shows_a_nice_error.yml
|
228
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_Customers/_create/valid_payload/creates_the_customer.yml
|
229
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_Customers/_delete/deletes_the_customer.yml
|
230
|
+
- 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
|
231
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_Customers/_index/query/returns_the_queried_customers.yml
|
232
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_Customers/_index/without_params/returns_customers.yml
|
233
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_Customers/_show/returns_the_customer.yml
|
234
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_Customers/_update/updates_the_customer.yml
|
235
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_Customers/_vat_percentages/returns_the_vat_percentages.yml
|
236
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_Invoices/_create/creates_the_invoice.yml
|
237
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_Invoices/_credit/credits_the_invoice.yml
|
238
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_Invoices/_download/returns_the_invoice_download_link.yml
|
239
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_Invoices/_index/invoice_status/returns_those_invoices.yml
|
240
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_Invoices/_index/query/returns_the_queried_invoices.yml
|
241
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_Invoices/_show/returns_the_invoice.yml
|
242
|
+
- spec/fixtures/vcr_cassettes/Jortt_Client_LedgerAccounts/_index/returns_invoices.yml
|
198
243
|
- spec/jortt/client/customers_spec.rb
|
199
|
-
- spec/jortt/client/invoice_spec.rb
|
200
244
|
- spec/jortt/client/invoices_spec.rb
|
245
|
+
- spec/jortt/client/ledger_accounts_spec.rb
|
201
246
|
- spec/jortt/client_spec.rb
|
202
247
|
- spec/jortt_spec.rb
|
203
248
|
- spec/spec_helper.rb
|
204
|
-
has_rdoc:
|
data/.rubocop.yml
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require: rubocop-rspec
|
2
|
-
|
3
|
-
Style/AccessModifierIndentation:
|
4
|
-
EnforcedStyle: outdent
|
5
|
-
|
6
|
-
Style/AlignParameters:
|
7
|
-
EnforcedStyle: with_fixed_indentation
|
8
|
-
|
9
|
-
Style/DotPosition:
|
10
|
-
EnforcedStyle: trailing
|
11
|
-
|
12
|
-
Style/TrailingComma:
|
13
|
-
EnforcedStyleForMultiline: comma
|
14
|
-
|
15
|
-
Style/EmptyLinesAroundBody:
|
16
|
-
Description: "Keeps track of empty lines around expression bodies."
|
17
|
-
Enabled: false
|
18
|
-
|
19
|
-
Style/RegexpLiteral:
|
20
|
-
MaxSlashes: 0
|
21
|
-
|
22
|
-
Style/HashSyntax:
|
23
|
-
EnforcedStyle: ruby19
|
24
|
-
|
25
|
-
Style/SpaceInsideHashLiteralBraces:
|
26
|
-
EnforcedStyle: no_space
|
data/.travis.yml
DELETED
data/lib/jortt/client/invoice.rb
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
require 'rest-client'
|
3
|
-
|
4
|
-
module Jortt # :nodoc:
|
5
|
-
class Client # :nodoc:
|
6
|
-
|
7
|
-
##
|
8
|
-
# Exposes the operations available for a single invoice.
|
9
|
-
#
|
10
|
-
# @see { Jortt::Client.invoice }
|
11
|
-
class Invoice
|
12
|
-
|
13
|
-
def initialize(config, id)
|
14
|
-
@config = config
|
15
|
-
@id = id
|
16
|
-
end
|
17
|
-
|
18
|
-
##
|
19
|
-
# Sends an Invoice using the POST /invoices/id/:invoice_id/send endpoint.
|
20
|
-
#
|
21
|
-
# @example
|
22
|
-
# Jortt::Client.invoice(:invoice_id).send(
|
23
|
-
# mail_data: {
|
24
|
-
# to: 'ben@jortt.nl', # optional
|
25
|
-
# subject: 'Thank you for your assignment', # optional
|
26
|
-
# body: 'I hereby send you the invoice', # optional
|
27
|
-
# },
|
28
|
-
# invoice_date: Date.today, # optional
|
29
|
-
# payment_term: 7, # optional
|
30
|
-
# language: 'nl', # optional
|
31
|
-
# send_method: 'email', # optional
|
32
|
-
# )
|
33
|
-
def send_invoice(payload = {})
|
34
|
-
resource = RestClient::Resource.new(
|
35
|
-
"#{config.base_url}/invoices/id/#{id}/send",
|
36
|
-
user: config.app_name,
|
37
|
-
password: config.api_key,
|
38
|
-
)
|
39
|
-
resource.post(JSON.generate(payload)) do |response|
|
40
|
-
JSON.parse(response.body)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
private
|
45
|
-
|
46
|
-
attr_reader :config, :id
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe Jortt::Client::Invoice do
|
5
|
-
let(:invoice) do
|
6
|
-
described_class.new(
|
7
|
-
double(base_url: 'foo', app_name: 'app', api_key: 'secret'),
|
8
|
-
'bar',
|
9
|
-
)
|
10
|
-
end
|
11
|
-
|
12
|
-
describe '#send_invoice' do
|
13
|
-
let(:request_body) { JSON.generate(mail_data: {to: 'ben@jortt.nl'}) }
|
14
|
-
let(:response_body) { JSON.generate(invoice_number: '2016-001') }
|
15
|
-
subject { invoice.send_invoice(mail_data: {to: 'ben@jortt.nl'}) }
|
16
|
-
before do
|
17
|
-
stub_request(:post, 'http://app:secret@foo/invoices/id/bar/send').
|
18
|
-
with(body: request_body).
|
19
|
-
to_return(status: 200, body: response_body)
|
20
|
-
end
|
21
|
-
it { should eq('invoice_number' => '2016-001') }
|
22
|
-
end
|
23
|
-
end
|