Class: Tapsilat::Client
- Inherits:
-
Object
- Object
- Tapsilat::Client
- Includes:
- HTTParty
- Defined in:
- lib/tapsilat/client.rb
Instance Method Summary collapse
- #get(path, options = {}) ⇒ Object
-
#initialize ⇒ Client
constructor
A new instance of Client.
- #orders ⇒ Object
- #post(path, options = {}) ⇒ Object
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
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, = {}) handle_response(self.class.get(path, )) end |
#orders ⇒ Object
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, = {}) handle_response(self.class.post(path, )) end |