class Avatax::Api::Accounts

Accounts Client @see developer.avalara.com/avatax/api-reference/tax/v2/Accounts/

Public Instance Methods

activate(account_id, args = {}) click to toggle source

Activate an account @see developer.avalara.com/avatax/api-reference/tax/v2/Accounts/#ActivateAccount

@param account_id [String, Integer] The ID of the account to activate. @param args [Hash] The arguments for avatax. @return [Avatax::Response]

# File lib/avatax/api/accounts.rb, line 16
def activate(account_id, args = {})
  post_for(:activate, account_id, args)
end
configuration(account_id, args = {}) click to toggle source

Get configuration for an account @see developer.avalara.com/avatax/api-reference/tax/v2/Accounts/#GetAccountConfiguration

@param account_id [String, Integer] The ID of the account to activate. @param args [Hash] The arguments for avatax. @return [Avatax::Response]

# File lib/avatax/api/accounts.rb, line 28
def configuration(account_id, args = {})
  get_for(:configuration, account_id, args)
end
get(account_id, args = {}) click to toggle source

Get an account. @see developer.avalara.com/avatax/api-reference/tax/v2/Accounts/#GetAccount

@param account_id [String, Integer] The ID of the account to activate. @param args [Hash] The arguments for avatax. @return [Avatax::Response]

# File lib/avatax/api/accounts.rb, line 64
def get(account_id, args = {})
  get_for(nil, account_id, args)
end
reset_license_key(account_id, args = {}) click to toggle source

Reset the license key for an account. @see developer.avalara.com/avatax/api-reference/tax/v2/Accounts/#AccountResetLicenseKey

@param account_id [String, Integer] The ID of the account to activate. @param args [Hash] The arguments for avatax. @return [Avatax::Response]

# File lib/avatax/api/accounts.rb, line 52
def reset_license_key(account_id, args = {})
  post_for(:resetlicensekey, account_id, args)
end
update_configuration(account_id, args = {}) click to toggle source

Update configuration for an account @see developer.avalara.com/avatax/api-reference/tax/v2/Accounts/#SetAccountConfiguration

@param account_id [String, Integer] The ID of the account to activate. @param args [Hash] The arguments for avatax. @return [Avatax::Response]

# File lib/avatax/api/accounts.rb, line 40
def update_configuration(account_id, args = {})
  post_for(:configuration, account_id, args)
end

Private Instance Methods

get_for(endpoint, account_id, args) click to toggle source
# File lib/avatax/api/accounts.rb, line 70
def get_for(endpoint, account_id, args)
  request_for(:get, endpoint, account_id, args)
end
post_for(endpoint, account_id, args) click to toggle source
# File lib/avatax/api/accounts.rb, line 74
def post_for(endpoint, account_id, args)
  request_for(:post, endpoint, account_id, args)
end
request_for(method, endpoint, account_id, args) click to toggle source
# File lib/avatax/api/accounts.rb, line 78
def request_for(method, endpoint, account_id, args)
  raise ArgumentError, 'account_id is required' if account_id.blank?

  resp = connection.send method, "/api/v2/accounts/#{account_id}/#{endpoint}", args
  handle_response(resp)
end