Module: Taxjar::API

Includes:
Utils
Included in:
Client
Defined in:
lib/taxjar/api/api.rb,
lib/taxjar/api/utils.rb,
lib/taxjar/api/request.rb

Defined Under Namespace

Modules: Utils Classes: Request

Instance Method Summary collapse

Methods included from Utils

#perform_get_with_object, #perform_get_with_objects, #perform_post_with_object, #perform_put_with_object, #perform_request, #perform_request_with_object, #perform_request_with_objects

Instance Method Details

#categories(options = {}) ⇒ Object



6
7
8
# File 'lib/taxjar/api/api.rb', line 6

def categories(options = {})
  perform_get_with_objects("/v2/categories", 'categories', options, Taxjar::Category)
end

#create_order(options = {}) ⇒ Object



18
19
20
# File 'lib/taxjar/api/api.rb', line 18

def create_order(options = {})
  perform_post_with_object("/v2/transactions/orders", 'order', options, Taxjar::Order)
end

#create_refund(options = {}) ⇒ Object



27
28
29
# File 'lib/taxjar/api/api.rb', line 27

def create_refund(options = {})
  perform_post_with_object("/v2/transactions/refunds", 'refund', options, Taxjar::Refund)
end

#rates_for_location(postal_code, options = {}) ⇒ Object



10
11
12
# File 'lib/taxjar/api/api.rb', line 10

def rates_for_location(postal_code, options ={})
  perform_get_with_object("/v2/rates/#{postal_code}", 'rate', options, Taxjar::Rate)
end

#tax_for_order(options = {}) ⇒ Object



14
15
16
# File 'lib/taxjar/api/api.rb', line 14

def tax_for_order(options = {})
  perform_post_with_object("/v2/taxes", 'tax', options, Taxjar::Tax)
end

#update_order(options = {}) ⇒ Object



22
23
24
25
# File 'lib/taxjar/api/api.rb', line 22

def update_order(options = {})
  id = options.fetch(:transaction_id)
  perform_put_with_object("/v2/transactions/orders/#{id}", 'order', options, Taxjar::Order)
end

#update_refund(options = {}) ⇒ Object



31
32
33
34
# File 'lib/taxjar/api/api.rb', line 31

def update_refund(options = {})
  id = options.fetch(:transaction_id)
  perform_put_with_object("/v2/transactions/refunds/#{id}", 'refund', options, Taxjar::Refund)
end