Class: LoginPage

Inherits:
ServiceCall show all
Defined in:
lib/etvnet_seek/core/login_page.rb

Constant Summary collapse

LOGIN_URL =
"#{Page::BASE_URL}/cgi-bin/video/login.fcgi"

Instance Attribute Summary

Attributes inherited from ServiceCall

#url

Instance Method Summary collapse

Methods inherited from ServiceCall

#get, #post

Constructor Details

#initializeLoginPage

Returns a new instance of LoginPage.



6
7
8
# File 'lib/etvnet_seek/core/login_page.rb', line 6

def initialize
  super(LOGIN_URL)
end

Instance Method Details

#login(username, password) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/etvnet_seek/core/login_page.rb', line 10

def  username, password
  headers = { "Content-Type" => "application/x-www-form-urlencoded" }

  response = post({ 'action' => 'login', 'username' => username, 'pwd'=> password }, headers)

  cookie = response.response['set-cookie']

  unless cookie.nil?
    cookie = cleanup_cookie(cookie)
  end

  cookie
end