hrt_bus 0.0.4 → 0.0.5

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/CHANGELOG.md CHANGED
@@ -15,3 +15,9 @@
15
15
 
16
16
  * Added HrtBus#Bus.all
17
17
  * Fix empty CSV row, improper time format - bschoenfeld
18
+
19
+ > 0.0.5
20
+
21
+ * Added Rider model
22
+ * Find buses by route_id and direction
23
+
data/README.md CHANGED
@@ -2,73 +2,86 @@
2
2
 
3
3
  Ruby gem for public HRT bus location data
4
4
 
5
- ### Installation
5
+ ## Installation
6
6
 
7
7
  gem install hrt_bus
8
8
 
9
- ### A collection of HRT buses as Ruby ActiveModel objects
9
+ ## Examples
10
10
 
11
- ruby-1.9.2-p180 :001 > HrtBus::Bus.all
11
+ ### HRT bus as a Ruby ActiveModel object
12
+
13
+ HrtBus::Rider.new(:route_id => "20", :direction => "inbound").bus
14
+
15
+ #<HrtBus::Bus:0x1028d40c0
16
+ attr_accessor :direction = "inbound",
17
+ attr_accessor :id = "2021",
18
+ attr_accessor :lat = "36.8597919",
19
+ attr_accessor :lon = "-76.2845680",
20
+ attr_accessor :route_id = "20",
21
+ attr_accessor :time = Sat, 03 Mar 2012 23:24:28 +0000,
22
+ >
23
+
24
+ ### Generate a static Google Map for a bus
25
+
26
+ HrtBus::Rider.new(:route_id => "15", :direction => "outbound").bus.static_map
27
+
28
+ ![map](http://github.com/bds/hrt_bus/raw/master/examples/map.png)
29
+
30
+ ### A collection of active HRT buses
31
+
32
+ HrtBus::Bus.active_buses
12
33
 
13
34
  [
14
- [0] #<HrtBus::Bus:0x101841ac8
15
- attr_accessor :id = "4020",
16
- attr_accessor :lat = "36.8088548",
17
- attr_accessor :lon = "-76.3534049",
18
- attr_accessor :route_id = "105",
19
- attr_accessor :time = #<DateTime:0x101876408
20
- >
35
+ [0] #<HrtBus::Bus:0x100afcac0
36
+ attr_accessor :direction = "outbound",
37
+ attr_accessor :id = "1909",
38
+ attr_accessor :lat = "36.9711193",
39
+ attr_accessor :lon = "-76.4097323",
40
+ attr_accessor :route_id = "107",
41
+ attr_accessor :time = Sat, 03 Mar 2012 23:25:35 +0000,
21
42
  >,
22
- [1] #<HrtBus::Bus:0x100a44c68
23
- attr_accessor :id = "1233",
24
- attr_accessor :lat = "36.9181620",
25
- attr_accessor :lon = "-76.1926839",
26
- attr_accessor :route_id = "8",
27
- attr_accessor :time = #<DateTime:0x100a44e20
28
- >
43
+ [1] #<HrtBus::Bus:0x102956ef8
44
+ attr_accessor :direction = "outbound",
45
+ attr_accessor :id = "1214",
46
+ attr_accessor :lat = "36.9881023",
47
+ attr_accessor :lon = "-76.4242998",
48
+ attr_accessor :route_id = "103",
49
+ attr_accessor :time = Sat, 03 Mar 2012 23:26:02 +0000,
29
50
  >
30
51
  ]
31
52
  ...
32
53
 
33
54
  ### A collection of HRT buses as JSON
34
55
 
35
- ruby-1.9.2-p180 :001 > HrtBus::Bus.all.to_json
56
+ HrtBus::Bus.active_buses.to_json
36
57
 
37
58
  [
38
59
  {
39
60
  "bus":{
40
- "id":"4020",
41
- "lat":"36.8088548",
42
- "lon":"-76.3534049",
43
- "route_id":"105",
44
- "time":"2012-03-02T13:34:16+00:00"
61
+ "direction":"inbound",
62
+ "id":"1218",
63
+ "lat":"37.0145065",
64
+ "lon":"-76.3646452",
65
+ "route_id":"103",
66
+ "time":"2012-03-03T23:26:20+00:00"
45
67
  }
46
68
  },
47
69
  {
48
70
  "bus":{
49
- "id":"1233",
50
- "lat":"36.9181620",
51
- "lon":"-76.1926839",
52
- "route_id":"8",
53
- "time":"2012-03-02T13:34:16+00:00"
71
+ "direction":"outbound",
72
+ "id":"2026",
73
+ "lat":"36.8537111",
74
+ "lon":"-76.1759363",
75
+ "route_id":"20",
76
+ "time":"2012-03-03T23:26:29+00:00"
54
77
  }
55
78
  }
56
79
  ]
57
80
  ...
58
81
 
59
- ### Buses from a specific route
60
-
61
- HrtBus::Bus.all.select { |bus| bus.route_id == "105" }
62
-
63
- ### Generate a static Google Map for a bus
64
-
65
- HrtBus::Bus.all.select { |bus| bus.route_id == "105" }.first.static_map
66
-
67
- ![map](http://github.com/bds/hrt_bus/raw/master/examples/map.png)
68
-
69
82
  ### Determine if a bus is valid
70
83
 
71
- HrtBus::Bus.all.last.valid?
84
+ HrtBus::Bus.active_buses.last.valid?
72
85
 
73
86
  ## Contributing to hrt_bus
74
87
 
data/lib/hrt_bus/bus.rb CHANGED
@@ -3,15 +3,19 @@ module HrtBus
3
3
  include ActiveModel::Validations
4
4
  include ActiveModel::Serializers::JSON
5
5
 
6
- ATTRIBUTES = [ :id, :time, :lat, :lon, :route_id ]
6
+ ATTRIBUTES = [ :id, :time, :direction, :lat, :lon, :route_id ]
7
+
8
+ DIRECTIONS = { "1" => "inbound",
9
+ "2" => "outbound" }.freeze
7
10
 
8
11
  attr_accessor *ATTRIBUTES
9
12
 
10
13
  validates_numericality_of :route_id, greater_than: 0
11
14
  validates_numericality_of :lat, greater_than: 0
12
15
  validates_numericality_of :lon, less_than: 0
16
+ validates :direction, :inclusion => { :in => DIRECTIONS.values }
13
17
 
14
- validates :id, :time, :lat, :lon, :route_id, :presence => true
18
+ validates :id, :time, :direction, :lat, :lon, :route_id, :presence => true
15
19
 
16
20
  def initialize(attributes={})
17
21
  self.attributes = attributes
@@ -46,7 +50,7 @@ module HrtBus
46
50
  def self.active_buses
47
51
  buses = []
48
52
  curl = ::Curl::Easy.perform(HrtBus::Config.buses_uri) do |c|
49
- c.follow_location = true
53
+ c.timeout = HrtBus::Config.timeout
50
54
  end
51
55
 
52
56
  unless curl.response_code == 226
@@ -56,17 +60,18 @@ module HrtBus
56
60
  parsed = ::CSV.new(curl.body_str, { :headers => true, :skip_blanks => true })
57
61
 
58
62
  parsed.each do |row|
59
- time, date, id, lat_lon, valid, route_id = row[0],
60
- row[1],
61
- row[2],
62
- row[3],
63
- row[4],
64
- row[7]
63
+ time, date, id, lat_lon, valid, route_id, direction = row[0],
64
+ row[1],
65
+ row[2],
66
+ row[3],
67
+ row[4],
68
+ row[7],
69
+ DIRECTIONS[row[8]]
65
70
 
66
71
  time = HrtBus::Parse.time(time, date)
67
72
  lat, lon = HrtBus::Parse.geo(lat_lon)
68
73
 
69
- bus = new(:id => id, :time => time, :route_id => route_id, :lat => lat, :lon => lon)
74
+ bus = new(:id => id, :time => time, :direction => direction, :route_id => route_id, :lat => lat, :lon => lon)
70
75
 
71
76
  buses << bus if bus.valid?
72
77
  end
@@ -76,7 +81,7 @@ module HrtBus
76
81
  def self.all
77
82
  buses = []
78
83
  curl = ::Curl::Easy.perform(HrtBus::Config.buses_uri) do |c|
79
- c.follow_location = true
84
+ c.timeout = HrtBus::Config.timeout
80
85
  end
81
86
 
82
87
  unless curl.response_code == 226
@@ -86,17 +91,18 @@ module HrtBus
86
91
  parsed = ::CSV.new(curl.body_str, { :headers => true, :skip_blanks => true })
87
92
 
88
93
  parsed.each do |row|
89
- time, date, id, lat_lon, valid, route_id = row[0],
90
- row[1],
91
- row[2],
92
- row[3],
93
- row[4],
94
- row[7]
94
+ time, date, id, lat_lon, valid, route_id, direction = row[0],
95
+ row[1],
96
+ row[2],
97
+ row[3],
98
+ row[4],
99
+ row[7],
100
+ DIRECTIONS[row[8]]
95
101
 
96
102
  time = HrtBus::Parse.time(time, date)
97
103
  lat, lon = HrtBus::Parse.geo(lat_lon)
98
104
 
99
- buses << new(:id => id, :time => time, :route_id => route_id, :lat => lat, :lon => lon)
105
+ buses << new(:id => id, :time => time, :direction => direction, :route_id => route_id, :lat => lat, :lon => lon)
100
106
  end
101
107
  buses
102
108
  end
@@ -0,0 +1,49 @@
1
+ module HrtBus
2
+ class Rider
3
+ include ActiveModel::Validations
4
+ include ActiveModel::Serializers::JSON
5
+
6
+ ATTRIBUTES = [ :id, :direction, :time, :lat, :lon, :route_id ]
7
+
8
+ DIRECTIONS = { "1" => "inbound",
9
+ "2" => "outbound" }.freeze
10
+
11
+ attr_accessor *ATTRIBUTES
12
+
13
+ validates_numericality_of :route_id, greater_than: 0
14
+ validates_numericality_of :lat, greater_than: 0, :if => :lat
15
+ validates_numericality_of :lon, less_than: 0, :if => :lon
16
+ validates :direction, :inclusion => { :in => DIRECTIONS.values }
17
+
18
+ validates :route_id, :direction, :presence => true
19
+
20
+ def initialize(attributes={})
21
+ self.attributes = attributes
22
+ end
23
+
24
+ def attributes
25
+ ATTRIBUTES.inject(ActiveSupport::HashWithIndifferentAccess.new) do |result, key|
26
+ result[key] = read_attribute_for_validation(key)
27
+ result
28
+ end
29
+ end
30
+
31
+ def attributes=(attrs)
32
+ attrs.each_pair do |k, v|
33
+ send("#{k}=", v)
34
+ end
35
+ end
36
+
37
+ def read_attribute_for_validation(key)
38
+ send(key)
39
+ end
40
+
41
+ def bus
42
+ HrtBus::Bus.active_buses.select { |bus| (bus.route_id == self.route_id) &&
43
+ (bus.direction == self.direction) }.last
44
+ end
45
+
46
+ end
47
+
48
+ end
49
+
@@ -1,3 +1,3 @@
1
1
  module HrtBus
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/lib/hrt_bus.rb CHANGED
@@ -10,6 +10,7 @@ require "hrt_bus/version"
10
10
  require "hrt_bus/config"
11
11
  require "hrt_bus/parse"
12
12
  require "hrt_bus/bus"
13
+ require "hrt_bus/rider"
13
14
 
14
15
  HrtBus::Config.configure do |config|
15
16
  config.buses_uri = "ftp://216.54.15.3/Anrd/hrtrtf.txt"
@@ -2,10 +2,11 @@ require 'spec_helper'
2
2
 
3
3
  FactoryGirl.define do
4
4
  factory :bus, :class => HrtBus::Bus do
5
- id { SecureRandom.random_number(1e9.to_i) }
5
+ id { SecureRandom.random_number(1e9.to_i) }
6
6
  time { Time.now }
7
7
  lat { 36.8642501 }
8
8
  lon { -76.2818951 }
9
9
  route_id { SecureRandom.random_number(1e9.to_i) }
10
+ direction { %w(inbound outbound).sample }
10
11
  end
11
12
  end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ FactoryGirl.define do
4
+ factory :rider, :class => HrtBus::Rider do
5
+ id {}
6
+ time {}
7
+ lat {}
8
+ lon {}
9
+ route_id { SecureRandom.random_number(1e9.to_i).to_s }
10
+ direction { %w(inbound outbound).sample }
11
+ end
12
+ end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'factories/bus'
3
3
 
4
- describe HrtBus::Bus do
4
+ describe HrtBus::Parse do
5
5
  describe "time" do
6
6
  let(:parsed_time) { HrtBus::Parse.time("01:35:26", "03/03") }
7
7
 
@@ -2,6 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe HrtBus::Bus do
4
4
  it { should respond_to(:id) }
5
+ it { should respond_to(:direction) }
5
6
  it { should respond_to(:route_id) }
6
7
  it { should respond_to(:time) }
7
8
  it { should respond_to(:lat) }
@@ -13,6 +13,37 @@ describe HrtBus::Bus do
13
13
  bus.errors.messages[:id].first.should match(/can't be blank/)
14
14
  end
15
15
 
16
+ context "direction" do
17
+
18
+ it "should validate_presence_of :direction" do
19
+ bus.should be_valid
20
+ bus.direction = nil
21
+ bus.should_not be_valid
22
+ bus.errors.messages[:direction].first.should match(/is not included in the list/)
23
+ end
24
+
25
+ it "should allow values inbound and outbound" do
26
+ bus.should be_valid
27
+
28
+ bus.direction = "inbound"
29
+ bus.should be_valid
30
+
31
+ bus.direction = "outbound"
32
+ bus.should be_valid
33
+ end
34
+
35
+ it "should not allow values 1 or 2" do
36
+ bus.should be_valid
37
+
38
+ bus.direction = "1"
39
+ bus.should_not be_valid
40
+
41
+ bus.direction = "2"
42
+ bus.should_not be_valid
43
+ end
44
+
45
+ end
46
+
16
47
  it "should validate_presence_of :time" do
17
48
  bus.should be_valid
18
49
  bus.time = nil
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe HrtBus::Rider do
4
+ it { should respond_to(:id) }
5
+ it { should respond_to(:time) }
6
+ it { should respond_to(:lat) }
7
+ it { should respond_to(:lon) }
8
+ it { should respond_to(:route_id) }
9
+ it { should respond_to(:direction) }
10
+ end
@@ -0,0 +1,69 @@
1
+ require 'spec_helper'
2
+ require 'factories/rider'
3
+
4
+ describe HrtBus::Rider do
5
+
6
+ describe "bus" do
7
+
8
+ use_vcr_cassette
9
+
10
+ describe "when the server responds with 226" do
11
+
12
+ context "there are NO bus that match the riders route" do
13
+
14
+ let(:bus) { Factory.build(:rider, :route_id => "999999", :direction => "inbound").bus }
15
+
16
+ it "it should return nil" do
17
+ bus.should be_nil
18
+ end
19
+
20
+ end
21
+
22
+ context "there is one bus that matches the riders route" do
23
+
24
+ let(:bus) { Factory.build(:rider, :route_id => "111", :direction => "outbound").bus }
25
+
26
+ it "should return only one bus that matches the riders route" do
27
+ bus.should be_a_kind_of(HrtBus::Bus)
28
+ bus.should be_valid
29
+ bus.route_id.should == "111"
30
+ bus.direction.should == "outbound"
31
+ end
32
+
33
+ end
34
+
35
+ context "there are outbound and inbound buses that match the riders route" do
36
+
37
+ context "inbound" do
38
+
39
+ let(:bus) { Factory.build(:rider, :route_id => "6", :direction => "inbound").bus }
40
+
41
+ it "should return a inbound bus that matches the riders route" do
42
+ bus.direction.should == "inbound"
43
+ bus.should be_a_kind_of(HrtBus::Bus)
44
+ bus.should be_valid
45
+ bus.route_id.should == "6"
46
+ end
47
+
48
+ end
49
+
50
+ context "outbound" do
51
+
52
+ let(:bus) { Factory.build(:rider, :route_id => "6", :direction => "outbound").bus }
53
+
54
+ it "should return a outbound bus that matches the riders route" do
55
+ bus.direction.should == "outbound"
56
+ bus.should be_a_kind_of(HrtBus::Bus)
57
+ bus.should be_valid
58
+ bus.route_id.should == "6"
59
+ end
60
+
61
+ end
62
+
63
+ end
64
+
65
+ end
66
+
67
+ end
68
+
69
+ end
@@ -0,0 +1,49 @@
1
+ require 'spec_helper'
2
+ require 'factories/rider'
3
+
4
+ describe HrtBus::Rider do
5
+ describe "validations" do
6
+
7
+ let(:rider) { Factory.build(:rider) }
8
+
9
+ it "should validate_presence_of :route_id" do
10
+ rider.should be_valid
11
+ rider.route_id = nil
12
+ rider.should_not be_valid
13
+ rider.errors.messages[:route_id].first.should match(/is not a number/)
14
+ end
15
+
16
+ context "direction" do
17
+
18
+ it "should validate_presence_of :direction" do
19
+ rider.should be_valid
20
+ rider.direction = nil
21
+ rider.should_not be_valid
22
+ rider.errors.messages[:direction].first.should match(/is not included in the list/)
23
+ end
24
+
25
+ it "should allow values inbound and outbound" do
26
+ rider.should be_valid
27
+
28
+ rider.direction = "inbound"
29
+ rider.should be_valid
30
+
31
+ rider.direction = "outbound"
32
+ rider.should be_valid
33
+ end
34
+
35
+ it "should not allow values 1 or 2" do
36
+ rider.should be_valid
37
+
38
+ rider.direction = "1"
39
+ rider.should_not be_valid
40
+
41
+ rider.direction = "2"
42
+ rider.should_not be_valid
43
+ end
44
+
45
+ end
46
+
47
+ end
48
+
49
+ end
@@ -0,0 +1,347 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://ftp//216.54.15.3/Anrd/hrtrtf.txt
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ""
9
+ headers: {}
10
+
11
+ response:
12
+ status:
13
+ code: 226
14
+ message:
15
+ headers:
16
+ 220 microsoft ftp service:
17
+ - ""
18
+ 331 anonymous access allowed, send identity (e-Mail name) as password.:
19
+ - ""
20
+ 230-Hampton roads transit:
21
+ - ""
22
+ 230 anonymous user logged in.:
23
+ - ""
24
+ 257 "/" is current directory.:
25
+ - ""
26
+ 250 cwd command successful.:
27
+ - ""
28
+ 500 'epsv':
29
+ - command not understood
30
+ 227 entering passive mode (216,54,15,3,7,35).:
31
+ - ""
32
+ 200 type set to i.:
33
+ - ""
34
+ 213 14723:
35
+ - ""
36
+ 125 data connection already open; transfer starting.:
37
+ - ""
38
+ 226 transfer complete.:
39
+ - ""
40
+ body:
41
+ encoding: ASCII-8BIT
42
+ string: |
43
+ Time,Date,Vehicle,Lat/Lon,Location Valid/Invalid,Adherence,Adherence Valid/Invalid[,Route,Direction,Stop]
44
+ 20:50:39,03/03,1802,368639687/-762815846,V,0,I
45
+ 20:50:39,03/03,2036,370127298/-763651866,V,0,I
46
+ 20:50:40,03/03,1218,369799652/-764317265,V,-2,V
47
+ 20:50:40,03/03,2030,371046013/-765104492,V,-16,V
48
+ 20:50:40,03/03,5007,368631328/-762847983,V,0,I
49
+ 20:50:40,03/03,1513,370622591/-764190509,V,-1,V
50
+ 20:50:41,03/03,1509,371487591/-765060070,V,1,V,111,2,2692
51
+ 20:50:41,03/03,1810,368217171/-762730441,V,-6,V,6,1,472
52
+ 20:50:41,03/03,1706,368644403/-762819536,V,0,I
53
+ 20:50:42,03/03,1241,369535410/-762517513,V,0,V
54
+ 20:50:42,03/03,2025,368477775/-762907496,V,-5,V
55
+ 20:50:42,03/03,4011,368640134/-762815004,V,0,I
56
+ 20:50:43,03/03,2048,369952626/-764263040,V,0,V
57
+ 20:50:43,03/03,1509,371489001/-765066281,V,0,V
58
+ 20:50:44,03/03,4004,368499616/-762401477,V,-4,V
59
+ 20:50:44,03/03,1810,368219658/-762726700,V,-3,V
60
+ 20:50:45,03/03,1215,370312358/-763468514,V,0,V
61
+ 20:50:46,03/03,3033,368482158/-759861647,V,0,I
62
+ 20:50:47,03/03,2015,368480044/-762844929,V,-1,V
63
+ 20:50:48,03/03,1712,369455110/-762736136,V,0,I
64
+ 20:50:48,03/03,3025,369834912/-764351064,V,4,V
65
+ 20:50:48,03/03,2002,368638352/-762808300,V,0,I
66
+ 20:50:48,03/03,3008,368639470/-762814843,V,0,I
67
+ 20:50:49,03/03,1240,368639355/-762818144,V,0,I
68
+ 20:50:49,03/03,3015,368635562/-762802840,V,0,I
69
+ 20:50:49,03/03,1803,368643664/-762818321,V,0,I
70
+ 20:50:51,03/03,2028,368557984/-762327027,V,0,V
71
+ 20:50:54,03/03,2037,369945877/-764361686,V,-2,V
72
+ 20:50:54,03/03,1705,368521521/-762031725,V,-3,V,23,2,916
73
+ 20:50:54,03/03,2012,368545104/-762028424,V,-2,V
74
+ 20:50:55,03/03,2039,370128071/-763645936,V,0,I
75
+ 20:50:55,03/03,1807,368616397/-763026087,V,0,I
76
+ 20:50:56,03/03,3027,368625249/-762861133,V,0,I
77
+ 20:50:56,03/03,2027,368267339/-763066091,V,1,V
78
+ 20:50:56,03/03,2050,370420005/-763890079,V,-3,V
79
+ 20:50:56,03/03,2001,368645108/-762818121,V,0,I
80
+ 20:50:57,03/03,4019,368562659/-763031966,V,0,I
81
+ 20:50:57,03/03,1705,368521647/-762028911,V,-3,V
82
+ 20:50:58,03/03,2005,368488226/-760328367,V,-2,V
83
+ 20:50:58,03/03,1800,368638983/-762821432,V,0,I
84
+ 20:50:58,03/03,1226,368641166/-762814809,V,0,I
85
+ 20:50:58,03/03,2044,369568567/-763210677,V,0,I
86
+ 20:50:59,03/03,4001,368555566/-763036234,V,-7,V
87
+ 20:50:59,03/03,2045,368592745/-762844987,V,0,V
88
+ 20:51:00,03/03,1204,371670153/-765600896,V,15,V
89
+ 20:51:00,03/03,null,368209385/-761248325,V,0,I
90
+ 20:51:01,03/03,1714,368498854/-762017343,V,-1,V
91
+ 20:51:01,03/03,2051,370129252/-763646698,V,0,I
92
+ 20:51:01,03/03,1208,370263261/-763498245,V,-3,V
93
+ 20:51:02,03/03,1245,368639676/-762817399,V,0,I
94
+ 20:51:02,03/03,1202,370128942/-763649992,V,0,I
95
+ 20:51:02,03/03,2029,370310524/-763458836,V,-1,V
96
+ 20:51:03,03/03,1221,370517551/-763472759,V,-3,V,115,1,2897
97
+ 20:51:03,03/03,1901,371016053/-765032436,V,-8,V
98
+ 20:51:04,03/03,1221,370523596/-763472009,V,-3,V
99
+ 20:51:05,03/03,4010,368640071/-762816247,V,0,I
100
+ 20:51:06,03/03,1247,368644432/-762813760,V,0,I
101
+ 20:51:06,03/03,null,370127871/-763640132,I,0,I
102
+ 20:51:06,03/03,2008,368645005/-762819565,V,0,I
103
+ 20:51:06,03/03,1210,370622419/-764188733,V,-1,V
104
+ 20:51:06,03/03,1610,370218140/-764224239,V,-2,V
105
+ 20:51:08,03/03,1209,370427751/-762933102,V,0,V
106
+ 20:51:09,03/03,4000,368589915/-762845686,V,0,V
107
+ 20:51:09,03/03,1810,368217830/-762719383,V,-3,V,6,2,472
108
+ 20:51:09,03/03,1905,371897652/-765716823,V,0,I
109
+ 20:51:10,03/03,1501,368641292/-762818854,V,0,I
110
+ 20:51:10,03/03,2021,368419907/-759930780,V,-2,V
111
+ 20:51:10,03/03,1206,370128455/-763654765,V,0,I
112
+ 20:51:11,03/03,4030,368977005/-761452184,V,-1,V
113
+ 20:51:11,03/03,1907,370624877/-764852155,V,-1,V
114
+ 20:51:11,03/03,2014,369282472/-763175537,V,-5,V
115
+ 20:51:11,03/03,1257,368221142/-762706824,V,-1,V
116
+ 20:51:12,03/03,2024,368489183/-762095690,V,-1,V
117
+ 20:51:12,03/03,901,368546169/-762396550,V,0,I
118
+ 20:51:13,03/03,4005,368911407/-763040234,V,-5,V
119
+ 20:51:13,03/03,1211,370125230/-763651912,V,0,I
120
+ 20:51:13,03/03,4009,368458381/-762900627,V,-9,V
121
+ 20:51:14,03/03,null,368587474/-762848006,V,0,I
122
+ 20:51:14,03/03,1906,371638084/-765573251,V,0,V
123
+ 20:51:15,03/03,2019,368639470/-762822762,V,0,I
124
+ 20:51:15,03/03,1809,368641618/-762816379,V,0,I
125
+ 20:51:16,03/03,1810,368217297/-762719005,V,-3,V
126
+ 20:51:16,03/03,2049,370191017/-764377248,V,0,V
127
+ 20:51:17,03/03,1704,368644220/-762815468,V,0,I
128
+ 20:51:18,03/03,2018,367941109/-762345402,V,1,V
129
+ 20:51:18,03/03,2010,368581234/-763035518,V,0,I
130
+ 20:51:19,03/03,1507,370622792/-764193913,V,-1,V
131
+ 20:51:19,03/03,2023,369483070/-763285041,V,0,V
132
+ 20:51:20,03/03,null,368398169/-762945077,V,0,I
133
+ 20:51:21,03/03,2022,368644793/-762821215,V,0,I
134
+ 20:51:21,03/03,1213,370128931/-763649460,V,0,I
135
+ 20:51:22,03/03,2026,368552403/-761993715,V,0,V
136
+ 20:51:22,03/03,1909,369774201/-764277771,V,-4,V
137
+ 20:51:24,03/03,1205,370125957/-763651963,V,0,I
138
+ 20:51:26,03/03,1710,368650236/-762799007,I,0,I
139
+ 20:51:26,03/03,2041,368639493/-762819163,V,0,I
140
+ 20:51:26,03/03,1902,370128060/-763647878,V,0,I
141
+ 20:51:27,03/03,2034,369928997/-764280710,V,-2,V
142
+ 20:51:27,03/03,2047,370127504/-763653803,V,0,I
143
+ 20:51:28,03/03,2043,369387982/-763187759,V,-1,V
144
+ 20:51:29,03/03,1801,368640077/-762818367,V,0,I
145
+ 20:51:30,03/03,5003,368991982/-762054815,V,0,V
146
+ 20:51:31,03/03,1217,369852272/-764132887,V,-1,V
147
+ 20:51:31,03/03,1214,370307058/-763469493,V,0,V
148
+ 20:51:32,03/03,1702,368641916/-762813703,V,0,I
149
+ 20:51:32,03/03,3007,368480130/-759764680,V,-1,V
150
+ 20:51:32,03/03,2033,369783294/-764285277,V,-3,V
151
+ 20:51:33,03/03,1503,368339091/-762523288,I,0,I
152
+ 20:51:33,03/03,4014,368643028/-762825936,V,0,I
153
+ 20:51:34,03/03,2029,370298990/-763476518,V,0,V,114,1,2047
154
+ 20:51:35,03/03,1601,368642174/-762812065,V,0,I
155
+ 20:51:36,03/03,1709,368644363/-762816751,V,0,I
156
+ 20:51:37,03/03,2029,370297627/-763484029,V,0,V
157
+ 20:51:38,03/03,1250,368641320/-762818029,V,0,I
158
+ 20:51:38,03/03,1233,368642289/-762827414,V,0,I
159
+ 20:51:39,03/03,1802,368639687/-762815846,V,0,I
160
+ 20:51:39,03/03,2036,370127298/-763651866,V,0,I
161
+ 20:51:39,03/03,1218,369834178/-764338716,V,-1,V
162
+ 20:51:40,03/03,2030,371046013/-765104492,V,-17,V
163
+ 20:51:40,03/03,5007,368631328/-762847983,V,0,I
164
+ 20:51:40,03/03,1255,367873609/-761011734,V,3,V
165
+ 20:51:40,03/03,1513,370622591/-764190509,V,-2,V
166
+ 20:51:41,03/03,1901,371051439/-765067547,V,-8,V,107,1,2665
167
+ 20:51:41,03/03,1706,368644403/-762819536,V,0,I
168
+ 20:51:42,03/03,1303,368644346/-762812901,V,0,I
169
+ 20:51:42,03/03,1241,369535410/-762517513,V,-1,V
170
+ 20:51:42,03/03,2025,368476011/-762893688,V,-5,V
171
+ 20:51:42,03/03,1907,370619520/-764846913,V,-1,V,112,2,5713
172
+ 20:51:42,03/03,4011,368640134/-762815004,V,0,I
173
+ 20:51:43,03/03,1901,371053438/-765070888,V,-8,V
174
+ 20:51:44,03/03,4004,368499427/-762373500,V,-4,V
175
+ 20:51:44,03/03,1509,371493109/-765101294,V,0,V
176
+ 20:51:44,03/03,1907,370616335/-764843767,V,-2,V
177
+ 20:51:46,03/03,3033,368473352/-759907885,V,0,I
178
+ 20:51:47,03/03,2015,368502413/-762846385,V,-1,V
179
+ 20:51:48,03/03,1712,369455110/-762736136,V,0,I
180
+ 20:51:48,03/03,3025,369834912/-764351064,V,3,V
181
+ 20:51:48,03/03,2002,368638352/-762808300,V,0,I
182
+ 20:51:48,03/03,3008,368646357/-762811394,V,0,I
183
+ 20:51:49,03/03,1240,368639355/-762818144,V,0,I
184
+ 20:51:49,03/03,3015,368635562/-762802840,V,0,I
185
+ 20:51:49,03/03,1803,368643664/-762818321,V,0,I
186
+ 20:51:51,03/03,2028,368617967/-762340016,V,1,V
187
+ 20:51:52,03/03,2048,369975722/-764266529,V,0,V
188
+ 20:51:54,03/03,2037,370001287/-764393720,V,-2,V
189
+ 20:51:54,03/03,2012,368545104/-762028424,V,-3,V
190
+ 20:51:55,03/03,2039,370128071/-763645936,V,0,I
191
+ 20:51:55,03/03,1807,368616397/-763026087,V,0,I
192
+ 20:51:56,03/03,3027,368610192/-762866524,V,0,I
193
+ 20:51:56,03/03,2027,368247933/-763065043,V,0,V
194
+ 20:51:56,03/03,2050,370385255/-763866324,V,-2,V
195
+ 20:51:56,03/03,2001,368645108/-762818121,V,0,I
196
+ 20:51:58,03/03,2005,368471576/-760357244,V,-2,V
197
+ 20:51:58,03/03,4019,368564069/-763031301,V,0,I
198
+ 20:51:58,03/03,1800,368638983/-762821432,V,0,I
199
+ 20:51:58,03/03,1705,368547470/-762030544,V,-2,V
200
+ 20:51:58,03/03,2044,369568567/-763210677,V,0,I
201
+ 20:51:59,03/03,1226,368641166/-762814809,V,0,I
202
+ 20:51:59,03/03,4001,368555566/-763036234,V,-8,V
203
+ 20:52:00,03/03,1204,371606343/-765573131,V,16,V
204
+ 20:52:00,03/03,null,368209385/-761248325,V,0,I
205
+ 20:52:01,03/03,1714,368489114/-762083165,V,0,V
206
+ 20:52:01,03/03,2051,370129252/-763646698,V,0,I
207
+ 20:52:01,03/03,2045,368592745/-762844987,V,0,V
208
+ 20:52:01,03/03,1208,370246525/-763498537,V,-4,V
209
+ 20:52:01,03/03,1215,370312358/-763468514,V,0,V
210
+ 20:52:02,03/03,1245,368639676/-762817399,V,0,I
211
+ 20:52:02,03/03,1202,370128942/-763649992,V,0,I
212
+ 20:52:02,03/03,2026,368550931/-761958077,I,0,I
213
+ 20:52:05,03/03,4010,368640071/-762816247,V,0,I
214
+ 20:52:05,03/03,1221,370590471/-763445424,V,-2,V
215
+ 20:52:06,03/03,1247,368644432/-762813760,V,0,I
216
+ 20:52:06,03/03,null,370127871/-763640132,I,0,I
217
+ 20:52:06,03/03,2008,368645005/-762819565,V,0,I
218
+ 20:52:06,03/03,1210,370622419/-764188733,V,-2,V
219
+ 20:52:06,03/03,1610,370208635/-764257408,V,-3,V
220
+ 20:52:08,03/03,1209,370427751/-762933102,V,-1,V
221
+ 20:52:09,03/03,4000,368589915/-762845686,V,0,V
222
+ 20:52:09,03/03,1905,371933496/-765734951,V,0,I
223
+ 20:52:10,03/03,1501,368639974/-762820143,V,0,I
224
+ 20:52:10,03/03,1218,369838562/-764346635,V,-1,V,103,1,2000
225
+ 20:52:10,03/03,2021,368425522/-759899955,V,-2,V
226
+ 20:52:10,03/03,1206,370128455/-763654765,V,0,I
227
+ 20:52:11,03/03,4030,368956464/-761551586,V,-1,V
228
+ 20:52:11,03/03,2014,369282472/-763175537,V,-6,V
229
+ 20:52:11,03/03,1257,368252901/-762684226,V,-1,V
230
+ 20:52:12,03/03,2024,368486673/-762103006,V,-1,V
231
+ 20:52:12,03/03,901,368527130/-762500307,V,0,I
232
+ 20:52:13,03/03,4005,368877144/-763044456,V,-4,V
233
+ 20:52:13,03/03,1211,370125230/-763651912,V,0,I
234
+ 20:52:13,03/03,1218,369837530/-764348657,V,0,V
235
+ 20:52:15,03/03,2019,368639470/-762822762,V,0,I
236
+ 20:52:15,03/03,1809,368641618/-762816379,V,0,I
237
+ 20:52:16,03/03,1230,368639023/-762819559,V,0,I
238
+ 20:52:16,03/03,2049,370207913/-764334184,V,1,V
239
+ 20:52:17,03/03,1704,368644220/-762815468,V,0,I
240
+ 20:52:18,03/03,2018,368004604/-762302367,V,2,V
241
+ 20:52:18,03/03,1810,368217297/-762719005,V,-4,V
242
+ 20:52:18,03/03,2010,368555486/-763035535,V,0,I
243
+ 20:52:19,03/03,1507,370622792/-764193913,V,-2,V
244
+ 20:52:20,03/03,null,368384091/-762950296,V,0,I
245
+ 20:52:21,03/03,2022,368644793/-762821215,V,0,I
246
+ 20:52:21,03/03,1213,370128931/-763649460,V,0,I
247
+ 20:52:22,03/03,1909,369813644/-764211755,V,-3,V
248
+ 20:52:24,03/03,1205,370125957/-763651963,V,0,I
249
+ 20:52:26,03/03,1710,368660451/-762798102,I,0,I
250
+ 20:52:26,03/03,2041,368639493/-762819163,V,0,I
251
+ 20:52:26,03/03,1902,370128060/-763647878,V,0,I
252
+ 20:52:27,03/03,2034,370006879/-764328919,V,-1,V
253
+ 20:52:27,03/03,2047,370134552/-763650972,V,0,I
254
+ 20:52:28,03/03,2043,369346786/-763179021,V,-1,V
255
+ 20:52:29,03/03,1801,368640077/-762818367,V,0,I
256
+ 20:52:30,03/03,5003,368991982/-762054815,V,0,V
257
+ 20:52:31,03/03,1217,369876085/-764147818,V,-1,V
258
+ 20:52:32,03/03,1702,368641916/-762813703,V,0,I
259
+ 20:52:32,03/03,3007,368472854/-759764485,V,-2,V
260
+ 20:52:32,03/03,2033,369798426/-764230284,V,-2,V
261
+ 20:52:32,03/03,1214,370307058/-763469493,V,0,V
262
+ 20:52:33,03/03,1503,368339091/-762523288,I,0,I
263
+ 20:52:33,03/03,4014,368643028/-762825936,V,0,I
264
+ 20:52:34,03/03,2000,368891141/-762793403,V,-2,V
265
+ 20:52:35,03/03,1601,368642174/-762812065,V,0,I
266
+ 20:52:36,03/03,1709,368644363/-762816751,V,0,I
267
+ 20:52:38,03/03,1250,368641320/-762818029,V,0,I
268
+ 20:52:38,03/03,1908,370130644/-763648600,V,0,I
269
+ 20:52:38,03/03,1233,368642289/-762827414,V,0,I
270
+ 20:52:38,03/03,2029,370316506/-763527271,V,0,V
271
+ 20:52:39,03/03,1802,368639687/-762815846,V,0,I
272
+ 20:52:39,03/03,2036,370127298/-763651866,V,0,I
273
+ 20:52:39,03/03,2030,371046013/-765104492,V,-18,V
274
+ 20:52:40,03/03,5007,368631328/-762847983,V,0,I
275
+ 20:52:40,03/03,1513,370622591/-764190509,V,-3,V
276
+ 20:52:41,03/03,1255,367873609/-761011734,V,2,V
277
+ 20:52:41,03/03,1706,368644403/-762819536,V,0,I
278
+ 20:52:42,03/03,1241,369540818/-762515169,V,-2,V
279
+ 20:52:42,03/03,2025,368474848/-762871205,V,-6,V
280
+ 20:52:42,03/03,4011,368640134/-762815004,V,0,I
281
+ 20:52:43,03/03,1905,371928448/-765744577,V,-28,V,116,1,3330
282
+ 20:52:44,03/03,1509,371432559/-765158688,V,1,V
283
+ 20:52:44,03/03,1901,371053501/-764990960,V,-6,V
284
+ 20:52:45,03/03,4000,368596360/-762845560,V,0,V,18,1,3222
285
+ 20:52:45,03/03,1907,370595863/-764842805,V,-2,V
286
+ 20:52:46,03/03,3033,368477179/-760063689,V,0,I
287
+ 20:52:47,03/03,2015,368534670/-762853552,V,-1,V
288
+ 20:52:48,03/03,4000,368598148/-762846872,V,0,V
289
+ 20:52:48,03/03,1712,369455110/-762736136,V,0,I
290
+ 20:52:48,03/03,3025,369834912/-764351064,V,2,V
291
+ 20:52:48,03/03,2002,368638352/-762808300,V,0,I
292
+ 20:52:48,03/03,3008,368646122/-762814139,V,0,I
293
+ 20:52:49,03/03,1240,368639355/-762818144,V,0,I
294
+ 20:52:49,03/03,3015,368635562/-762802840,V,0,I
295
+ 20:52:49,03/03,1803,368643664/-762818321,V,0,I
296
+ 20:52:50,03/03,1905,371931806/-765737295,V,-23,V,116,1,3330
297
+ 20:52:51,03/03,2028,368668536/-762347138,V,2,V
298
+ 20:52:52,03/03,1905,371934327/-765732184,V,-23,V
299
+ 20:52:53,03/03,1249,369152674/-762123123,V,2,V
300
+ 20:52:54,03/03,2037,370073228/-764438308,V,-1,V
301
+ 20:52:54,03/03,2048,369984769/-764248836,V,-1,V
302
+ 20:52:54,03/03,2012,368545104/-762028424,V,-4,V
303
+ 20:52:55,03/03,2039,370128071/-763645936,V,0,I
304
+ 20:52:55,03/03,1807,368616397/-763026087,V,0,I
305
+ 20:52:56,03/03,3027,368595438/-762842099,V,0,I
306
+ 20:52:56,03/03,2050,370382075/-763809229,V,-2,V
307
+ 20:52:56,03/03,2001,368645108/-762818121,V,0,I
308
+ 20:52:58,03/03,2005,368471576/-760357244,V,-3,V
309
+ 20:52:58,03/03,4019,368578014/-763035117,V,0,I
310
+ 20:52:58,03/03,1800,368638983/-762821432,V,0,I
311
+ 20:52:58,03/03,1705,368569615/-762040966,V,-2,V
312
+ 20:52:58,03/03,1226,368641166/-762814809,V,0,I
313
+ 20:52:58,03/03,2044,369568567/-763210677,V,0,I
314
+ 20:52:59,03/03,2027,368192144/-763062699,V,0,V,45,1,1646
315
+ 20:52:59,03/03,4001,368555566/-763036234,V,-9,V
316
+ 20:53:00,03/03,1204,371587882/-765571664,V,15,V
317
+ 20:53:00,03/03,2027,368188764/-763063347,V,0,V
318
+ 20:53:00,03/03,null,368209385/-761248325,V,0,I
319
+ 20:53:01,03/03,1714,368431142/-762104118,V,1,V
320
+ 20:53:01,03/03,2051,370129252/-763646698,V,0,I
321
+ 20:53:01,03/03,2045,368592745/-762844987,V,0,V
322
+ 20:53:01,03/03,1208,370216267/-763526285,V,-4,V
323
+ 20:53:02,03/03,1245,368639676/-762817399,V,0,I
324
+ 20:53:02,03/03,1202,370128942/-763649992,V,0,I
325
+ 20:53:02,03/03,1215,370312358/-763468514,V,0,V
326
+ 20:53:03,03/03,2026,368508297/-761919986,V,0,I
327
+ 20:53:05,03/03,2045,368592745/-762844987,V,0,V
328
+ 20:53:05,03/03,4010,368640071/-762816247,V,0,I
329
+ 20:53:05,03/03,1221,370616054/-763397943,V,-2,V
330
+ 20:53:06,03/03,1247,368644432/-762813760,V,0,I
331
+ 20:53:06,03/03,null,370127871/-763640132,I,0,I
332
+ 20:53:06,03/03,1210,370622419/-764188733,V,-3,V
333
+ 20:53:06,03/03,2008,368645005/-762819565,V,0,I
334
+ 20:53:06,03/03,1610,370192535/-764297011,V,-3,V
335
+ 20:53:07,03/03,2048,369992017/-764253529,V,-1,V,105,1,2416
336
+ 20:53:08,03/03,1209,370444189/-762973071,V,-1,V
337
+ 20:53:09,03/03,2048,369997340/-764256783,V,-1,V
338
+ 20:53:09,03/03,1241,369529457/-762501464,V,-2,V,1,2,53
339
+ 20:53:10,03/03,2045,368592745/-762844987,V,0,V
340
+ 20:53:10,03/03,1501,368639974/-762820143,V,0,I
341
+ 20:53:10,03/03,2021,368436654/-759836231,V,-2,V
342
+ 20:53:10,03/03,1206,370128455/-763654765,V,0,I
343
+
344
+
345
+ http_version:
346
+ recorded_at: Sun, 04 Mar 2012 01:54:01 GMT
347
+ recorded_with: VCR 2.0.0.rc2
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: hrt_bus
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.4
5
+ version: 0.0.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Brian Douglas Smith
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-03-03 00:00:00 Z
13
+ date: 2012-03-04 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activemodel
@@ -167,17 +167,23 @@ files:
167
167
  - lib/hrt_bus/bus.rb
168
168
  - lib/hrt_bus/config.rb
169
169
  - lib/hrt_bus/parse.rb
170
+ - lib/hrt_bus/rider.rb
170
171
  - lib/hrt_bus/version.rb
171
172
  - spec/factories/bus.rb
173
+ - spec/factories/rider.rb
172
174
  - spec/helpers/parse_methods_spec.rb
173
- - spec/models/bus_attributes_spec.rb
174
- - spec/models/bus_methods_spec.rb
175
- - spec/models/bus_validations_spec.rb
175
+ - spec/models/bus/bus_attributes_spec.rb
176
+ - spec/models/bus/bus_methods_spec.rb
177
+ - spec/models/bus/bus_validations_spec.rb
178
+ - spec/models/rider/rider_attributes_spec.rb
179
+ - spec/models/rider/rider_methods_spec.rb
180
+ - spec/models/rider/rider_validations_spec.rb
176
181
  - spec/spec_helper.rb
177
182
  - spec/support/vcr_setup.rb
178
183
  - vcr_cassettes/HrtBus_Bus/active_buses.yml
179
184
  - vcr_cassettes/HrtBus_Bus/all.yml
180
185
  - vcr_cassettes/HrtBus_Bus/static_map.yml
186
+ - vcr_cassettes/HrtBus_Rider/bus.yml
181
187
  homepage: https://github.com/bds/hrt_bus
182
188
  licenses: []
183
189
 
@@ -207,9 +213,13 @@ specification_version: 3
207
213
  summary: Ruby gem for real-time public HRT bus location data
208
214
  test_files:
209
215
  - spec/factories/bus.rb
216
+ - spec/factories/rider.rb
210
217
  - spec/helpers/parse_methods_spec.rb
211
- - spec/models/bus_attributes_spec.rb
212
- - spec/models/bus_methods_spec.rb
213
- - spec/models/bus_validations_spec.rb
218
+ - spec/models/bus/bus_attributes_spec.rb
219
+ - spec/models/bus/bus_methods_spec.rb
220
+ - spec/models/bus/bus_validations_spec.rb
221
+ - spec/models/rider/rider_attributes_spec.rb
222
+ - spec/models/rider/rider_methods_spec.rb
223
+ - spec/models/rider/rider_validations_spec.rb
214
224
  - spec/spec_helper.rb
215
225
  - spec/support/vcr_setup.rb