class MyBitcasa::LoginEngine::Phantomjs
Attributes
Public Class Methods
available?()
click to toggle source
# File lib/my_bitcasa/login_engine/phantomjs.rb, line 23 def available? new && true rescue false end
new()
click to toggle source
# File lib/my_bitcasa/login_engine/phantomjs.rb, line 8 def initialize require 'phantomjs' end
Public Instance Methods
login(user, password)
click to toggle source
# File lib/my_bitcasa/login_engine/phantomjs.rb, line 12 def login(user, password) js_path = ::File.expand_path("phantomjs_login.js", ::File.dirname(__FILE__)) cookie = ::Phantomjs.run(js_path, user, password) cookie = cookie.to_s.strip if cookie.length==0 raise AuthorizationError, "login failure" end @cookie = cookie end