europe 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1988661d9baa8aa81157d3410e0594db756f5c26
4
- data.tar.gz: c3d31136673ace601aaff0cf31f4738ab8444208
3
+ metadata.gz: 4a0fc2ed7821eb1f8561bdb6421f9921fd23c49a
4
+ data.tar.gz: 59242fee45c24eb9f258ee7bcaaa8882e0ecad56
5
5
  SHA512:
6
- metadata.gz: c9db83e2b89a39d0b5899ae26d51673f15edf98bc56b0f3d84d27648eb0f322b52cd26a33bf7e85c27f084656e365e92b4f7d5cd0e2296a2d30f95ec135c5a0e
7
- data.tar.gz: b1b32e3e0b6bf72e9f49c5532bc1648f505d50f10718a412901fda44293caab8e0401702c061980ce1bdf2323e0aeaaf24c706cf92475d7526eea467bc57773a
6
+ metadata.gz: adf482a84c8abb1906cc19e9d3cff143b96696dc648c31aae191b1720d04ba8bd8d47acbb4dcf3e902ce1520554258149d3acbf8fe5ef2bf5214036209e39f1c
7
+ data.tar.gz: 568c9933adfc50a8de039bbdbb9110e166d254de368cb0dbedd10640e77ca3150fe498793cd33ab481933c259641e97cda56d7aa419b5b97c278695cc4ab431f
data/README.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  This gem provides EU governmental data, extracted from various EU / EC websites. With this gem you can validate VAT numbers, retrieve VAT tax rates and currency exchange rates matched to the Euro. How to use this gem is pretty straightforward and written below.
4
4
 
