mass_highways 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/CONTRIBUTING.md +25 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +22 -0
- data/README.md +46 -0
- data/Rakefile +20 -0
- data/lib/mass_highways/event.rb +42 -0
- data/lib/mass_highways/event_feed.rb +16 -0
- data/lib/mass_highways/pair.rb +29 -0
- data/lib/mass_highways/travel_feed.rb +16 -0
- data/lib/mass_highways/version.rb +3 -0
- data/lib/mass_highways.rb +11 -0
- data/mass_highways.gemspec +26 -0
- data/test/cassettes/event_feed.yml +3143 -0
- data/test/cassettes/travel_feed.yml +48977 -0
- data/test/event_feed_test.rb +41 -0
- data/test/test_helper.rb +11 -0
- data/test/travel_feed_test.rb +40 -0
- metadata +137 -0
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
describe MassHighways::EventFeed do
|
4
|
+
describe '.retrieve' do
|
5
|
+
let(:feed) { MassHighways::EventFeed.retrieve }
|
6
|
+
let(:event) { feed.find { |f| f.event_id == 37626} }
|
7
|
+
before do
|
8
|
+
VCR.use_cassette 'event_feed' do
|
9
|
+
feed
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'retrieves an array of evets' do
|
14
|
+
event.wont_be_nil
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'converts event_id to Fixnum' do
|
18
|
+
event.event_id.must_be_instance_of Fixnum
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'converts event_created_date to DateTime' do
|
22
|
+
event.event_created_date.must_be_instance_of DateTime
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'converts event_start_date to DateTime' do
|
26
|
+
event.event_start_date.must_be_instance_of DateTime
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'converts last_update to DateTime' do
|
30
|
+
event.last_update.must_be_instance_of DateTime
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'converts the primary_latitude to Float' do
|
34
|
+
event.primary_latitude.must_be_instance_of Float
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'converts the primary_latitude to Float' do
|
38
|
+
event.primary_longitude.must_be_instance_of Float
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
describe MassHighways::TravelFeed do
|
4
|
+
describe '.retrieve' do
|
5
|
+
let(:feed) { MassHighways::TravelFeed.retrieve }
|
6
|
+
let(:i93_south) { feed.find { |f| f.title == 'I-93 SB ramps to Rte. 3 TO Rte. 3 SB after Rte. 18 SB Ramps' } }
|
7
|
+
before do
|
8
|
+
VCR.use_cassette 'travel_feed' do
|
9
|
+
feed
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'retrieves an array of pairs' do
|
14
|
+
i93_south.wont_be_nil
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'converts speed to Float' do
|
18
|
+
i93_south.speed.must_be_instance_of Float
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'converts pair_id to Fixnum' do
|
22
|
+
i93_south.pair_id.must_be_instance_of Fixnum
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'converts travel_time to Float' do
|
26
|
+
i93_south.travel_time.must_be_instance_of Float
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'converts freeflow to Float' do
|
30
|
+
i93_south.freeflow.must_be_instance_of Float
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'converts route into an array of hashes' do
|
34
|
+
route_coordinate = i93_south.route.first
|
35
|
+
route_coordinate.must_be_instance_of Hash
|
36
|
+
route_coordinate.keys.must_include :lat
|
37
|
+
route_coordinate.keys.must_include :lon
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
metadata
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mass_highways
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dan McClain
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-03-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: excon
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: nokogiri
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.5'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.5'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: vcr
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: ''
|
84
|
+
email:
|
85
|
+
- git@danmcclain.net
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- CONTRIBUTING.md
|
92
|
+
- Gemfile
|
93
|
+
- LICENSE.txt
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- lib/mass_highways.rb
|
97
|
+
- lib/mass_highways/event.rb
|
98
|
+
- lib/mass_highways/event_feed.rb
|
99
|
+
- lib/mass_highways/pair.rb
|
100
|
+
- lib/mass_highways/travel_feed.rb
|
101
|
+
- lib/mass_highways/version.rb
|
102
|
+
- mass_highways.gemspec
|
103
|
+
- test/cassettes/event_feed.yml
|
104
|
+
- test/cassettes/travel_feed.yml
|
105
|
+
- test/event_feed_test.rb
|
106
|
+
- test/test_helper.rb
|
107
|
+
- test/travel_feed_test.rb
|
108
|
+
homepage: ''
|
109
|
+
licenses:
|
110
|
+
- MIT
|
111
|
+
metadata: {}
|
112
|
+
post_install_message:
|
113
|
+
rdoc_options: []
|
114
|
+
require_paths:
|
115
|
+
- lib
|
116
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
requirements: []
|
127
|
+
rubyforge_project:
|
128
|
+
rubygems_version: 2.2.2
|
129
|
+
signing_key:
|
130
|
+
specification_version: 4
|
131
|
+
summary: Ruby wrapper for Massachusetts DOT traffic and event feeds
|
132
|
+
test_files:
|
133
|
+
- test/cassettes/event_feed.yml
|
134
|
+
- test/cassettes/travel_feed.yml
|
135
|
+
- test/event_feed_test.rb
|
136
|
+
- test/test_helper.rb
|
137
|
+
- test/travel_feed_test.rb
|