Class: Incentivale::Client
- Inherits:
-
Object
- Object
- Incentivale::Client
- Defined in:
- lib/incentivale/client.rb
Constant Summary collapse
- HOST =
FIXME ‘central.incentivale.com.br’
'https://central-incentivale.herokuapp.com'
Instance Attribute Summary collapse
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
- #current_token ⇒ Object
- #get(path, params = {}) ⇒ Object
-
#initialize(token) ⇒ Client
constructor
A new instance of Client.
- #post(path, resource = {}) ⇒ Object
Constructor Details
#initialize(token) ⇒ Client
7 8 9 |
# File 'lib/incentivale/client.rb', line 7 def initialize(token) @token = token end |
Instance Attribute Details
#token ⇒ Object
Returns the value of attribute token.
5 6 7 |
# File 'lib/incentivale/client.rb', line 5 def token @token end |
Instance Method Details
#current_token ⇒ Object
19 20 21 |
# File 'lib/incentivale/client.rb', line 19 def current_token @token.expired? ? new_token : token end |
#get(path, params = {}) ⇒ Object
11 12 13 |
# File 'lib/incentivale/client.rb', line 11 def get(path, params = {}) request.get path, params.merge(campaign_token) end |
#post(path, resource = {}) ⇒ Object
15 16 17 |
# File 'lib/incentivale/client.rb', line 15 def post(path, resource = {}) request.post path, resource.merge(campaign_token) end |