Class: Ubiquitously::Faves::User

Inherits:
Base::User show all
Defined in:
lib/ubiquitously/faves.rb

Instance Attribute Summary

Attributes inherited from Base::User

#agent, #password, #username

Instance Method Summary collapse

Methods inherited from Base::User

#initialize, #logged_in?

Methods included from Resourceful

included

Constructor Details

This class inherits a constructor from Ubiquitously::Base::User

Instance Method Details

#loginObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/ubiquitously/faves.rb', line 4

def 
  page = agent.get("https://secure.faves.com/signIn")
  form = page.forms.detect {|form| form.form_node["id"] == "signInBox"}
  form["rUsername"] = username
  form["rPassword"] = password
  page = form.submit
  
  @logged_in = (page.title =~ /Sign In/i).nil?
  
  unless @logged_in
    raise AuthenticationError.new("Invalid username or password for #{service_name.titleize}")
  end
  
  @logged_in
end