watchman 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- watchman (0.0.2)
4
+ watchman (0.0.4)
5
5
  mechanize
6
6
 
7
7
  GEM
@@ -12,5 +12,10 @@ module Watchman
12
12
  end
13
13
  call
14
14
  end
15
+
16
+ def current_call_incident_numbers
17
+ page = @client.get("AjaxDC2.php")
18
+ page.parser.to_s.scan(/DisplayCall\.php\?Incid\=(\d+)/).flatten
19
+ end
15
20
  end
16
21
  end
@@ -1,3 +1,3 @@
1
1
  module Watchman
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -23,8 +23,16 @@ class IstatusMocker
23
23
  'content-type'=>"text/html",
24
24
  :body => INCIDENT_HTML)
25
25
  end
26
+
27
+ def fake_call_table_path(host)
28
+ fake_login(host)
29
+ FakeWeb.register_uri(:get,"https://#{host}/AjaxDC2.php",
30
+ 'content-type'=>"text/html",
31
+ :body => CALL_LIST_HTML)
32
+ end
26
33
  end
27
34
 
35
+ CALL_LIST_HTML = "/*{\"calls\":[{\"incnum\":\"<td class=Status style=><a href='DisplayCall.php?Incid=201023885' target=Fire>201023885&nbsp;</a></td>\",\"time\":\"13:49\",\"pri\":\"5\",\"tac\":\"CF1 \",\"addr\":\"1 BROADWAY E-CO.C1\",\"bldg\":\"BACK & NECK PAIN CENTER \",\"grid\":\"28123S \",\"firearea\":\"112C\",\"nature\":\"55B4-ELCTRL ODOR \",\"units\":\"<SPAN style=\\\"white-space:nowrap;\\\" CLASS=\\\"INC\\\"><a href=ApparatusDetail.php?TruckID=SNZ1 CLASS=\\\"INC\\\"> SNZ1m</a></SPAN> \",\"dispcode\":\"SR \"},{\"incnum\":\"<td class=Status style=background-color:#D6E5EE;><a href='DisplayCall.php?Incid=201023884' target=Fire>201023884&nbsp;</a></td>\",\"time\":\"13:42\",\"pri\":\"3\",\"tac\":\"BF1 \",\"addr\":\"607 SPRINGTIME DR-AS\",\"bldg\":\" \",\"grid\":\"3910E \",\"firearea\":\"17-19A\",\"nature\":\"26C2-SICK PERSON \",\"units\":\"<SPAN style=\\\"white-space:nowrap;\\\" CLASS=\\\"AVL\\\"><a href=ApparatusDetail.php?TruckID=G1706 CLASS=\\\"AVL\\\"> G1706</a></SPAN> <SPAN style=\\\"white-space:nowrap;\\\" CLASS=\\\"ONS\\\"><a href=ApparatusDetail.php?TruckID=M241 CLASS=\\\"ONS\\\"> M241m</a></SPAN> \",\"dispcode\":\"FRM \"},{\"incnum\":\"<td class=Status style=><a href='DisplayCall.php?Incid=201023883' target=Fire>201023883&nbsp;</a></td>\",\"time\":\"13:40\",\"pri\":\"9\",\"tac\":\"AMB \",\"addr\":\"1600 BROADWAY E-CO\",\"bldg\":\"BOONE HOSPITAL CENTER \",\"grid\":\"29073S \",\"firearea\":\"143\",\"nature\":\"RT-ROUTINE TRANSPORT \",\"units\":\"<SPAN style=\\\"white-space:nowrap;\\\" CLASS=\\\"ENH\\\"><a href=ApparatusDetail.php?TruckID=M151 CLASS=\\\"ENH\\\"> M151m</a></SPAN> \",\"dispcode\":\"NA \"},{\"incnum\":\"<td class=Status style=background-color:#D6E5EE;><a href='DisplayCall.php?Incid=201023879' target=Fire>201023879&nbsp;</a></td>\",\"time\":\"12:55\",\"pri\":\"9\",\"tac\":\"CF1 \",\"addr\":\"201 ORR ST-CO\",\"bldg\":\"COLUMBIA FIRE DEPT STATION 1 \",\"grid\":\"29073P \",\"firearea\":\"154\",\"nature\":\"TRA-TRAINING \",\"units\":\"<SPAN style=\\\"white-space:nowrap;\\\" CLASS=\\\"ONS\\\"><a href=ApparatusDetail.php?TruckID=Q44 CLASS=\\\"ONS\\\"> Q44</a></SPAN> <SPAN style=\\\"white-space:nowrap;\\\" CLASS=\\\"ONS\\\"><a href=ApparatusDetail.php?TruckID=Q6 CLASS=\\\"ONS\\\"> Q6m</a></SPAN> <SPAN style=\\\"white-space:nowrap;\\\" CLASS=\\\"ONS\\\"><a href=ApparatusDetail.php?TruckID=Q8 CLASS=\\\"ONS\\\"> Q8</a></SPAN> <SPAN style=\\\"white-space:nowrap;\\\" CLASS=\\\"ONS\\\"><a href=ApparatusDetail.php?TruckID=L1 CLASS=\\\"ONS\\\"> L1</a></SPAN> \",\"dispcode\":\"NA \"},{\"incnum\":\"<td class=Status style=><a href='DisplayCall.php?Incid=201023876' target=Fire>201023876&nbsp;</a></td>\",\"time\":\"12:48\",\"pri\":\"9\",\"tac\":\"AMB \",\"addr\":\"1600 BROADWAY E-CO\",\"bldg\":\"BOONE HOSPITAL CENTER \",\"grid\":\"29073S \",\"firearea\":\"143\",\"nature\":\"LDT-LONG DISTANCE TRANSPORT \",\"units\":\"<SPAN style=\\\"white-space:nowrap;\\\" CLASS=\\\"ENH\\\"><a href=ApparatusDetail.php?TruckID=M113 CLASS=\\\"ENH\\\"> M113m</a></SPAN> \",\"dispcode\":\"NA \"},{\"incnum\":\"<td class=Status style=background-color:#D6E5EE;><a href='DisplayCall.php?Incid=201023863' target=Fire>201023863&nbsp;</a></td>\",\"time\":\"10:55\",\"pri\":\"9\",\"tac\":\"AMB \",\"addr\":\"1600 BROADWAY E-CO\",\"bldg\":\"BOONE HOSPITAL CENTER \",\"grid\":\"29073S \",\"firearea\":\"143\",\"nature\":\"LDT-LONG DISTANCE TRANSPORT \",\"units\":\"<SPAN style=\\\"white-space:nowrap;\\\" CLASS=\\\"ONH\\\"><a href=ApparatusDetail.php?TruckID=M112 CLASS=\\\"ONH\\\"> M112m</a></SPAN> \",\"dispcode\":\"NA \"},{\"incnum\":\"<td class=Status style=><a href='DisplayCall.php?Incid=201023861' target=Fire>201023861&nbsp;</a></td>\",\"time\":\"10:46\",\"pri\":\"9\",\"tac\":\"AMB \",\"addr\":\"1 HOSPITAL DR-CO\",\"bldg\":\"UNIVERSITY HOSPITAL & CLIN MU \",\"grid\":\"28134C \",\"firearea\":\"311\",\"nature\":\"LDT-LONG DISTANCE TRANSPORT \",\"units\":\"<SPAN style=\\\"white-space:nowrap;\\\" CLASS=\\\"ONH\\\"><a href=ApparatusDetail.php?TruckID=M212 CLASS=\\\"ONH\\\"> M212m</a></SPAN> \",\"dispcode\":\"LDT \"}]}*/"
28
36
 
