Class: Wlc::Client

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token) ⇒ Client

Returns a new instance of Client.



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

def initialize(token)
  @token = token
end

Instance Attribute Details

#tokenObject

Returns the value of attribute token.



3
4
5
# File 'lib/wlc/client.rb', line 3

def token
  @token
end

Class Method Details

.hostObject



9
10
11
# File 'lib/wlc/client.rb', line 9

def self.host
  'http://www.selida.com.br'
end

Instance Method Details

#current_tokenObject



21
22
23
# File 'lib/wlc/client.rb', line 21

def current_token
  @token.expired? ? new_token : token
end

#get(path, params = {}) ⇒ Object



13
14
15
# File 'lib/wlc/client.rb', line 13

def get(path, params = {})
  request.get path, params.merge(keyword_token)
end

#post(path, resource = {}) ⇒ Object



17
18
19
# File 'lib/wlc/client.rb', line 17

def post(path, resource = {})
  request.post request_path(path, keyword_token[:keyword]), resource
end