Class: Incentivale::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/incentivale/client.rb

Constant Summary collapse

HOST =
'https://central-incentivale.herokuapp.com'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token) ⇒ Client



7
8
9
# File 'lib/incentivale/client.rb', line 7

def initialize(token)
  @token = token
end

Instance Attribute Details

#tokenObject

Returns the value of attribute token.



5
6
7
# File 'lib/incentivale/client.rb', line 5

def token
  @token
end

Instance Method Details

#current_tokenObject



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