Class: Tapsilat::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/tapsilat/client.rb

Instance Method Summary collapse

Constructor Details

#initializeClient

Returns a new instance of Client.

Raises:



5
6
7
8
9
10
11
12
13
14
# File 'lib/tapsilat/client.rb', line 5

def initialize
  raise ConfigurationError, 'Tapsilat not configured' unless Tapsilat.configured?

  self.class.base_uri Tapsilat.base_url
  self.class.headers(
    'Authorization' => "Bearer #{Tapsilat.api_token}",
    'Content-Type' => 'application/json',
    'Accept' => 'application/json'
  )
end

Instance Method Details

#get(path, options = {}) ⇒ Object



20
21
22
# File 'lib/tapsilat/client.rb', line 20

def get(path, options = {})
  handle_response(self.class.get(path, options))
end

#ordersObject



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

def orders
  @orders ||= Orders.new(self)
end

#post(path, options = {}) ⇒ Object



24
25
26
# File 'lib/tapsilat/client.rb', line 24

def post(path, options = {})
  handle_response(self.class.post(path, options))
end