Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

europe

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

europe

  • 0.0.22
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Europe gem logo

Europe :eu:

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.

Table of Contents

Installation

Add this line to your application's Gemfile:

gem 'europe'

And then execute:

$ bundle

Or install it yourself as:

$ gem install europe

Usage

There are several calls you can make with this gem. Below are a few examples where this gem can be used for.

Validating VAT numbers

** Updated: Parameter now consists of one value.** Call to validate VAT number (always starts with country code as specified in VIES)

Europe::Vat.validate('NL009291477B01')

Response

{ :country_code => "NL",
  :vat_number => "009291477B01",
  :request_date => #<Date: 2015-12-15 ((2457372j,0s,0n),+0s,2299161j)>,
  :valid => true,
  :name => "KONINKLIJKE POSTNL B.V.",
  :address => nil }

Validate VAT number format

Call

Europe::Vat::Format.validate('NL123456789B01')

Response

=> true

Validate Postal Code format

Call

Europe::Postal.validate('NL', '1000 AP')

Response

=> true

Retrieving VAT rates for each EC/EU member

Call

Europe::Vat::Rates.retrieve

Response

{  :AT=>20.0,
   :BE=>21.0,
   :BG=>20.0,
   :CY=>19.0,
   :CZ=>21.0,
   :DE=>19.0,
   :DK=>25.0,
   # etc...

Retrieving currency exchange rates

Call

Europe::Currency::ExchangeRates.retrieve

Response

{  :date=>#<Date: 2015-12-15 ((2457372j,0s,0n),+0s,2299161j)>,
   :rates=>
   { :USD=>1.099,
     :JPY=>132.97,
     :BGN=>1.9558,
     :CZK=>27.022,
     :DKK=>7.4614,
     :GBP=>0.7252,
     # etc...

Retrieving currency information

Call

Europe::Currency::CURRENCIES

Response

CURRENCIES = {
  EUR: { name: 'Euro', symbol: '€', html: '&euro;' },
  BGN: { name: 'Lev', symbol: 'лв', html: '&#1083;&#1074;' },
  # etc...

Retrieving country information

Call

Europe::Countries::COUNTRIES

Response

{
 :BE=>
  {:name=>"Belgium",
   :source_name=>"Belgique/België",
   :official_name=>"Kingdom of Belgium",
   :tld=>".be",
   :currency=>:EUR,
   :capital=>"Brussels"},
 :BG=>
  {:name=>"Bulgaria",
   :source_name=>"България",
   :official_name=>"Republic of Bulgaria",
   :tld=>".bg",
   :currency=>:BGN,
   :capital=>"Sofia"},
 # etc...

Retrieving country information reversed

Call with optional parameters (name, currency, source_name, official_name, tld, currency and capital)

Europe::Countries::Reversed.generate('name')

Response

{  "Belgium" => :BE,
   "Bulgaria" => :BG,
   "Czech Republic" => :CZ,
   "Denmark" => :DK,
   "Germany" => :DE,
   "Estonia" => :EE,
   # etc...

Compatibility

This gem is tested with the following Ruby versions on Linux and Mac OS X:

  • Ruby > 2.2.2

Todo

Contributing

  1. Fork it ( https://github.com/gem-shards/europe.rb/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

FAQs

Package last updated on 20 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc