Class: BptScraper::Login
- Inherits:
-
Object
- Object
- BptScraper::Login
- Includes:
- Helpers
- Defined in:
- lib/bpt_scraper/login.rb
Overview
Handles the scraping of the home page for CSRF token from username input. Additionally handles the POSTing of login info to create a session
Constant Summary collapse
- BASE_URL =
'https://www.brownpapertickets.com/login.html'.freeze
Class Attribute Summary collapse
-
.base_url ⇒ Object
Returns the value of attribute base_url.
-
.email ⇒ Object
Returns the value of attribute email.
-
.fields ⇒ Object
Returns the value of attribute fields.
-
.password ⇒ Object
Returns the value of attribute password.
Instance Attribute Summary collapse
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#email ⇒ Object
Returns the value of attribute email.
-
#fields ⇒ Object
Returns the value of attribute fields.
-
#password ⇒ Object
Returns the value of attribute password.
Class Method Summary collapse
Instance Method Summary collapse
- #create_session ⇒ Object
-
#initialize(base_url: nil, email: nil, password: nil) ⇒ Login
constructor
A new instance of Login.
Methods included from Helpers
#failed_login_fetch, #failed_login_post, #missing_options_error, #missing_parameters_error, #no_developer_id_error
Constructor Details
#initialize(base_url: nil, email: nil, password: nil) ⇒ Login
Returns a new instance of Login.
13 14 15 16 17 18 |
# File 'lib/bpt_scraper/login.rb', line 13 def initialize(base_url: nil, email: nil, password: nil) self.base_url = base_url || self.class.base_url || BASE_URL self.email = email || self.class.email self.password = password || self.class.password ('Login') if (self.email.nil? || self.password.nil?) end |
Class Attribute Details
.base_url ⇒ Object
Returns the value of attribute base_url.
26 27 28 |
# File 'lib/bpt_scraper/login.rb', line 26 def base_url @base_url end |
.email ⇒ Object
Returns the value of attribute email.
26 27 28 |
# File 'lib/bpt_scraper/login.rb', line 26 def email @email end |
.fields ⇒ Object
Returns the value of attribute fields.
26 27 28 |
# File 'lib/bpt_scraper/login.rb', line 26 def fields @fields end |
.password ⇒ Object
Returns the value of attribute password.
26 27 28 |
# File 'lib/bpt_scraper/login.rb', line 26 def password @password end |
Instance Attribute Details
#base_url ⇒ Object
Returns the value of attribute base_url.
9 10 11 |
# File 'lib/bpt_scraper/login.rb', line 9 def base_url @base_url end |
#email ⇒ Object
Returns the value of attribute email.
9 10 11 |
# File 'lib/bpt_scraper/login.rb', line 9 def email @email end |
#fields ⇒ Object
Returns the value of attribute fields.
9 10 11 |
# File 'lib/bpt_scraper/login.rb', line 9 def fields @fields end |
#password ⇒ Object
Returns the value of attribute password.
9 10 11 |
# File 'lib/bpt_scraper/login.rb', line 9 def password @password end |
Class Method Details
.reset ⇒ Object
29 30 31 32 33 34 |
# File 'lib/bpt_scraper/login.rb', line 29 def self.reset self.base_url = nil self.fields = nil self.email = nil self.password = nil end |
Instance Method Details
#create_session ⇒ Object
20 21 22 23 |
# File 'lib/bpt_scraper/login.rb', line 20 def create_session self.fields = fetch_login_fields send_login_request end |