Class: Vatsense::Resources::Countries
- Inherits:
-
Object
- Object
- Vatsense::Resources::Countries
- Defined in:
- lib/vatsense/resources/countries.rb
Overview
Country and province information
Instance Method Summary collapse
-
#initialize(client:) ⇒ Countries
constructor
private
A new instance of Countries.
-
#list(country_code: nil, ip_address: nil, request_options: {}) ⇒ Vatsense::Models::CountryListResponse
Some parameter documentations has been truncated, see Models::CountryListParams for more details.
-
#list_provinces(country_code:, request_options: {}) ⇒ Vatsense::Models::CountryListProvincesResponse
Retrieve a list of all provinces within a given country.
Constructor Details
#initialize(client:) ⇒ Countries
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Countries.
65 66 67 |
# File 'lib/vatsense/resources/countries.rb', line 65 def initialize(client:) @client = client end |
Instance Method Details
#list(country_code: nil, ip_address: nil, request_options: {}) ⇒ Vatsense::Models::CountryListResponse
Some parameter documentations has been truncated, see Models::CountryListParams for more details.
Returns a list of all countries, including whether they are subject to VAT/GST and whether they are subject to EU VAT. Each country is returned as a country object.
You can optionally filter by country code or IP address.
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/vatsense/resources/countries.rb', line 27 def list(params = {}) parsed, = Vatsense::CountryListParams.dump_request(params) query = Vatsense::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "countries", query: query, model: Vatsense::Models::CountryListResponse, options: ) end |
#list_provinces(country_code:, request_options: {}) ⇒ Vatsense::Models::CountryListProvincesResponse
Retrieve a list of all provinces within a given country.
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/vatsense/resources/countries.rb', line 50 def list_provinces(params) parsed, = Vatsense::CountryListProvincesParams.dump_request(params) query = Vatsense::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "countries/provinces", query: query, model: Vatsense::Models::CountryListProvincesResponse, options: ) end |