29
37
 
30
38
  LOGIN_PAGE_HTML = %Q{
@@ -6,12 +6,28 @@ describe "Watchman::CallWatcher" do
6
6
  Client.username = "some.name"
7
7
  Client.password = "1234"
8
8
  Client.host = "some.cad-host.com"
9
- IstatusMocker.fake_call_path(Client.host,"201023687")
10
9
  end
11
10
 
12
- it "can find the address" do
13
- call = CallWatcher.new.info_for("201023687")
14
- call.address.should == "7750 HIGHWAY AB E"
15
- call.incident_number.should == "201023687"
11
+ describe "when checking call list" do
12
+ before(:each) do
13
+ IstatusMocker.fake_call_table_path(Client.host)
14
+ end
15
+
16
+ it "can find a list of all current calls" do
17
+ calls = ["201023861", "201023863", "201023876", "201023879", "201023883", "201023884", "201023885"]
18
+ CallWatcher.new.current_call_incident_numbers.sort.should == calls.sort
19
+ end
20
+ end
21
+
22
+ describe "when parsing a call" do
23
+ before(:each) do
24
+ IstatusMocker.fake_call_path(Client.host,"201023687")
25
+ end
26
+
27
+ it "can find the address" do
28
+ call = CallWatcher.new.info_for("201023687")
29
+ call.address.should == "7750 HIGHWAY AB E"
30
+ call.incident_number.should == "201023687"
31
+ end
16
32
  end
17
33
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watchman
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ethan Vizitei
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-19 00:00:00 -06:00
18
+ date: 2010-12-22 00:00:00 -06:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency