Low commit activity in last 3 years
No release in over a year
Ruby wrapper for vatlayer by apilayer. This gem depends on the apilayer-ruby-3 gem, which provides a common connection-interface to various services of apilayer.net. See https://apilayer.com/ for more details.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0
~> 0.14
~> 12.1
~> 3.2
~> 3.12
~> 0.22
~> 6.0
~> 3.19

Runtime

 Project Readme

Ruby wrapper for vatlayer of apilayer. See vatlayer.com/ and apilayer.com for more details.

Introduction¶ ↑

This gem is extracted from the previous version of apilayer gem.

While the vat_layer gem focuses on the functionalities offered by vatlayer, it depends on the apilayer gem to configure and create connections to apilayer.net

Installation¶ ↑

Using Bundler¶ ↑

Add apilayer in your Gemfile:

gem "vat_layer"

Run the following in your console:

$ bundle install

Usage¶ ↑

Add to your application¶ ↑

require "vat_layer"

Set up vat_layer¶ ↑

Once you have signed up for vatlayer.com, you will receive an access_key. Then configure your Apilayer::Vat module like this:

Apilayer::Vat.configure do |configs|
  configs.access_key = "my_access_key_123"
  configs.https = true
end

Please note that the https configuration is optional and only available to paid-accounts. If unset, these configuration-values are just nil.

You can always review you configurations with:

Apilayer::Vat.configs

Once your configurations are set, you are ready to go

vatlayer¶ ↑

After setting the access_key for vatlayer, you can use Apilayer::Vat to call vatlayer’s API

Apilayer::Vat.validate("LU26375245")
Apilayer::Vat.rate(:country_code, "NL")
Apilayer::Vat.rate(:ip_address, "176.249.153.36")
Apilayer::Vat.rate_list
Apilayer::Vat.price(100, :country, "NL")
Apilayer::Vat.price(100, :ip_address, "176.249.153.36")

Re-Configure access_key and https¶ ↑

If you happened to have forgotten to set or entered an incorrect value, you can re-configure your Apilayer module by:

# Example: reconfigure https
Apilayer::Vat.configure do |configs|
  configs.https = true
end