quaderno 1.12.0 → 1.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/quaderno-ruby/behavior/block.rb +28 -0
- data/lib/quaderno-ruby/credit.rb +1 -0
- data/lib/quaderno-ruby/expense.rb +1 -0
- data/lib/quaderno-ruby/income.rb +13 -0
- data/lib/quaderno-ruby/invoice.rb +1 -0
- data/lib/quaderno-ruby/receipt.rb +1 -0
- data/lib/quaderno-ruby/tax.rb +48 -8
- data/lib/quaderno-ruby.rb +2 -2
- data/quaderno.gemspec +5 -3
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9ae9abea0d3343d938483cdd28d73d26cfa81d7
|
4
|
+
data.tar.gz: ff96ce978beafeec37db10af8c19ebbc2e08ea79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3476624509e49e4a2a28f49ec3767c0e6456af336291db6f5409c71943e86b6a0d0e4bbb6d8d688034339268a1d3da948f705c37d532635dd8c9782b1e8d0d3
|
7
|
+
data.tar.gz: 966aa6365df9eec3403bbee7504cc7a24f4959e3cb21e216e9ef6c9aaadc1cfb253d7b248809239d08e6cb05ff393e2982353b2cb2bcafae7fb6e33f196b64a7
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.12.
|
1
|
+
1.12.1
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Quaderno
|
2
|
+
module Behavior
|
3
|
+
module Block
|
4
|
+
def self.included(receiver)
|
5
|
+
receiver.send :extend, ClassMethods
|
6
|
+
end
|
7
|
+
|
8
|
+
module ClassMethods
|
9
|
+
include Quaderno::Helpers::Authentication
|
10
|
+
|
11
|
+
def block(id, options = {})
|
12
|
+
authentication = get_authentication(options.merge(api_model: api_model))
|
13
|
+
|
14
|
+
|
15
|
+
response = put("#{authentication[:url]}#{api_model.api_path}/#{id}/block.json",
|
16
|
+
basic_auth: authentication[:basic_auth],
|
17
|
+
headers: version_header.merge(authentication[:headers])
|
18
|
+
)
|
19
|
+
|
20
|
+
check_exception_for(response, { rate_limit: true, subdomain_or_token: true, id: true })
|
21
|
+
doc = response.parsed_response
|
22
|
+
|
23
|
+
new doc
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/quaderno-ruby/credit.rb
CHANGED
data/lib/quaderno-ruby/tax.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
module Quaderno
|
2
|
+
class TaxReport < OpenStruct
|
3
|
+
end
|
4
|
+
|
2
5
|
class Tax < Base
|
3
6
|
api_model Quaderno::Tax
|
4
7
|
api_path 'taxes'
|
@@ -7,17 +10,54 @@ module Quaderno
|
|
7
10
|
undef :all, :find, :create, :update, :delete, :parse_nested
|
8
11
|
end
|
9
12
|
|
10
|
-
def self.calculate(
|
11
|
-
|
12
|
-
|
13
|
-
|
13
|
+
def self.calculate(options = {})
|
14
|
+
authentication = get_authentication(options.merge(api_model: api_model))
|
15
|
+
params = options.delete_if { |k,v| %w(auth_token access_token api_url mode api_model).include? k.to_s }
|
16
|
+
|
17
|
+
response = get("#{authentication[:url]}taxes/calculate.json",
|
18
|
+
query: params,
|
19
|
+
basic_auth: authentication[:basic_auth],
|
20
|
+
headers: authentication[:headers]
|
21
|
+
)
|
22
|
+
|
23
|
+
check_exception_for(response, { rate_limit: true, subdomain_or_token: true, id: true })
|
24
|
+
new response.parsed_response
|
14
25
|
end
|
15
26
|
|
16
|
-
def self.validate_vat_number(country, vat_number)
|
17
|
-
|
18
|
-
|
27
|
+
def self.validate_vat_number(country, vat_number, options = {})
|
28
|
+
authentication = get_authentication(options.merge(api_model: api_model))
|
29
|
+
|
30
|
+
response = get("#{authentication[:url]}taxes/validate.json",
|
31
|
+
query: { country: country, vat_number: vat_number },
|
32
|
+
basic_auth: authentication[:basic_auth],
|
33
|
+
headers: authentication[:headers]
|
34
|
+
)
|
35
|
+
|
36
|
+
check_exception_for(response, { rate_limit: true, subdomain_or_token: true, id: true })
|
37
|
+
|
38
|
+
response.parsed_response['valid']
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.reports(options = {})
|
42
|
+
authentication = get_authentication(options.merge(api_model: api_model))
|
43
|
+
params = options.delete_if { |k,v| %w(auth_token access_token api_url mode api_model).include? k.to_s }
|
44
|
+
|
45
|
+
response = get("#{authentication[:url]}taxes/reports.json",
|
46
|
+
query: params,
|
47
|
+
basic_auth: authentication[:basic_auth],
|
48
|
+
headers: authentication[:headers]
|
49
|
+
)
|
50
|
+
|
51
|
+
array = response.parsed_response
|
52
|
+
collection = Quaderno::Collection.new
|
53
|
+
collection.current_page = response.headers['x-pages-currentpage']
|
54
|
+
collection.total_pages = response.headers['x-pages-totalpages']
|
55
|
+
|
56
|
+
array.each { |report| collection << Quaderno::TaxReport.new(report) }
|
57
|
+
|
58
|
+
check_exception_for(response, { rate_limit: true, subdomain_or_token: true, id: true })
|
19
59
|
|
20
|
-
|
60
|
+
collection
|
21
61
|
end
|
22
62
|
end
|
23
63
|
end
|
data/lib/quaderno-ruby.rb
CHANGED
@@ -4,8 +4,8 @@ require 'quaderno-ruby/exceptions/exceptions'
|
|
4
4
|
require 'quaderno-ruby/helpers/authentication'
|
5
5
|
require 'quaderno-ruby/collection'
|
6
6
|
|
7
|
-
%w(crud deliver payment retrieve).each { |filename| require "quaderno-ruby/behavior/#{filename}" }
|
8
|
-
%w(base contact item invoice receipt credit estimate expense recurring document_item evidence payment webhook tax).each { |filename| require "quaderno-ruby/#{ filename }" }
|
7
|
+
%w(block crud deliver payment retrieve).each { |filename| require "quaderno-ruby/behavior/#{filename}" }
|
8
|
+
%w(base contact item invoice receipt credit income estimate expense recurring document_item evidence payment webhook tax).each { |filename| require "quaderno-ruby/#{ filename }" }
|
9
9
|
|
10
10
|
module Quaderno
|
11
11
|
|
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.12.
|
5
|
+
# stub: quaderno 1.12.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "quaderno"
|
9
|
-
s.version = "1.12.
|
9
|
+
s.version = "1.12.1"
|
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 = "2017-06-
|
14
|
+
s.date = "2017-06-16"
|
15
15
|
s.description = " A ruby wrapper for Quaderno API "
|
16
16
|
s.email = "carlos@recrea.es"
|
17
17
|
s.extra_rdoc_files = [
|
@@ -29,6 +29,7 @@ Gem::Specification.new do |s|
|
|
29
29
|
"changelog.md",
|
30
30
|
"lib/quaderno-ruby.rb",
|
31
31
|
"lib/quaderno-ruby/base.rb",
|
32
|
+
"lib/quaderno-ruby/behavior/block.rb",
|
32
33
|
"lib/quaderno-ruby/behavior/crud.rb",
|
33
34
|
"lib/quaderno-ruby/behavior/deliver.rb",
|
34
35
|
"lib/quaderno-ruby/behavior/payment.rb",
|
@@ -42,6 +43,7 @@ Gem::Specification.new do |s|
|
|
42
43
|
"lib/quaderno-ruby/exceptions/exceptions.rb",
|
43
44
|
"lib/quaderno-ruby/expense.rb",
|
44
45
|
"lib/quaderno-ruby/helpers/authentication.rb",
|
46
|
+
"lib/quaderno-ruby/income.rb",
|
45
47
|
"lib/quaderno-ruby/invoice.rb",
|
46
48
|
"lib/quaderno-ruby/item.rb",
|
47
49
|
"lib/quaderno-ruby/payment.rb",
|
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.12.
|
4
|
+
version: 1.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Recrea
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -70,6 +70,7 @@ files:
|
|
70
70
|
- changelog.md
|
71
71
|
- lib/quaderno-ruby.rb
|
72
72
|
- lib/quaderno-ruby/base.rb
|
73
|
+
- lib/quaderno-ruby/behavior/block.rb
|
73
74
|
- lib/quaderno-ruby/behavior/crud.rb
|
74
75
|
- lib/quaderno-ruby/behavior/deliver.rb
|
75
76
|
- lib/quaderno-ruby/behavior/payment.rb
|
@@ -83,6 +84,7 @@ files:
|
|
83
84
|
- lib/quaderno-ruby/exceptions/exceptions.rb
|
84
85
|
- lib/quaderno-ruby/expense.rb
|
85
86
|
- lib/quaderno-ruby/helpers/authentication.rb
|
87
|
+
- lib/quaderno-ruby/income.rb
|
86
88
|
- lib/quaderno-ruby/invoice.rb
|
87
89
|
- lib/quaderno-ruby/item.rb
|
88
90
|
- lib/quaderno-ruby/payment.rb
|