Class: Wajub::TaxResource

Inherits:
BaseClient show all
Defined in:
lib/wajub/resources.rb

Instance Attribute Summary

Attributes inherited from BaseClient

#api_key, #base_url, #idempotency_key_prefix, #last_request, #transport

Instance Method Summary collapse

Methods inherited from BaseClient

#delete, #get, #initialize, #post, #put, #request

Constructor Details

This class inherits a constructor from Wajub::BaseClient

Instance Method Details

#calculate(params, options = nil) ⇒ Object



254
255
256
# File 'lib/wajub/resources.rb', line 254

def calculate(params, options = nil)
  HttpUtils.pick_resource(post('/tax/calculate', params, options), 'tax', 'calculation')
end

#get_settingsObject



241
242
243
# File 'lib/wajub/resources.rb', line 241

def get_settings
  HttpUtils.pick_resource(get('/tax/settings'), 'tax', 'settings')
end

#rates(params = nil) ⇒ Object



249
250
251
252
# File 'lib/wajub/resources.rb', line 249

def rates(params = nil)
  list = HttpUtils.pick_list(get('/tax/rates', params), 'rates', 'tax_rates')
  [list[:data], list[:meta]]
end

#update_settings(params, options = nil) ⇒ Object



245
246
247
# File 'lib/wajub/resources.rb', line 245

def update_settings(params, options = nil)
  HttpUtils.pick_resource(put('/tax/settings', params, options), 'tax', 'settings')
end