class AutoFlick::Api

Public Class Methods

get_key(auth_url, username, password) click to toggle source
# File lib/auto_flick/api.rb, line 24
def self.get_key(auth_url, username, password)
  begin
    
    visit auth_url

    fill_in('username', :with => username)
    fill_in('passwd', :with => password)
    click_button "login-signin"
    
    click_button "OK, I'LL AUTHORIZE IT"  

    key = find("#Main span").text

  rescue Capybara::ElementNotFound => e
    retry
  ensure
    page.driver.quit
    File.delete("cookies.text")  
  end

  return key
end