Class: Martlet::Authenticator
- Inherits:
-
Object
- Object
- Martlet::Authenticator
- Defined in:
- lib/martlet/authenticator.rb
Instance Method Summary collapse
- #authenticate(email, password) ⇒ Object
-
#initialize(agent) ⇒ Authenticator
constructor
A new instance of Authenticator.
Constructor Details
#initialize(agent) ⇒ Authenticator
Returns a new instance of Authenticator.
5 6 7 |
# File 'lib/martlet/authenticator.rb', line 5 def initialize(agent) @agent = agent end |
Instance Method Details
#authenticate(email, password) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/martlet/authenticator.rb', line 9 def authenticate(email, password) # Go to login page login_page = @agent.get(login_url) # Find and fill login form form = login_form(login_page) form['sid'] = email form['PIN'] = password submit_login_form(form) end |