quaderno 1.13.2 → 1.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +56 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +2 -15
- data/README.md +120 -42
- data/Rakefile +4 -50
- data/changelog.md +67 -41
- data/lib/quaderno-ruby.rb +5 -5
- data/lib/quaderno-ruby/base.rb +112 -107
- data/lib/quaderno-ruby/behavior/block.rb +20 -19
- data/lib/quaderno-ruby/behavior/crud.rb +108 -95
- data/lib/quaderno-ruby/behavior/deliver.rb +20 -18
- data/lib/quaderno-ruby/behavior/payment.rb +38 -34
- data/lib/quaderno-ruby/behavior/retrieve.rb +26 -25
- data/lib/quaderno-ruby/checkout_session.rb +4 -0
- data/lib/quaderno-ruby/collection.rb +1 -0
- data/lib/quaderno-ruby/contact.rb +6 -8
- data/lib/quaderno-ruby/credit.rb +10 -12
- data/lib/quaderno-ruby/document_item.rb +1 -3
- data/lib/quaderno-ruby/estimate.rb +5 -7
- data/lib/quaderno-ruby/evidence.rb +5 -7
- data/lib/quaderno-ruby/exceptions/exceptions.rb +50 -44
- data/lib/quaderno-ruby/expense.rb +6 -8
- data/lib/quaderno-ruby/helpers/authentication.rb +16 -18
- data/lib/quaderno-ruby/helpers/rate_limit.rb +12 -0
- data/lib/quaderno-ruby/income.rb +8 -10
- data/lib/quaderno-ruby/invoice.rb +9 -11
- data/lib/quaderno-ruby/item.rb +3 -6
- data/lib/quaderno-ruby/payment.rb +2 -3
- data/lib/quaderno-ruby/receipt.rb +6 -8
- data/lib/quaderno-ruby/recurring.rb +4 -7
- data/lib/quaderno-ruby/report.rb +67 -29
- data/lib/quaderno-ruby/tax.rb +51 -46
- data/lib/quaderno-ruby/version.rb +3 -0
- data/lib/quaderno-ruby/webhook.rb +3 -5
- data/quaderno.gemspec +28 -148
- metadata +92 -92
- data/Gemfile.lock +0 -91
- data/VERSION +0 -1
- data/test/fixtures/quaderno_cassettes/.DS_Store +0 -0
- data/test/fixtures/quaderno_cassettes/all_contacts.yml +0 -52
- data/test/fixtures/quaderno_cassettes/all_contacts_by_access_token.yml +0 -56
- data/test/fixtures/quaderno_cassettes/all_contacts_by_authentication_token.yml +0 -57
- data/test/fixtures/quaderno_cassettes/all_estimates.yml +0 -52
- data/test/fixtures/quaderno_cassettes/all_expenses.yml +0 -55
- data/test/fixtures/quaderno_cassettes/all_invoices.yml +0 -56
- data/test/fixtures/quaderno_cassettes/all_items.yml +0 -46
- data/test/fixtures/quaderno_cassettes/all_receipts.yml +0 -53
- data/test/fixtures/quaderno_cassettes/all_webhooks.yml +0 -214
- data/test/fixtures/quaderno_cassettes/create_estimate_on_downgraded_API.yml +0 -156
- data/test/fixtures/quaderno_cassettes/create_expense_on_downgraded_API.yml +0 -278
- data/test/fixtures/quaderno_cassettes/create_invoice_on_downgraded_API.yml +0 -159
- data/test/fixtures/quaderno_cassettes/create_receipt_on_downgraded_API.yml +0 -196
- data/test/fixtures/quaderno_cassettes/deleted_contact.yml +0 -187
- data/test/fixtures/quaderno_cassettes/deleted_contact_by_access_token.yml +0 -199
- data/test/fixtures/quaderno_cassettes/deleted_contact_by_authentication_token.yml +0 -199
- data/test/fixtures/quaderno_cassettes/deleted_estimate.yml +0 -187
- data/test/fixtures/quaderno_cassettes/deleted_expense.yml +0 -189
- data/test/fixtures/quaderno_cassettes/deleted_invoice.yml +0 -190
- data/test/fixtures/quaderno_cassettes/deleted_item.yml +0 -128
- data/test/fixtures/quaderno_cassettes/deleted_receipt.yml +0 -223
- data/test/fixtures/quaderno_cassettes/deleted_webhook.yml +0 -257
- data/test/fixtures/quaderno_cassettes/delivered_estimate.yml +0 -136
- data/test/fixtures/quaderno_cassettes/delivered_invoice.yml +0 -143
- data/test/fixtures/quaderno_cassettes/delivered_receipt.yml +0 -140
- data/test/fixtures/quaderno_cassettes/evidence_invoice.yml +0 -98
- data/test/fixtures/quaderno_cassettes/found_contact.yml +0 -95
- data/test/fixtures/quaderno_cassettes/found_contact_by_access_token.yml +0 -99
- data/test/fixtures/quaderno_cassettes/found_contact_by_authentication_token.yml +0 -100
- data/test/fixtures/quaderno_cassettes/found_estimate.yml +0 -97
- data/test/fixtures/quaderno_cassettes/found_expense.yml +0 -99
- data/test/fixtures/quaderno_cassettes/found_invoice.yml +0 -100
- data/test/fixtures/quaderno_cassettes/found_item.yml +0 -91
- data/test/fixtures/quaderno_cassettes/found_receipt.yml +0 -98
- data/test/fixtures/quaderno_cassettes/found_webhook.yml +0 -130
- data/test/fixtures/quaderno_cassettes/new_contact.yml +0 -48
- data/test/fixtures/quaderno_cassettes/new_contact_by_access_token.yml +0 -48
- data/test/fixtures/quaderno_cassettes/new_contact_by_authentication_token.yml +0 -48
- data/test/fixtures/quaderno_cassettes/new_estimate.yml +0 -137
- data/test/fixtures/quaderno_cassettes/new_evidence.yml +0 -48
- data/test/fixtures/quaderno_cassettes/new_expense.yml +0 -189
- data/test/fixtures/quaderno_cassettes/new_invoice.yml +0 -137
- data/test/fixtures/quaderno_cassettes/new_item.yml +0 -48
- data/test/fixtures/quaderno_cassettes/new_receipt.yml +0 -173
- data/test/fixtures/quaderno_cassettes/new_webhook.yml +0 -87
- data/test/fixtures/quaderno_cassettes/paid_expense.yml +0 -98
- data/test/fixtures/quaderno_cassettes/paid_invoice.yml +0 -99
- data/test/fixtures/quaderno_cassettes/rate_limit.yml +0 -46
- data/test/fixtures/quaderno_cassettes/unpay_an_expense.yml +0 -138
- data/test/fixtures/quaderno_cassettes/unpay_an_invoice.yml +0 -138
- data/test/fixtures/quaderno_cassettes/updated_contact.yml +0 -97
- data/test/fixtures/quaderno_cassettes/updated_contact_by_access_token.yml +0 -101
- data/test/fixtures/quaderno_cassettes/updated_contact_by_authentication_token.yml +0 -102
- data/test/fixtures/quaderno_cassettes/updated_estimate.yml +0 -185
- data/test/fixtures/quaderno_cassettes/updated_expense.yml +0 -184
- data/test/fixtures/quaderno_cassettes/updated_invoice.yml +0 -184
- data/test/fixtures/quaderno_cassettes/updated_item.yml +0 -93
- data/test/fixtures/quaderno_cassettes/updated_receipt.yml +0 -220
- data/test/fixtures/quaderno_cassettes/updated_webhook.yml +0 -175
- data/test/fixtures/quaderno_cassettes/validate_invalid_VAT_number.yml +0 -44
- data/test/fixtures/quaderno_cassettes/validate_valid_VAT_number.yml +0 -44
- data/test/helper.rb +0 -32
- data/test/unit/test_quaderno_contacts.rb +0 -83
- data/test/unit/test_quaderno_contacts_thread_safe.rb +0 -104
- data/test/unit/test_quaderno_estimates.rb +0 -155
- data/test/unit/test_quaderno_evidences.rb +0 -41
- data/test/unit/test_quaderno_expenses.rb +0 -162
- data/test/unit/test_quaderno_invoices.rb +0 -177
- data/test/unit/test_quaderno_items.rb +0 -84
- data/test/unit/test_quaderno_receipts.rb +0 -156
- data/test/unit/test_quaderno_tax.rb +0 -46
- data/test/unit/test_quaderno_webhooks.rb +0 -93
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 80ac06b981bcae525ea523aef71452980fba4a7e36bb8beec9bb72b8d3831d5f
|
4
|
+
data.tar.gz: 7130b682ec295ef787559cca17c3a55e7fc7f0343fc6170c25d92ef4d41eb029
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f61d7417b9928b2ebd192a3e113c67b5bc53447049798dfbb4c5bc206a6b1b9968be0245f32a2bc1f684447a076804bf3ff46b0c9c4b231a116702fae221e45d
|
7
|
+
data.tar.gz: c85c55d68a167a7a318d80e054b41ad5d21e64806bf55475a9a118ab9ae1e1add30ddbeac881a420e5d60e22fa83a48d0c89c43c19b9292755a5bc215f26d31a
|
data/.gitignore
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# rcov generated
|
2
|
+
coverage
|
3
|
+
coverage.data
|
4
|
+
|
5
|
+
# rdoc generated
|
6
|
+
rdoc
|
7
|
+
|
8
|
+
# yard generated
|
9
|
+
doc
|
10
|
+
.yardoc
|
11
|
+
|
12
|
+
# bundler
|
13
|
+
.bundle
|
14
|
+
|
15
|
+
Gemfile.lock
|
16
|
+
|
17
|
+
# jeweler generated
|
18
|
+
pkg
|
19
|
+
|
20
|
+
/Gemfile.lock
|
21
|
+
|
22
|
+
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
23
|
+
#
|
24
|
+
# * Create a file at ~/.gitignore
|
25
|
+
# * Include files you want ignored
|
26
|
+
# * Run: git config --global core.excludesfile ~/.gitignore
|
27
|
+
#
|
28
|
+
# After doing this, these files will be ignored in all your git projects,
|
29
|
+
# saving you from having to 'pollute' every project you touch with them
|
30
|
+
#
|
31
|
+
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
32
|
+
#
|
33
|
+
# For MacOS:
|
34
|
+
#
|
35
|
+
#.DS_Store
|
36
|
+
|
37
|
+
# For TextMate
|
38
|
+
#*.tmproj
|
39
|
+
#tmtags
|
40
|
+
|
41
|
+
# For emacs:
|
42
|
+
#*~
|
43
|
+
#\#*
|
44
|
+
#.\#*
|
45
|
+
|
46
|
+
# For vim:
|
47
|
+
#*.swp
|
48
|
+
|
49
|
+
# For redcar:
|
50
|
+
#.redcar
|
51
|
+
|
52
|
+
# For rubinius:
|
53
|
+
#*.rbc
|
54
|
+
|
55
|
+
*.gem
|
56
|
+
pkg/*
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
CHANGED
@@ -1,17 +1,4 @@
|
|
1
1
|
source 'http://rubygems.org'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
group :development do
|
6
|
-
gem 'jeweler', '~> 2.0.1'
|
7
|
-
gem 'rdoc', '~> 3.12'
|
8
|
-
end
|
9
|
-
|
10
|
-
group :test do
|
11
|
-
gem 'bundler', '>= 1.0.0'
|
12
|
-
gem 'fakeweb'
|
13
|
-
gem 'minitest', '~> 4.7.5 '
|
14
|
-
gem 'simplecov', '>= 0'
|
15
|
-
gem 'shoulda', '>= 0'
|
16
|
-
gem 'vcr', :require => 'vcr'
|
17
|
-
end
|
3
|
+
# Specify your gem's dependencies in valabn.gemspec
|
4
|
+
gemspec
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Quaderno-ruby is a ruby wrapper for [Quaderno API] (https://github.com/quaderno/quaderno-api).
|
4
4
|
|
5
|
-
Current version is 1.
|
5
|
+
Current version is 1.17.0 See the changelog [here](https://github.com/quaderno/quaderno-ruby/blob/master/changelog.md)
|
6
6
|
|
7
7
|
## Installation & Configuration
|
8
8
|
|
@@ -29,8 +29,8 @@ To configure just add this to your initializers
|
|
29
29
|
You can get your account subdomain by grabbing it from your account url or by calling the authorization method with your personal api token.
|
30
30
|
|
31
31
|
```ruby
|
32
|
-
Quaderno::Base.authorization 'my_authenticate_token', environment
|
33
|
-
# => {"
|
32
|
+
response = Quaderno::Base.authorization 'my_authenticate_token', environment #=> Quaderno::Base
|
33
|
+
response.identity # => {"id"=>737000, "name"=>"Walter White", "email"=>"cooking@br.bd", "href"=>"https://my_subdomain.quadernoapp.com/api/"}
|
34
34
|
```
|
35
35
|
|
36
36
|
`environment` is an optional argument. By passing `:sandbox`, you will retrieve your credentials for the sandbox environment and not for production.
|
@@ -41,19 +41,48 @@ This will return a hash with the information about your api url, which includes
|
|
41
41
|
You can ping the service in order to check if it is up with:
|
42
42
|
|
43
43
|
```ruby
|
44
|
-
Quaderno::Base.ping #=>
|
44
|
+
response = Quaderno::Base.ping #=> Quaderno::Base
|
45
|
+
|
46
|
+
response.status #=> Boolean
|
45
47
|
```
|
46
48
|
|
47
|
-
This will return true if the service is up or false if it is not.
|
49
|
+
This will return `status: true` if the service is up or `status: false` if it is not.
|
48
50
|
|
49
51
|
## Check the rate limit
|
50
52
|
|
51
53
|
```ruby
|
52
|
-
Quaderno::Base.
|
54
|
+
response = Quaderno::Base.ping #=> Quaderno::Base
|
55
|
+
response.rate_limit_info #=> { :reset=> 4, :remaining=> 0 }
|
56
|
+
|
53
57
|
```
|
54
58
|
|
55
59
|
This will return a hash with information about the seconds until the rate limit reset and your remaining requests per minute ([check the API documentation for more information](https://github.com/quaderno/quaderno-api#rate-limiting)).
|
56
60
|
|
61
|
+
You can also check the rate limit for each request by checking the `rate_limit_info` method on the response:
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
|
65
|
+
invoices = Quaderno::Invoice.all #=> Quaderno::Collection
|
66
|
+
invoices.rate_limit_info #=> {:reset=> 5, :remaning=>6}
|
67
|
+
|
68
|
+
invoice = Quaderno::Invoice.find INVOICE_ID #=> Quaderno::Invoice
|
69
|
+
invoice.rate_limit_info #=> {:reset=>4, :remaining=>5}
|
70
|
+
|
71
|
+
result = invoice.deliver #=> Quaderno::Base
|
72
|
+
result.rate_limit_info #=> {:reset=>3, :remaining=>4}
|
73
|
+
|
74
|
+
begin
|
75
|
+
deleted_invoice = Quaderno::Invoice.delete(ANOTHER_INVOICE_ID) #=> Quaderno::Invoice
|
76
|
+
rescue Quaderno::Exceptions::InvalidSubdomainOrToken => e
|
77
|
+
# If the exception is triggered you can check the rate limit on the raised exception
|
78
|
+
e.rate_limit_info #=> {:reset=>2, :remaining=>3}
|
79
|
+
end
|
80
|
+
|
81
|
+
deleted_invoice.rate_limit_info #=> {:reset=>2, :remaining=>3}
|
82
|
+
|
83
|
+
# etc.
|
84
|
+
```
|
85
|
+
|
57
86
|
## Reading the values
|
58
87
|
|
59
88
|
Quaderno-ruby parses all the json responses in human readable data, so you can access each value just like this:
|
@@ -69,7 +98,7 @@ Quaderno-ruby parses all the json responses in human readable data, so you can a
|
|
69
98
|
|
70
99
|
### Getting contacts
|
71
100
|
```ruby
|
72
|
-
Quaderno::Contact.all
|
101
|
+
Quaderno::Contact.all #=> Array
|
73
102
|
Quaderno::Contact.all(page: 1) #=> Array
|
74
103
|
```
|
75
104
|
|
@@ -111,16 +140,16 @@ will update the specified contact with the data of the hash passed as second par
|
|
111
140
|
|
112
141
|
### Deleting a contact
|
113
142
|
```ruby
|
114
|
-
Quaderno::Contact.delete(id) #=>
|
143
|
+
Quaderno::Contact.delete(id) #=> Quaderno::Contact
|
115
144
|
```
|
116
145
|
|
117
|
-
will delete the contact with the id passed as parameter.
|
146
|
+
will delete the contact with the id passed as parameter. If the deletion was successful, an instance of `Quaderno::Contact` with the `deleted` attribute set to `true` will be returned.
|
118
147
|
|
119
148
|
## Managing items
|
120
149
|
|
121
150
|
### Getting items
|
122
151
|
```ruby
|
123
|
-
Quaderno::Item.all
|
152
|
+
Quaderno::Item.all #=> Array
|
124
153
|
```
|
125
154
|
|
126
155
|
will return an array with all your items.
|
@@ -148,10 +177,10 @@ will update the specified item with the data of the hash passed as second parame
|
|
148
177
|
|
149
178
|
### Deleting an item
|
150
179
|
```ruby
|
151
|
-
Quaderno::Item.delete(id) #=>
|
180
|
+
Quaderno::Item.delete(id) #=> Quaderno::Item
|
152
181
|
```
|
153
182
|
|
154
|
-
will delete the item with the id passed as parameter.
|
183
|
+
will delete the item with the id passed as parameter. If the deletion was successful, an instance of `Quaderno::Item` with the `deleted` attribute set to `true` will be returned.
|
155
184
|
|
156
185
|
|
157
186
|
## Managing invoices
|
@@ -196,10 +225,10 @@ will update the specified invoice with the data of the hash passed as second par
|
|
196
225
|
### Deleting an invoice
|
197
226
|
|
198
227
|
```ruby
|
199
|
-
Quaderno::Invoice.delete(id) #=>
|
228
|
+
Quaderno::Invoice.delete(id) #=> Quaderno::Invoice
|
200
229
|
```
|
201
230
|
|
202
|
-
will delete the invoice with the id passed as parameter.
|
231
|
+
will delete the invoice with the id passed as parameter. If the deletion was successful, an instance of `Quaderno::Item` with the `deleted` attribute set to `true` will be returned.
|
203
232
|
|
204
233
|
|
205
234
|
###Adding or removing a payment
|
@@ -219,13 +248,15 @@ In order to remove a payment you will need the Invoice instance you want to upd
|
|
219
248
|
invoice.remove_payment(payment_id) #=> Boolean
|
220
249
|
```
|
221
250
|
|
222
|
-
###Delivering the invoice
|
251
|
+
### Delivering the invoice
|
223
252
|
|
224
253
|
In order to deliver the invoice to the default recipient you will need the invoice you want to send.
|
225
254
|
|
226
255
|
```ruby
|
227
256
|
invoice = Quaderno::Invoice.find(invoice_id)
|
228
|
-
invoice.deliver
|
257
|
+
result = invoice.deliver #=> Quaderno::Base
|
258
|
+
|
259
|
+
result.success #=> Boolean
|
229
260
|
```
|
230
261
|
|
231
262
|
## Managing receipts
|
@@ -263,18 +294,20 @@ will update the specified receipt with the data of the hash passed as second par
|
|
263
294
|
### Deleting an receipt
|
264
295
|
|
265
296
|
```ruby
|
266
|
-
Quaderno::Receipt.delete(id) #=>
|
297
|
+
Quaderno::Receipt.delete(id) #=> Quaderno::Receipt
|
267
298
|
```
|
268
299
|
|
269
|
-
will delete the receipt with the id passed as parameter.
|
300
|
+
will delete the receipt with the id passed as parameter. If the deletion was successful, an instance of `Quaderno::Receipt` with the `deleted` attribute set to `true` will be returned.
|
270
301
|
|
271
|
-
###Delivering the receipt
|
302
|
+
### Delivering the receipt
|
272
303
|
|
273
304
|
In order to deliver the receipt to the default recipient you will need the receipt you want to send.
|
274
305
|
|
275
306
|
```ruby
|
276
307
|
receipt = Quaderno::Receipt.find(receipt_id)
|
277
|
-
receipt.deliver
|
308
|
+
result = receipt.deliver #=> Quaderno::Base
|
309
|
+
|
310
|
+
result.success #=> Boolean
|
278
311
|
```
|
279
312
|
|
280
313
|
|
@@ -319,13 +352,13 @@ will update the specified credit with the data of the hash passed as second para
|
|
319
352
|
### Deleting a credit
|
320
353
|
|
321
354
|
```ruby
|
322
|
-
Quaderno::Credit.delete(id) #=>
|
355
|
+
Quaderno::Credit.delete(id) #=> Quaderno::Credit
|
323
356
|
```
|
324
357
|
|
325
|
-
will delete the credit with the id passed as parameter.
|
358
|
+
will delete the credit with the id passed as parameter. If the deletion was successful, an instance of `Quaderno::Credit` with the `deleted` attribute set to `true` will be returned.
|
326
359
|
|
327
360
|
|
328
|
-
###Adding or removing a payment
|
361
|
+
### Adding or removing a payment
|
329
362
|
In order to add a payment you will need the Credit instance you want to update.
|
330
363
|
|
331
364
|
```ruby
|
@@ -339,16 +372,20 @@ In order to remove a payment you will need the Credit instance you want to upda
|
|
339
372
|
|
340
373
|
```ruby
|
341
374
|
credit = Quaderno::Credit.find(credit_id)
|
342
|
-
credit.remove_payment(payment_id) #=>
|
375
|
+
credit.remove_payment(payment_id) #=> Quaderno::Payment
|
343
376
|
```
|
344
377
|
|
345
|
-
|
378
|
+
If the deletion was successful, an instance of `Quaderno::Payment` with the `deleted` attribute set to `true` will be returned.
|
379
|
+
|
380
|
+
### Delivering the credit
|
346
381
|
|
347
382
|
In order to deliver the credit to the default recipient you will need the credit you want to send.
|
348
383
|
|
349
384
|
```ruby
|
350
385
|
credit = Quaderno::Credit.find(credit_id)
|
351
|
-
credit.deliver
|
386
|
+
result = credit.deliver #=> Quaderno::Base
|
387
|
+
|
388
|
+
result.success #=> Boolean
|
352
389
|
```
|
353
390
|
|
354
391
|
|
@@ -357,7 +394,7 @@ In order to remove a payment you will need the Credit instance you want to upda
|
|
357
394
|
|
358
395
|
### Getting estimates
|
359
396
|
```ruby
|
360
|
-
Quaderno::Estimate.all
|
397
|
+
Quaderno::Estimate.all #=> Array
|
361
398
|
Quaderno::Estimate.all(page: 1) #=> Array
|
362
399
|
```
|
363
400
|
|
@@ -388,10 +425,10 @@ will update the specified estimate with the data of the hash passed as second pa
|
|
388
425
|
### Deleting an estimate
|
389
426
|
|
390
427
|
```ruby
|
391
|
-
Quaderno::Estimate.delete(id) #=>
|
428
|
+
Quaderno::Estimate.delete(id) #=> Quaderno::Estimate
|
392
429
|
```
|
393
430
|
|
394
|
-
will delete the estimate with the id passed as parameter.
|
431
|
+
will delete the estimate with the id passed as parameter. If the deletion was successful, an instance of `Quaderno::Contact` with the `deleted` attribute set to `true` will be returned.
|
395
432
|
|
396
433
|
|
397
434
|
###Adding or removing a payment
|
@@ -411,12 +448,14 @@ In order to remove a payment you will need the estimate you want to update.
|
|
411
448
|
estimate.remove_payment(payment_id) #=> Boolean
|
412
449
|
```
|
413
450
|
|
414
|
-
###Delivering the estimate
|
451
|
+
### Delivering the estimate
|
415
452
|
In order to deliver the estimate to the default recipient you will need the estimate you want to send.
|
416
453
|
|
417
454
|
```ruby
|
418
455
|
estimate = Quaderno::Estimate.find(estimate_id)
|
419
|
-
estimate.deliver
|
456
|
+
result = estimate.deliver #=> Quaderno::Base
|
457
|
+
|
458
|
+
result.success #=> Boolean
|
420
459
|
```
|
421
460
|
|
422
461
|
|
@@ -424,7 +463,7 @@ In order to remove a payment you will need the estimate you want to update.
|
|
424
463
|
|
425
464
|
### Getting expenses
|
426
465
|
```ruby
|
427
|
-
Quaderno::Expense.all
|
466
|
+
Quaderno::Expense.all #=> Array
|
428
467
|
Quaderno::Expense.all(page: 1) #=> Array
|
429
468
|
```
|
430
469
|
|
@@ -453,10 +492,10 @@ will update the specified expense with the data of the hash passed as second par
|
|
453
492
|
|
454
493
|
### Deleting an expense
|
455
494
|
```ruby
|
456
|
-
Quaderno::Expense.delete(id) #=>
|
495
|
+
Quaderno::Expense.delete(id) #=> Quaderno::Expense
|
457
496
|
```
|
458
497
|
|
459
|
-
will delete the expense with the id passed as parameter.
|
498
|
+
will delete the expense with the id passed as parameter. If the deletion was successful, an instance of `Quaderno::Expense` with the `deleted` attribute set to `true` will be returned.
|
460
499
|
|
461
500
|
|
462
501
|
## Managing recurrings
|
@@ -494,17 +533,17 @@ will update the specified recurring with the data of the hash passed as second p
|
|
494
533
|
### Deleting a recurring
|
495
534
|
|
496
535
|
```ruby
|
497
|
-
Quaderno::Recurring.delete(id) #=>
|
536
|
+
Quaderno::Recurring.delete(id) #=> Quaderno::Recurring
|
498
537
|
```
|
499
538
|
|
500
|
-
will delete the recurring with the id passed as parameter.
|
539
|
+
will delete the recurring with the id passed as parameter. If the deletion was successful, an instance of `Quaderno::Recurring` with the `deleted` attribute set to `true` will be returned.
|
501
540
|
|
502
541
|
|
503
542
|
## Managing webhooks
|
504
543
|
|
505
544
|
### Getting webhooks
|
506
545
|
```ruby
|
507
|
-
Quaderno::Webhook.all
|
546
|
+
Quaderno::Webhook.all #=> Array
|
508
547
|
```
|
509
548
|
|
510
549
|
will return an array with all the webhooks you have subscribed.
|
@@ -532,9 +571,9 @@ will update the specified webhook with the data of the hash passed as second par
|
|
532
571
|
|
533
572
|
### Deleting a webhook
|
534
573
|
```ruby
|
535
|
-
Quaderno::Webhook.delete(id) #=>
|
574
|
+
Quaderno::Webhook.delete(id) #=> Quaderno::Webhook
|
536
575
|
```
|
537
|
-
will delete the webhook with the id passed as parameter.
|
576
|
+
will delete the webhook with the id passed as parameter. If the deletion was successful, an instance of `Quaderno::Webhook` with the `deleted` attribute set to `true` will be returned.
|
538
577
|
|
539
578
|
|
540
579
|
## Taxes
|
@@ -548,10 +587,12 @@ will calculate the taxes applied for a customer based on the data pased as param
|
|
548
587
|
|
549
588
|
### Validate VAT numbers
|
550
589
|
```ruby
|
551
|
-
country = 'IE'
|
552
|
-
vat_number = 'IE6388047V'
|
590
|
+
country = 'IE'
|
591
|
+
vat_number = 'IE6388047V'
|
553
592
|
|
554
|
-
Quaderno::Tax.validate_vat_number(country, vat_number) #=>
|
593
|
+
result = Quaderno::Tax.validate_vat_number(country, vat_number) #=> Quaderno::Tax
|
594
|
+
|
595
|
+
result.valid #=> Boolean or nil
|
555
596
|
```
|
556
597
|
|
557
598
|
will validate the vat number for the passed country.
|
@@ -565,6 +606,43 @@ will validate the vat number for the passed country.
|
|
565
606
|
|
566
607
|
will create an evidence based on the data pased as parameters.
|
567
608
|
|
609
|
+
## Checkout Sessions
|
610
|
+
|
611
|
+
### Getting checkout sessions
|
612
|
+
```ruby
|
613
|
+
Quaderno::CheckoutSession.all #=> Array
|
614
|
+
```
|
615
|
+
|
616
|
+
will return an array with all the checkout sessions in your account.
|
617
|
+
|
618
|
+
### Finding a checkout session
|
619
|
+
```ruby
|
620
|
+
Quaderno::CheckoutSession.find(id) #=> Quaderno::CheckoutSession
|
621
|
+
```
|
622
|
+
|
623
|
+
will return the checkout session with the id passed as parameter.
|
624
|
+
|
625
|
+
### Creating a new checkout session
|
626
|
+
```ruby
|
627
|
+
Quaderno::CheckoutSession.create(params) #=> Quaderno::CheckoutSession
|
628
|
+
```
|
629
|
+
|
630
|
+
will create a checkout session using the information of the hash passed as parameter and return an instance of Quaderno::CheckoutSession with the created checout session.
|
631
|
+
|
632
|
+
### Updating an existing checkout session
|
633
|
+
```ruby
|
634
|
+
Quaderno::CheckoutSession.update(id, params) #=> Quaderno::CheckoutSession
|
635
|
+
```
|
636
|
+
|
637
|
+
will update the specified checkout session with the data of the hash passed as second parameter.
|
638
|
+
|
639
|
+
### Deleting a checkout session
|
640
|
+
```ruby
|
641
|
+
Quaderno::CheckoutSession.delete(id) #=> Quaderno::CheckoutSession
|
642
|
+
```
|
643
|
+
will delete the checkout session with the id passed as parameter. If the deletion was successful, an instance of `Quaderno::CheckoutSession` with the `deleted` attribute set to `true` will be returned.
|
644
|
+
|
645
|
+
|
568
646
|
## Exceptions
|
569
647
|
Quaderno-ruby exceptions raise depending on the type of error:
|
570
648
|
|