quaderno 1.10.0 → 1.11.0
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/README.md +10 -1
- data/VERSION +1 -1
- data/changelog.md +4 -1
- data/lib/quaderno-ruby/tax.rb +7 -0
- data/quaderno.gemspec +5 -3
- data/test/fixtures/quaderno_cassettes/validate_invalid_VAT_number.yml +44 -0
- data/test/fixtures/quaderno_cassettes/validate_valid_VAT_number.yml +44 -0
- data/test/unit/test_quaderno_tax.rb +12 -7
- 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: 0e08e3318d7ae64e36083941a785eb508197abe5
|
4
|
+
data.tar.gz: 7d70ae8fa3bb5580a95a56795dc8b893769f014c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0dcd6d0e616da9dbc7b7f9032c32fc2d5f143d4a60ddb3132f1c4682fbb78091a0be7177e7124ff497ee76d75ce1ae4a5291fdbd4143076830e1b4a7ab7ebd42
|
7
|
+
data.tar.gz: 0a67259df3cb0845cc539b881b21d2fbb1c648c169fca21efad6341542c2307b576ffe0190a07010cad8d99aae5debf39c3b06eb82c53296e2cd5ebbfe7fb4b9
|
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.11.0 See the changelog [here](https://github.com/quaderno/quaderno-ruby/blob/master/changelog.md)
|
7
7
|
|
8
8
|
## Installation & Configuration
|
9
9
|
|
@@ -531,6 +531,15 @@ will delete the webhook with the id passed as parameter.
|
|
531
531
|
|
532
532
|
will calculate the taxes applied for a customer based on the data pased as parameters.
|
533
533
|
|
534
|
+
### Validate VAT numbers
|
535
|
+
```ruby
|
536
|
+
country = 'IE'
|
537
|
+
vat_number = 'IE6388047V'
|
538
|
+
|
539
|
+
Quaderno::Tax.validate_vat_number(country, vat_number) #=> Boolean
|
540
|
+
``
|
541
|
+
|
542
|
+
will validate the vat number for the passed country.
|
534
543
|
|
535
544
|
## Evidences
|
536
545
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.11.0
|
data/changelog.md
CHANGED
data/lib/quaderno-ruby/tax.rb
CHANGED
@@ -12,5 +12,12 @@ module Quaderno
|
|
12
12
|
check_exception_for(party_response, { rate_limit: true, subdomain_or_token: true, id: true })
|
13
13
|
new party_response.parsed_response
|
14
14
|
end
|
15
|
+
|
16
|
+
def self.validate_vat_number(country, vat_number)
|
17
|
+
party_response = get("#{self.url}taxes/validate.json", query: {country: country, vat_number: vat_number}, basic_auth: { username: api_model.auth_token } )
|
18
|
+
check_exception_for(party_response, { rate_limit: true, subdomain_or_token: true, id: true })
|
19
|
+
|
20
|
+
party_response.parsed_response['valid']
|
21
|
+
end
|
15
22
|
end
|
16
23
|
end
|
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.11.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.11.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 = "2016-
|
14
|
+
s.date = "2016-08-30"
|
15
15
|
s.description = " A ruby wrapper for Quaderno API "
|
16
16
|
s.email = "carlos@recrea.es"
|
17
17
|
s.extra_rdoc_files = [
|
@@ -100,6 +100,8 @@ Gem::Specification.new do |s|
|
|
100
100
|
"test/fixtures/quaderno_cassettes/updated_item.yml",
|
101
101
|
"test/fixtures/quaderno_cassettes/updated_receipt.yml",
|
102
102
|
"test/fixtures/quaderno_cassettes/updated_webhook.yml",
|
103
|
+
"test/fixtures/quaderno_cassettes/validate_invalid_VAT_number.yml",
|
104
|
+
"test/fixtures/quaderno_cassettes/validate_valid_VAT_number.yml",
|
103
105
|
"test/fixtures/quaderno_cassettes/wrong_token.yml",
|
104
106
|
"test/helper.rb",
|
105
107
|
"test/unit/test_quaderno_contacts.rb",
|
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://sk_test_B7xXrTspfeGukQqGN1pK@development.lvh.me:3000/api/taxes/validate.json?country=IE&vat_number=IE6388047X
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
authorization:
|
11
|
+
- Basic c2tfdGVzdF9CN3hYclRzcGZlR3VrUXFHTjFwSzo=
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: OK
|
16
|
+
headers:
|
17
|
+
x-frame-options:
|
18
|
+
- ALLOWALL
|
19
|
+
x-ratelimit-limit:
|
20
|
+
- '2000'
|
21
|
+
x-ratelimit-reset:
|
22
|
+
- '14'
|
23
|
+
x-ratelimit-remaining:
|
24
|
+
- '98'
|
25
|
+
content-type:
|
26
|
+
- application/json; charset=utf-8
|
27
|
+
etag:
|
28
|
+
- '"fe2f663bfba92bdd59b4bd0190a146b7"'
|
29
|
+
cache-control:
|
30
|
+
- max-age=0, private, must-revalidate
|
31
|
+
x-request-id:
|
32
|
+
- 21922ced-169f-4a23-ac48-94b3c86d47d7
|
33
|
+
x-runtime:
|
34
|
+
- '0.444012'
|
35
|
+
connection:
|
36
|
+
- close
|
37
|
+
server:
|
38
|
+
- thin
|
39
|
+
body:
|
40
|
+
encoding: UTF-8
|
41
|
+
string: '{"valid":false}'
|
42
|
+
http_version: '1.1'
|
43
|
+
recorded_at: Tue, 30 Aug 2016 10:38:15 GMT
|
44
|
+
recorded_with: VCR 2.9.2
|
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://sk_test_B7xXrTspfeGukQqGN1pK@development.lvh.me:3000/api/taxes/validate.json?country=IE&vat_number=IE6388047V
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
authorization:
|
11
|
+
- Basic c2tfdGVzdF9CN3hYclRzcGZlR3VrUXFHTjFwSzo=
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: OK
|
16
|
+
headers:
|
17
|
+
x-frame-options:
|
18
|
+
- ALLOWALL
|
19
|
+
x-ratelimit-limit:
|
20
|
+
- '2000'
|
21
|
+
x-ratelimit-reset:
|
22
|
+
- '15'
|
23
|
+
x-ratelimit-remaining:
|
24
|
+
- '99'
|
25
|
+
content-type:
|
26
|
+
- application/json; charset=utf-8
|
27
|
+
etag:
|
28
|
+
- '"39837b2fcec9d416bda32e66244da470"'
|
29
|
+
cache-control:
|
30
|
+
- max-age=0, private, must-revalidate
|
31
|
+
x-request-id:
|
32
|
+
- 2153abc6-2f6e-47da-9f37-f4edb50b16a9
|
33
|
+
x-runtime:
|
34
|
+
- '2.047779'
|
35
|
+
connection:
|
36
|
+
- close
|
37
|
+
server:
|
38
|
+
- thin
|
39
|
+
body:
|
40
|
+
encoding: UTF-8
|
41
|
+
string: '{"valid":true}'
|
42
|
+
http_version: '1.1'
|
43
|
+
recorded_at: Tue, 30 Aug 2016 10:38:15 GMT
|
44
|
+
recorded_with: VCR 2.9.2
|
@@ -27,14 +27,19 @@ class TestQuadernoTax < Test::Unit::TestCase
|
|
27
27
|
end
|
28
28
|
|
29
29
|
should 'calculate tax' do
|
30
|
-
VCR.use_cassette('
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
VCR.use_cassette('validate valid VAT number') do
|
31
|
+
vat_number_valid = Quaderno::Tax.validate_vat_number('IE', 'IE6388047V')
|
32
|
+
assert vat_number_valid
|
33
|
+
end
|
34
|
+
|
35
|
+
VCR.use_cassette('validate invalid VAT number') do
|
36
|
+
vat_number_valid = Quaderno::Tax.validate_vat_number('IE', 'IE6388047X')
|
37
|
+
assert !vat_number_valid
|
38
|
+
end
|
39
|
+
end
|
34
40
|
|
35
|
-
|
36
|
-
|
37
|
-
assert tax.rate.zero?
|
41
|
+
should 'validate VAT number' do
|
42
|
+
VCR.use_cassette('calculate tax') do
|
38
43
|
end
|
39
44
|
end
|
40
45
|
end
|
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.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Recrea
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -141,6 +141,8 @@ files:
|
|
141
141
|
- test/fixtures/quaderno_cassettes/updated_item.yml
|
142
142
|
- test/fixtures/quaderno_cassettes/updated_receipt.yml
|
143
143
|
- test/fixtures/quaderno_cassettes/updated_webhook.yml
|
144
|
+
- test/fixtures/quaderno_cassettes/validate_invalid_VAT_number.yml
|
145
|
+
- test/fixtures/quaderno_cassettes/validate_valid_VAT_number.yml
|
144
146
|
- test/fixtures/quaderno_cassettes/wrong_token.yml
|
145
147
|
- test/helper.rb
|
146
148
|
- test/unit/test_quaderno_contacts.rb
|