quaderno 1.6.1 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +42 -1
- data/VERSION +1 -1
- data/changelog.md +8 -1
- data/lib/quaderno-ruby/behavior/crud.rb +1 -1
- data/lib/quaderno-ruby/exceptions/exceptions.rb +1 -1
- data/lib/quaderno-ruby/recurring.rb +8 -0
- data/lib/quaderno-ruby.rb +1 -1
- data/quaderno.gemspec +4 -3
- data/test/unit/test_quaderno_estimates.rb +1 -1
- data/test/unit/test_quaderno_invoices.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bca4eb12a813d217d7bfdb17a51adae185c35aa5
|
4
|
+
data.tar.gz: b31d19f51e8459874f9396e58dd9211a73f5d45e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a57d5344bb40962831c8cc559a42b380f63729103aa2bc9a3f9afc5ce42fdbc74c195b9c3a419c193b763cfd741da3f282c16807f58a03064a8171605976feb9
|
7
|
+
data.tar.gz: cbb1a82722e9951ebec35812e58d16b7be184b893d7848b9d6a3bce4d6a72a67316ab0330c1f09bf0310376fe1e87cd974fcaeebf0e246b5179e4207eaaa2c91
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Quaderno-ruby is a ruby wrapper for [Quaderno API] (https://github.com/quaderno/quaderno-api).
|
4
4
|
As the API, it's mostly CRUD.
|
5
5
|
|
6
|
-
Current version is 1.
|
6
|
+
Current version is 1.7.0 See the changelog [here](https://github.com/quaderno/quaderno-ruby/blob/master/changelog.md)
|
7
7
|
|
8
8
|
## Installation & Configuration
|
9
9
|
|
@@ -389,6 +389,47 @@ will update the specified expense with the data of the hash passed as second par
|
|
389
389
|
will delete the expense with the id passed as parameter.
|
390
390
|
|
391
391
|
|
392
|
+
## Managing recurrings
|
393
|
+
|
394
|
+
### Getting recurrings
|
395
|
+
```ruby
|
396
|
+
Quaderno::Recurring.all #=> Array
|
397
|
+
Quaderno::Recurring.all(page: 1) #=> Array
|
398
|
+
```
|
399
|
+
|
400
|
+
will return an array with all your recurring notes on the first page. You can also pass query strings using the attribute :q in order to filter the results by contact name, :state to filter by state or :date to filter by date
|
401
|
+
|
402
|
+
### Finding an recurring
|
403
|
+
```ruby
|
404
|
+
Quaderno::Recurring.find(id) #=> Quaderno::Recurring
|
405
|
+
```
|
406
|
+
|
407
|
+
will return the recurring with the id passed as parameter.
|
408
|
+
|
409
|
+
### Creating a new recurring
|
410
|
+
|
411
|
+
```ruby
|
412
|
+
Quaderno::Recurring.create(params) #=> Quaderno::Recurring
|
413
|
+
```
|
414
|
+
|
415
|
+
will create an recurring using the information of the hash passed as parameter.
|
416
|
+
|
417
|
+
### Updating an existing recurring
|
418
|
+
```ruby
|
419
|
+
Quaderno::Recurring.update(id, params) #=> Quaderno::Recurring
|
420
|
+
```
|
421
|
+
|
422
|
+
will update the specified recurring with the data of the hash passed as second parameter.
|
423
|
+
|
424
|
+
### Deleting an recurring
|
425
|
+
|
426
|
+
```ruby
|
427
|
+
Quaderno::Recurring.delete(id) #=> Boolean
|
428
|
+
```
|
429
|
+
|
430
|
+
will delete the recurring with the id passed as parameter.
|
431
|
+
|
432
|
+
|
392
433
|
## Managing webhooks
|
393
434
|
|
394
435
|
### Getting webhooks
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.7.0
|
data/changelog.md
CHANGED
@@ -13,7 +13,7 @@ module Quaderno
|
|
13
13
|
# Parse nested elements of a document
|
14
14
|
def parse(element)
|
15
15
|
payments_collection = []
|
16
|
-
element['payments'].each do |payment|
|
16
|
+
(element['payments'] || []).each do |payment|
|
17
17
|
payments_collection << api_model.to_instance(Quaderno::Payment, payment)
|
18
18
|
end unless api_model == Quaderno::Estimate
|
19
19
|
element['payments'] = payments_collection
|
@@ -37,7 +37,7 @@ module Quaderno
|
|
37
37
|
raise(Quaderno::Exceptions::InvalidID, "Invalid #{ api_model } instance identifier") if (party_response.response.class == Net::HTTPInternalServerError) || (party_response.response.class == Net::HTTPNotFound)
|
38
38
|
end
|
39
39
|
if params[:required_fields].nil? == false
|
40
|
-
raise(Quaderno::Exceptions::
|
40
|
+
raise(Quaderno::Exceptions::RequiredFieldsEmptyOrInvalid, "#{ JSON::parse party_response.body }") if party_response.response.class == Net::HTTPUnprocessableEntity
|
41
41
|
end
|
42
42
|
if params[:has_documents].nil? == false
|
43
43
|
raise(Quaderno::Exceptions::HasAssociatedDocuments, "#{ JSON::parse party_response.body }") if party_response.response.class == Net::HTTPClientError
|
data/lib/quaderno-ruby.rb
CHANGED
@@ -2,7 +2,7 @@ require 'ostruct'
|
|
2
2
|
|
3
3
|
require 'quaderno-ruby/exceptions/exceptions'
|
4
4
|
%w(crud deliver payment).each { |filename| require "quaderno-ruby/behavior/#{ filename }" }
|
5
|
-
%w(base contact item invoice credit estimate expense document_item payment webhook tax).each { |filename| require "quaderno-ruby/#{ filename }" }
|
5
|
+
%w(base contact item invoice credit estimate expense recurring document_item payment webhook tax).each { |filename| require "quaderno-ruby/#{ filename }" }
|
6
6
|
|
7
7
|
module Quaderno
|
8
8
|
|
data/quaderno.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: quaderno 1.
|
5
|
+
# stub: quaderno 1.7.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "quaderno"
|
9
|
-
s.version = "1.
|
9
|
+
s.version = "1.7.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Recrea"]
|
14
|
-
s.date = "2015-
|
14
|
+
s.date = "2015-05-13"
|
15
15
|
s.description = " A ruby wrapper for Quaderno API "
|
16
16
|
s.email = "carlos@recrea.es"
|
17
17
|
s.extra_rdoc_files = [
|
@@ -42,6 +42,7 @@ Gem::Specification.new do |s|
|
|
42
42
|
"lib/quaderno-ruby/invoice.rb",
|
43
43
|
"lib/quaderno-ruby/item.rb",
|
44
44
|
"lib/quaderno-ruby/payment.rb",
|
45
|
+
"lib/quaderno-ruby/recurring.rb",
|
45
46
|
"lib/quaderno-ruby/tax.rb",
|
46
47
|
"lib/quaderno-ruby/webhook.rb",
|
47
48
|
"quaderno.gemspec",
|
@@ -118,7 +118,7 @@ class TestQuadernoEstimate < Test::Unit::TestCase
|
|
118
118
|
rate_limit_before = Quaderno::Base.rate_limit_info
|
119
119
|
begin
|
120
120
|
rate_limit_after = estimates.first.deliver
|
121
|
-
rescue Quaderno::Exceptions::
|
121
|
+
rescue Quaderno::Exceptions::RequiredFieldsEmptyOrInvalid
|
122
122
|
rate_limit_after = { remaining: (rate_limit_before[:remaining] - 1) }
|
123
123
|
end
|
124
124
|
assert_equal rate_limit_before[:remaining]-1, rate_limit_after[:remaining]
|
@@ -118,7 +118,7 @@ class TestQuadernoInvoice < Test::Unit::TestCase
|
|
118
118
|
rate_limit_before = Quaderno::Base.rate_limit_info
|
119
119
|
begin
|
120
120
|
rate_limit_after = invoices.first.deliver
|
121
|
-
rescue Quaderno::Exceptions::
|
121
|
+
rescue Quaderno::Exceptions::RequiredFieldsEmptyOrInvalid
|
122
122
|
rate_limit_after = { remaining: (rate_limit_before[:remaining] - 1) }
|
123
123
|
end
|
124
124
|
assert_equal rate_limit_before[:remaining]-1, rate_limit_after[:remaining]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quaderno
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Recrea
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -83,6 +83,7 @@ files:
|
|
83
83
|
- lib/quaderno-ruby/invoice.rb
|
84
84
|
- lib/quaderno-ruby/item.rb
|
85
85
|
- lib/quaderno-ruby/payment.rb
|
86
|
+
- lib/quaderno-ruby/recurring.rb
|
86
87
|
- lib/quaderno-ruby/tax.rb
|
87
88
|
- lib/quaderno-ruby/webhook.rb
|
88
89
|
- quaderno.gemspec
|