Class: Watchman::MedicWatcher
- Inherits:
-
Object
- Object
- Watchman::MedicWatcher
- Defined in:
- lib/watchman/medic_watcher.rb
Constant Summary collapse
- STATUSI =
["AVL","DSP","ENR","TRN","ARV","AV1","INC","OFF","ONS","ORP","ENH","ONH","AOS","OOD","OOS","AAS"]
Instance Method Summary collapse
- #city_status ⇒ Object
- #county_status ⇒ Object
-
#initialize ⇒ MedicWatcher
constructor
A new instance of MedicWatcher.
- #page ⇒ Object
- #raw_page ⇒ Object
- #status_of(medic) ⇒ Object
Constructor Details
#initialize ⇒ MedicWatcher
Returns a new instance of MedicWatcher.
5 6 7 |
# File 'lib/watchman/medic_watcher.rb', line 5 def initialize @client = Client.new end |
Instance Method Details
#city_status ⇒ Object
21 22 23 |
# File 'lib/watchman/medic_watcher.rb', line 21 def city_status count(/TruckID=M(11|15|21|22|23)\d/,"AVL") end |
#county_status ⇒ Object
25 26 27 |
# File 'lib/watchman/medic_watcher.rb', line 25 def county_status count(/TruckID=M(11|13|15|21|22|23|24)\d/,"AVL") end |
#page ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/watchman/medic_watcher.rb', line 13 def page if @_medic_page.nil? @client.(,"TScreen") @_medic_page = @client.get("AjaxTS2.php") end @_medic_page end |
#raw_page ⇒ Object
9 10 11 |
# File 'lib/watchman/medic_watcher.rb', line 9 def raw_page page.parser.to_s end |
#status_of(medic) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/watchman/medic_watcher.rb', line 29 def status_of(medic) STATUSI.each do |status| return status if count(/TruckID=M#{medic}/,status) >= 1 end "OOS" end |