Nothing has been indexed for 0.1.17 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.

Installation

# Add this to your shard.yml
dependencies:
  europe:
    github: gem-shards/europe.cr
    version: ~> 0.1.17

Then run:

shards install

shard.yml

No shard.yml has been indexed for 0.1.17. You can read it on the repository.

Dependencies

Unknown: the shard.yml for this version has not been read yet.

README

This README is the one indexed from the repository at its latest ref, not from the tag for this version.

GitHub release

Europe.cr :eu:

This shard provides EU governmental data, extracted from various EU / EC websites. With this shard you can validate VAT numbers, retrieve VAT tax rates and currency exchange rates matched to the Euro. How to use this library is pretty straightforward and written below.

Table of Contents

Installation

Add this to your application's shard.yml:

dependencies:
  europe:
    github: gem-shards/europe.cr

Usage

First require the library;

require "europe"

There are several calls you can make with this library. Below are a few examples where this library 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

{ valid: true,
  country_code: "NL",
  vat_number: "009291477B01",
  request_date: "2018-06-16+02:00",
  name: "KONINKLIJKE POSTNL B.V.",
  address: nil }

Validate VAT number format

Call

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

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 => 2018-06-15 00:00:00.0 UTC,
   :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: "€" },
  BGN: { name: "Lev", symbol: "лв", html: "лв" },
  # 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 library is tested with the following Crystal versions on Linux and Mac OS X:

  • 1.6.1
  • 1.5.1
  • 1.5.0
  • 1.4.1
  • 1.2.0
  • 1.0.0

Todo

  • Generate docs
  • Cleanup the code
  • Eurostat integration (http://ec.europa.eu/eurostat/)
  • ..

Contributing

  1. Fork it ( https://github.com/gem-shards/europe.cr/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

Contributors