Class: Taxjar::Client

Inherits:
Object
  • Object
show all
Includes:
API, API::Customer, API::Order, API::Refund
Defined in:
lib/taxjar/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from API::Refund

#create_refund, #delete_refund, #list_refunds, #show_refund, #update_refund

Methods included from API::Utils

#perform_delete_with_object, #perform_get_with_array, #perform_get_with_object, #perform_get_with_objects, #perform_post_with_object, #perform_put_with_object, #perform_request, #perform_request_with_array, #perform_request_with_object, #perform_request_with_objects

Methods included from API::Order

#create_order, #delete_order, #list_orders, #show_order, #update_order

Methods included from API::Customer

#create_customer, #delete_customer, #list_customers, #show_customer, #update_customer

Methods included from API

#categories, #nexus_regions, #rates_for_location, #summary_rates, #tax_for_order, #validate

Constructor Details

#initialize(options = {}) {|_self| ... } ⇒ Client

Returns a new instance of Client.

Yields:

  • (_self)

Yield Parameters:



20
21
22
23
24
25
# File 'lib/taxjar/client.rb', line 20

def initialize(options = {})
  options.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
  yield(self) if block_given?
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



16
17
18
# File 'lib/taxjar/client.rb', line 16

def api_key
  @api_key
end

#api_urlObject

Returns the value of attribute api_url.



17
18
19
# File 'lib/taxjar/client.rb', line 17

def api_url
  @api_url
end

#headersObject

Returns the value of attribute headers.



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

def headers
  @headers
end

Instance Method Details

#api_key?Boolean

Returns:

  • (Boolean)


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

def api_key?
  !!@api_key
end

#get_api_config(key) ⇒ Object



35
36
37
# File 'lib/taxjar/client.rb', line 35

def get_api_config(key)
  instance_variable_get("@#{key}")
end

#set_api_config(key, value) ⇒ Object



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

def set_api_config(key, value)
  instance_variable_set("@#{key}", value)
end

#user_agentObject



39
40
41
# File 'lib/taxjar/client.rb', line 39

def user_agent
  "TaxjarRubyGem/#{Taxjar::Version}"
end