Class: FreeboxApi::Session
- Inherits:
-
Object
- Object
- FreeboxApi::Session
- Defined in:
- lib/freebox_api/session.rb
Instance Method Summary collapse
- #http_call(http_method, path, params = {}) ⇒ Object
-
#initialize(app, freebox) ⇒ Session
constructor
A new instance of Session.
- #password ⇒ Object
- #session_token ⇒ Object
Constructor Details
#initialize(app, freebox) ⇒ Session
Returns a new instance of Session.
5 6 7 8 |
# File 'lib/freebox_api/session.rb', line 5 def initialize(app, freebox) @app = app @freebox = freebox end |
Instance Method Details
#http_call(http_method, path, params = {}) ⇒ Object
19 20 21 |
# File 'lib/freebox_api/session.rb', line 19 def http_call(http_method, path, params = {}) @freebox.http_call(http_method, path, params, self) end |
#password ⇒ Object
10 11 12 |
# File 'lib/freebox_api/session.rb', line 10 def password Digest::HMAC.hexdigest(@freebox.challenge, @app[:app_token], Digest::SHA1) end |
#session_token ⇒ Object
14 15 16 17 |
# File 'lib/freebox_api/session.rb', line 14 def session_token @freebox.http_call('post', '/login/session/', {:app_id => @app[:app_id], :password => password}, nil)['session_token'] end |