Class: Vatlayer::Api
- Inherits:
-
Object
- Object
- Vatlayer::Api
- Defined in:
- lib/vatlayer/api.rb
Instance Attribute Summary collapse
-
#access_key ⇒ Object
readonly
Returns the value of attribute access_key.
-
#https ⇒ Object
readonly
Returns the value of attribute https.
Instance Method Summary collapse
-
#initialize(access_key, https) ⇒ Api
constructor
A new instance of Api.
- #price(amount: nil, country_code: nil, ip_address: nil, use_client_ip: nil, options: {}) ⇒ Object
- #rate(country_code: nil, ip_address: nil, use_client_ip: nil) ⇒ Object
- #rate_list ⇒ Object
- #validate(vat_number: nil) ⇒ Object
Constructor Details
#initialize(access_key, https) ⇒ Api
Returns a new instance of Api.
9 10 11 12 |
# File 'lib/vatlayer/api.rb', line 9 def initialize(access_key, https) @access_key = access_key @https = https end |
Instance Attribute Details
#access_key ⇒ Object (readonly)
Returns the value of attribute access_key.
7 8 9 |
# File 'lib/vatlayer/api.rb', line 7 def access_key @access_key end |
#https ⇒ Object (readonly)
Returns the value of attribute https.
7 8 9 |
# File 'lib/vatlayer/api.rb', line 7 def https @https end |
Instance Method Details
#price(amount: nil, country_code: nil, ip_address: nil, use_client_ip: nil, options: {}) ⇒ Object
14 15 16 17 |
# File 'lib/vatlayer/api.rb', line 14 def price(amount: nil, country_code: nil, ip_address: nil, use_client_ip: nil, options: {}) request('/price', amount: amount, country_code: country_code, ip_address: ip_address, use_client_ip: use_client_ip, type: [:type], incl: [:incl]) end |
#rate(country_code: nil, ip_address: nil, use_client_ip: nil) ⇒ Object
19 20 21 |
# File 'lib/vatlayer/api.rb', line 19 def rate(country_code: nil, ip_address: nil, use_client_ip: nil) request('/rate', country_code: country_code, ip_address: ip_address, use_client_ip: use_client_ip) end |
#rate_list ⇒ Object
23 24 25 |
# File 'lib/vatlayer/api.rb', line 23 def rate_list request('/rate_list') end |
#validate(vat_number: nil) ⇒ Object
27 28 29 |
# File 'lib/vatlayer/api.rb', line 27 def validate(vat_number: nil) request('/validate', vat_number: vat_number) end |