Sha256: 8d6d2ffccd9a7a724e9ed5ba1f470ab34fbdaafa38d212f2c2912a03ae9f9e1f

Contents?: true

Size: 519 Bytes

Versions: 9

Compression:

Stored size: 519 Bytes

Contents

module FreeboxApi

  class Session

    def initialize(app, freebox)
      @app = app
      @freebox = freebox
    end

    def password
      Digest::HMAC.hexdigest(@freebox.challenge, @app[:app_token], Digest::SHA1)
    end

    def session_token
      @freebox.http_call('post', '/login/session/',
        {:app_id => @app[:app_id], :password => password}, nil)['session_token']
    end

    def http_call(http_method, path, params = {})
      @freebox.http_call(http_method, path, params, self)
    end

  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
freebox_api-0.2.4 lib/freebox_api/session.rb
freebox_api-0.2.3 lib/freebox_api/session.rb
freebox_api-0.2.2 lib/freebox_api/session.rb
freebox_api-0.2.1 lib/freebox_api/session.rb
freebox_api-0.2.0 lib/freebox_api/session.rb
freebox_api-0.1.2 lib/freebox_api/session.rb
freebox_api-0.1.1 lib/freebox_api/session.rb
freebox_api-0.1.0 lib/freebox_api/session.rb
freebox_api-0.0.2 lib/freebox_api/session.rb