Class: Tictail::Client
- Inherits:
-
Object
- Object
- Tictail::Client
- Includes:
- Api::Authenticate, Api::Card, Api::Customer, Api::Order, Api::Ping, Api::Product, Helper
- Defined in:
- lib/tictail/api/client.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
Instance Method Summary collapse
-
#delete(url, params) ⇒ Object
Does a DELETE request to the url with the params.
-
#get(url, params = {}) ⇒ Object
Does a GET request to the url with the params.
-
#initialize(url = 'https://api.tictail.com') ⇒ Client
constructor
Creates a new instance of Tictail::Api::Client.
-
#post(url, params) ⇒ Object
Does a POST request to the url with the params.
-
#put(url, params) ⇒ Object
Does a PUT request to the url with the params.
Methods included from Api::Card
Methods included from Api::Customer
Methods included from Api::Product
Methods included from Api::Order
Methods included from Api::Ping
Methods included from Api::Authenticate
Methods included from Helper
Constructor Details
#initialize(url = 'https://api.tictail.com') ⇒ Client
Creates a new instance of Tictail::Api::Client
36 37 38 |
# File 'lib/tictail/api/client.rb', line 36 def initialize(url = 'https://api.tictail.com') @url = url end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
30 31 32 |
# File 'lib/tictail/api/client.rb', line 30 def access_token @access_token end |
Instance Method Details
#delete(url, params) ⇒ Object
Does a DELETE request to the url with the params
78 79 80 81 82 |
# File 'lib/tictail/api/client.rb', line 78 def delete(url, params) params = convert_hash_keys(params) @access_token = params.delete('access_token') if params['access_token'] return connection.delete(url) end |
#get(url, params = {}) ⇒ Object
Does a GET request to the url with the params
46 47 48 49 50 |
# File 'lib/tictail/api/client.rb', line 46 def get(url, params = {}) params = convert_hash_keys(params) @access_token = params.delete('access_token') if params['access_token'] return connection.get(url, params) end |
#post(url, params) ⇒ Object
Does a POST request to the url with the params
57 58 59 60 61 |
# File 'lib/tictail/api/client.rb', line 57 def post(url, params) params = convert_hash_keys(params) @access_token = params.delete('access_token') if params['access_token'] return connection.post(url, params) end |
#put(url, params) ⇒ Object
Does a PUT request to the url with the params
68 69 70 71 72 |
# File 'lib/tictail/api/client.rb', line 68 def put(url, params) params = convert_hash_keys(params) @access_token = params.delete('access_token') if params['access_token'] return connection.put(url, params) end |