Class: BartWaitingList
- Inherits:
-
Object
- Object
- BartWaitingList
- Defined in:
- lib/bart_waiting_list.rb
Instance Attribute Summary collapse
-
#page ⇒ Object
readonly
Returns the value of attribute page.
Instance Method Summary collapse
- #get_waiting_list_position(station) ⇒ Object
-
#initialize(email, password) ⇒ BartWaitingList
constructor
A new instance of BartWaitingList.
Constructor Details
#initialize(email, password) ⇒ BartWaitingList
Returns a new instance of BartWaitingList.
13 14 15 |
# File 'lib/bart_waiting_list.rb', line 13 def initialize(email, password) @page = get_waiting_list_page email, password end |
Instance Attribute Details
#page ⇒ Object (readonly)
Returns the value of attribute page.
11 12 13 |
# File 'lib/bart_waiting_list.rb', line 11 def page @page end |
Instance Method Details
#get_waiting_list_position(station) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/bart_waiting_list.rb', line 17 def get_waiting_list_position(station) station_name = get_station_name station regexp = %r{position (?<position>\d+)[a-zA-Z<>/"= ]+at <span class="bold">#{station_name}<\/span>} match = @page.body.match regexp Integer match[:position] rescue nil end |