Sha256: 5372e1a40734af3bb28f01f8d33367e7e66ffd709f03ff769f453172ec9bfe21

Contents?: true

Size: 864 Bytes

Versions: 4

Compression:

Stored size: 864 Bytes

Contents

module Quaderno
  class Tax < Base
    api_model Quaderno::Tax
    api_path 'taxes'

    class << self
      undef :all, :find, :create, :update, :delete, :parse_nested
    end

    def self.calculate(params)
      party_response = get("#{self.url}taxes/calculate.json", query: params, basic_auth: { username: api_model.auth_token } )
      check_exception_for(party_response, { rate_limit: true, subdomain_or_token: true, id: true })
      new party_response.parsed_response
    end

    def self.validate_vat_number(country, vat_number)
      party_response = get("#{self.url}taxes/validate.json", query: {country: country, vat_number: vat_number}, basic_auth: { username: api_model.auth_token } )
      check_exception_for(party_response, { rate_limit: true, subdomain_or_token: true, id: true })

      party_response.parsed_response['valid']
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
quaderno-1.12.0 lib/quaderno-ruby/tax.rb
quaderno-1.11.2 lib/quaderno-ruby/tax.rb
quaderno-1.11.1 lib/quaderno-ruby/tax.rb
quaderno-1.11.0 lib/quaderno-ruby/tax.rb