Class: Wlc::Client
- Inherits:
-
Object
- Object
- Wlc::Client
- Defined in:
- lib/wlc/client.rb
Instance Attribute Summary collapse
-
#token ⇒ Object
Returns the value of attribute token.
Class Method Summary collapse
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
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
#token ⇒ Object
Returns the value of attribute token.
3 4 5 |
# File 'lib/wlc/client.rb', line 3 def token @token end |
Class Method Details
.host ⇒ Object
9 10 11 |
# File 'lib/wlc/client.rb', line 9 def self.host 'http://www.selida.com.br' end |
Instance Method Details
#current_token ⇒ Object
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 |