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
37 38 39 |
# File 'lib/tictail/api/client.rb', line 37 def initialize(url = 'https://api.tictail.com') @url = url end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
31 32 33 |
# File 'lib/tictail/api/client.rb', line 31 def access_token @access_token end |
Instance Method Details
#delete(url, params) ⇒ Object
Does a DELETE request to the url with the params
79 80 81 82 83 |
# File 'lib/tictail/api/client.rb', line 79 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
47 48 49 50 51 |
# File 'lib/tictail/api/client.rb', line 47 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
58 59 60 61 62 |
# File 'lib/tictail/api/client.rb', line 58 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
69 70 71 72 73 |
# File 'lib/tictail/api/client.rb', line 69 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 |