Class: ThreeUsage::Fetcher
- Inherits:
-
Object
- Object
- ThreeUsage::Fetcher
- Defined in:
- lib/three_usage/fetcher.rb
Instance Attribute Summary collapse
-
#page ⇒ Object
Returns the value of attribute page.
Instance Method Summary collapse
-
#initialize(username, password, pin) ⇒ Fetcher
constructor
A new instance of Fetcher.
Constructor Details
#initialize(username, password, pin) ⇒ Fetcher
Returns a new instance of Fetcher.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/three_usage/fetcher.rb', line 7 def initialize(username,password,pin) agent = WWW::Mechanize.new page = agent.get('https://www.my.three.com.au/My3/jfn') login_form = page.form('login') login_form.login = username login_form.password = password page = agent.submit(login_form, login_form..first) pin_form = page.form('myForm') if pin_form.nil? puts "Authentication failure" exit(1) end pin_form.pin = pin @page = agent.submit(pin_form, pin_form..first) end |
Instance Attribute Details
#page ⇒ Object
Returns the value of attribute page.
6 7 8 |
# File 'lib/three_usage/fetcher.rb', line 6 def page @page end |