5
+ ## Table of Contents
6
+ - [Installation](#installation)
7
+ - [Usage](#usage)
8
+ - [Validating VAT numbers](#validating-vat-numbers)
9
+ - [Validate VAT number format](#validate-vat-number-format)
10
+ - [Retrieving VAT rates for each EC/EU member](#retrieving-vat-rates-for-each-eceu-member)
11
+ - [Retrieving currency exchange rates](#retrieving-currency-exchange-rates)
12
+ - [Retrieving currency information](#retrieving-currency-information)
13
+ - [Retrieving country information](#retrieving-country-information)
14
+ - [Retrieving country information reversed](#retrieving-country-information-reversed)
15
+ - [Compatibility](#compatibility)
16
+ - [Todo](#todo)
17
+ - [Contributing](#contributing)
18
+
5
19
  ## Installation
6
20
 
7
21
  Add this line to your application's Gemfile:
@@ -24,9 +38,10 @@ There are several calls you can make with this gem. Below are a few examples
24
38
  where this gem can be used for.
25
39
 
26
40
  ### Validating VAT numbers
27
- Call
41
+ ** Updated: Parameter now consists of one value.**
42
+ Call to validate VAT number (always starts with country code as specified in VIES)
28
43
  ```ruby
29
- Europe::Vat.validate('GB', '440627467')
44
+ Europe::Vat.validate('GB440627467')
30
45
  ```
31
46
  Response
32
47
  ```ruby
@@ -94,9 +109,10 @@ Response
94
109
  CURRENCIES = {
95
110
  EUR: { name: 'Euro', symbol: '€', html: '€' },
96
111
  BGN: { name: 'Lev', symbol: 'лв', html: 'лв' },
112
+ # etc...
97
113
  ```
98
114
 
99
- ## Retrieving country information
115
+ ### Retrieving country information
100
116
  Call
101
117
  ```ruby
102
118
  Europe::Countries::COUNTRIES
@@ -118,7 +134,7 @@ Response
118
134
  :tld=>".bg",
119
135
  :currency=>:BGN,
120
136
  :capital=>"Sofia"},
121
- ...
137
+ # etc...
122
138
  ```
123
139
 
124
140
  ## Retrieving country information reversed
@@ -134,7 +150,7 @@ Response
134
150
  "Denmark" => :DK,
135
151
  "Germany" => :DE,
136
152
  "Estonia" => :EE,
137
- ...
153
+ # etc...
138
154
  ```
139
155
 
140
156
  ## Compatibility
data/europe.gemspec CHANGED
@@ -8,11 +8,11 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Europe::VERSION
9
9
  spec.authors = ['VvanGemert']
10
10
  spec.email = ['vincent@floorplanner.com']
11
- spec.summary = 'Europe is a gem for retrieving and validating' \
11
+ spec.summary = 'Europe is a gem for retrieving and validating ' \
12
12
  'EU government data.'
13
13
  spec.description = 'Europe is a simple library for retrieving ' \
14
14
  'EU government data such as VAT information, ' \
15
- 'VAT validation, currency exchange rates and' \
15
+ 'VAT validation, currency exchange rates and ' \
16
16
  'country information.'
17
17
  spec.homepage = 'https://github.com/VvanGemert/europe'
18
18
  spec.license = 'MIT'
@@ -9,8 +9,8 @@ module Europe
9
9
  WSDL = 'http://ec.europa.eu/taxation_customs/' \
10
10
  'vies/checkVatService.wsdl'
11
11
  NS = 'urn:ec.europa.eu:taxud:vies:services:checkVat:types'
12
- def self.validate(country_code, number)
13
- response = send_request(country_code, number)
12
+ def self.validate(number)
13
+ response = send_request(number[0..1], number[2..-1])
14
14
  return :failed unless response.success?
15
15
  response.body[:check_vat_response].tap { |x| x.delete(:@xmlns) }
16
16
  rescue Savon::SOAPFault => fault
@@ -1,4 +1,4 @@
1
1
  # Europe version
2
2
  module Europe
3
- VERSION = '0.0.3'
3
+ VERSION = '0.0.4'
4
4
  end
@@ -7,22 +7,22 @@ module Europe
7
7
  include Benchmark
8
8
 
9
9
  def test_validation_of_false_vat_number
10
- validate_false_vat = Europe::Vat.validate('NL', '123456789B01')
10
+ validate_false_vat = Europe::Vat.validate('NL123456789B01')
11
11
  assert_equal false, validate_false_vat[:valid]
12
12
  end
13
13
 
14
14
  def test_validation_of_correct_vat_number
15
15
  # PostNL
16
- validate_correct_vat = Europe::Vat.validate('NL', '009291477B01')
16
+ validate_correct_vat = Europe::Vat.validate('NL009291477B01')
17
17
  assert validate_correct_vat[:valid] \
18
18
  unless validate_correct_vat == :fault
19
19
 
20
20
  # Sky
21
- validate_correct_vat = Europe::Vat.validate('GB', '440627467')
21
+ validate_correct_vat = Europe::Vat.validate('GB440627467')
22
22
  assert validate_correct_vat[:valid]
23
23
 
24
24
  # Volkswagen
25
- validate_correct_vat = Europe::Vat.validate('DE', '115235681')
25
+ validate_correct_vat = Europe::Vat.validate('DE115235681')
26
26
  assert validate_correct_vat[:valid]
27
27
  end
28
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: europe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - VvanGemert
@@ -123,7 +123,7 @@ dependencies:
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  description: Europe is a simple library for retrieving EU government data such as
126
- VAT information, VAT validation, currency exchange rates andcountry information.
126
+ VAT information, VAT validation, currency exchange rates and country information.
127
127
  email:
128
128
  - vincent@floorplanner.com
129
129
  executables: []
@@ -180,7 +180,7 @@ rubyforge_project:
180
180
  rubygems_version: 2.4.8
181
181
  signing_key:
182
182
  specification_version: 4
183
- summary: Europe is a gem for retrieving and validatingEU government data.
183
+ summary: Europe is a gem for retrieving and validating EU government data.
184
184
  test_files:
185
185
  - test/europe/countries/country_test.rb
186
186
  - test/europe/currency/currency_test.rb