hrt_bus 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ * 0.0.1
2
+
3
+ > Inital release
4
+
5
+ * 0.0.2
6
+
7
+ > README
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Brian Douglas Smith
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,86 @@
1
+ # hrt_bus
2
+
3
+ Ruby gem for public HRT bus location data
4
+
5
+ ### Installation
6
+
7
+ gem intall hrt_bus
8
+
9
+ ### A collection of HRT buses as Ruby ActiveModel objects
10
+
11
+ ruby-1.9.2-p180 :001 > HrtBus::Bus.active_buses
12
+
13
+ [
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
+ >
21
+ >,
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
+ >
29
+ >
30
+ ]
31
+ ...
32
+
33
+ ### A collection of HRT buses as JSON
34
+
35
+ ruby-1.9.2-p180 :001 > HrtBus::Bus.active_buses.to_json
36
+
37
+ [
38
+ {
39
+ "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"
45
+ }
46
+ },
47
+ {
48
+ "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"
54
+ }
55
+ }
56
+ ]
57
+ ...
58
+
59
+ ### Buses from a specific route
60
+
61
+ HrtBus::Bus.active_buses.select { |bus| bus.route_id == "105" }
62
+
63
+ ### Generate a static Google Map for a bus
64
+
65
+ HrtBus::Bus.active_buses.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
+ ### Determine if a bus is valid
70
+
71
+ HrtBus::Bus.active_buses.last.valid?
72
+
73
+ ## Contributing to hrt_bus
74
+
75
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
76
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
77
+ * Fork the project
78
+ * Start a feature/bugfix branch
79
+ * Commit and push until you are happy with your contribution
80
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
81
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
82
+
83
+ ## Copyright
84
+
85
+ Copyright (c) Brian Douglas Smith. See LICENSE.txt for
86
+ further details.
data/examples/map.png ADDED
Binary file
data/lib/hrt_bus/bus.rb CHANGED
@@ -66,9 +66,9 @@ module HrtBus
66
66
  time = HrtBus::Parse.time([time, date].join(""))
67
67
  lat, lon = HrtBus::Parse.geo(lat_lon)
68
68
 
69
- if valid == "V"
70
- buses << new(:id => id, :time => time, :route_id => route_id, :lat => lat, :lon => lon)
71
- end
69
+ bus = new(:id => id, :time => time, :route_id => route_id, :lat => lat, :lon => lon)
70
+
71
+ buses << bus if bus.valid?
72
72
  end
73
73
  buses
74
74
  end
@@ -1,3 +1,3 @@
1
1
  module HrtBus
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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.1
5
+ version: 0.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Brian Douglas Smith
@@ -156,8 +156,12 @@ extra_rdoc_files: []
156
156
  files:
157
157
  - .gitignore
158
158
  - .rspec
159
+ - CHANGELOG.md
159
160
  - Gemfile
161
+ - LICENSE.txt
162
+ - README.md
160
163
  - Rakefile
164
+ - examples/map.png
161
165
  - hrt_bus.gemspec
162
166
  - lib/hrt_bus.rb
163
167
  - lib/hrt_bus/bus.rb