ratis 3.3.0 → 3.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ratis/pattern.rb +9 -9
- data/lib/ratis/route_pattern.rb +2 -2
- data/lib/ratis/version.rb +1 -1
- data/spec/ratis/next_bus_spec.rb +6 -6
- data/spec/ratis/pattern_spec.rb +5 -5
- data/spec/ratis/point_2_point_spec.rb +11 -11
- data/spec/ratis/timetable_spec.rb +4 -4
- data/spec/support/vcr_cassettes/Point2Point.yml +20 -65
- metadata +4 -4
data/lib/ratis/pattern.rb
CHANGED
@@ -30,16 +30,16 @@ module Ratis
|
|
30
30
|
|
31
31
|
return nil unless response.success?
|
32
32
|
|
33
|
-
routeinfos = response.
|
33
|
+
routeinfos = response.to_array(:getpatterns_response, :routes, :routeinfo).map do |rinfo|
|
34
34
|
info = Pattern::RouteInfo.new
|
35
|
-
info.route =
|
36
|
-
info.headsign =
|
37
|
-
info.operate =
|
38
|
-
info.effective =
|
39
|
-
info.routeid =
|
40
|
-
info.routetype =
|
41
|
-
info.tripcount =
|
42
|
-
info.school =
|
35
|
+
info.route = rinfo[:route]
|
36
|
+
info.headsign = rinfo[:signage]
|
37
|
+
info.operate = rinfo[:operator]
|
38
|
+
info.effective = rinfo[:effective]
|
39
|
+
info.routeid = rinfo[:routeid]
|
40
|
+
info.routetype = rinfo[:routetype]
|
41
|
+
info.tripcount = rinfo[:tripcount]
|
42
|
+
info.school = rinfo[:school]
|
43
43
|
info
|
44
44
|
end
|
45
45
|
|
data/lib/ratis/route_pattern.rb
CHANGED
@@ -26,7 +26,7 @@ module Ratis
|
|
26
26
|
|
27
27
|
routepattern = RoutePattern.new
|
28
28
|
|
29
|
-
routepattern.stops = response.
|
29
|
+
routepattern.stops = response.to_array(:routepattern_response, :stops, :stop).map do |s|
|
30
30
|
stop = RoutePattern::Stop.new
|
31
31
|
stop.desc = s[:description]
|
32
32
|
stop.area = s[:area]
|
@@ -39,7 +39,7 @@ module Ratis
|
|
39
39
|
stop
|
40
40
|
end
|
41
41
|
|
42
|
-
routepattern.points = response.
|
42
|
+
routepattern.points = response.to_array(:routepattern_response, :points, :point).map do |p|
|
43
43
|
point = RoutePattern::Point.new
|
44
44
|
point.lat, point.lng = p.split ','
|
45
45
|
point
|
data/lib/ratis/version.rb
CHANGED
data/spec/ratis/next_bus_spec.rb
CHANGED
@@ -96,7 +96,7 @@ describe Ratis::NextBus do
|
|
96
96
|
expect(service.times).to eq("05:49 AM, 06:09 AM, 06:29 AM, 06:49 AM")
|
97
97
|
expect(service.direction).to eq('N')
|
98
98
|
expect(service.servicetype).to eq('W')
|
99
|
-
expect(service.route).to eq('
|
99
|
+
expect(service.route).to eq('ZERO')
|
100
100
|
expect(service.operator).to eq('AP')
|
101
101
|
end
|
102
102
|
|
@@ -150,7 +150,7 @@ describe Ratis::NextBus do
|
|
150
150
|
# Ratis::Errors::SoapError:
|
151
151
|
# SOAP - no runs available
|
152
152
|
response = Ratis::NextBus.where(@conditions.dup)
|
153
|
-
expect(response.services).to
|
153
|
+
expect(response.services.size).to be_within(2).of(3)
|
154
154
|
end
|
155
155
|
|
156
156
|
it 'only makes one request' do
|
@@ -182,9 +182,9 @@ describe Ratis::NextBus do
|
|
182
182
|
expect(service).to be_a(OpenStruct)
|
183
183
|
|
184
184
|
expect(service.status).to eq('N')
|
185
|
-
expect(service.sign).to eq('108 Elliot West To
|
185
|
+
expect(service.sign).to eq('108 Elliot/48th St West To 40th St/Pecos')
|
186
186
|
expect(service.routetype).to eq('B')
|
187
|
-
expect(service.times).to eq("
|
187
|
+
expect(service.times).to eq("07:07 AM, 03:07 PM, 03:37 PM, 04:07 PM")
|
188
188
|
expect(service.direction).to eq('W')
|
189
189
|
expect(service.servicetype).to eq('W')
|
190
190
|
expect(service.route).to eq('108')
|
@@ -194,9 +194,9 @@ describe Ratis::NextBus do
|
|
194
194
|
expect(service).to be_a(OpenStruct)
|
195
195
|
|
196
196
|
expect(service.status).to eq('N')
|
197
|
-
expect(service.sign).to eq('108 Elliot West To
|
197
|
+
expect(service.sign).to eq('108 Elliot/48th St West To 48th St/Chandler Via Sosmn/Bsnln')
|
198
198
|
expect(service.routetype).to eq('B')
|
199
|
-
expect(service.times).to eq("02:
|
199
|
+
expect(service.times).to eq("02:37 PM, 06:37 PM")
|
200
200
|
expect(service.direction).to eq('W')
|
201
201
|
expect(service.servicetype).to eq('W')
|
202
202
|
expect(service.route).to eq('108')
|
data/spec/ratis/pattern_spec.rb
CHANGED
@@ -13,7 +13,7 @@ describe Ratis::Pattern do
|
|
13
13
|
|
14
14
|
before do
|
15
15
|
@today = Chronic.parse('tomorrow at 8am') # Time.now.strftime("%m/%d/%Y")
|
16
|
-
@conditions = {:route_short_name => '
|
16
|
+
@conditions = {:route_short_name => 'ZERO',
|
17
17
|
:direction => 'N',
|
18
18
|
:date => @today,
|
19
19
|
:service_type => 'W',
|
@@ -36,7 +36,7 @@ describe Ratis::Pattern do
|
|
36
36
|
it 'requests the correct SOAP action with correct args' do
|
37
37
|
Ratis::Request.should_receive(:get) do |action, options|
|
38
38
|
action.should eq('Getpatterns')
|
39
|
-
options["Route"].should eq('
|
39
|
+
options["Route"].should eq('ZERO')
|
40
40
|
options["Direction"].should eq('N')
|
41
41
|
options["Date"].should eq(@today)
|
42
42
|
options["Servicetype"].should eq('W')
|
@@ -63,10 +63,10 @@ describe Ratis::Pattern do
|
|
63
63
|
expect(routeinfo.operate).to eq('AP')
|
64
64
|
expect(routeinfo.routetype).to eq('B')
|
65
65
|
expect(routeinfo.headsign).to eq("0 CENTRAL North to Dunlap/3rd St.")
|
66
|
-
expect(routeinfo.routeid).to eq('
|
67
|
-
expect(routeinfo.route).to eq('
|
66
|
+
expect(routeinfo.routeid).to eq('107070')
|
67
|
+
expect(routeinfo.route).to eq('ZERO')
|
68
68
|
expect(routeinfo.school).to be_nil
|
69
|
-
expect(routeinfo.effective).to eq(
|
69
|
+
expect(routeinfo.effective).to eq("07/22/13")
|
70
70
|
expect(routeinfo.tripcount).to eq('51')
|
71
71
|
|
72
72
|
end
|
@@ -126,9 +126,9 @@ describe Ratis::Point2Point do
|
|
126
126
|
|
127
127
|
it 'gets the trips within each group' do
|
128
128
|
schedule = Ratis::Point2Point.where(@conditions.dup)
|
129
|
-
schedule.groups[0].should
|
130
|
-
schedule.groups[1].should
|
131
|
-
schedule.groups[2].should
|
129
|
+
schedule.groups[0].size.should be_within(10).of(11)
|
130
|
+
schedule.groups[1].size.should be_within(10).of(11)
|
131
|
+
schedule.groups[2].size.should be_within(10).of(11)
|
132
132
|
end
|
133
133
|
|
134
134
|
it 'parses out the on stop fields' do
|
@@ -170,8 +170,8 @@ describe Ratis::Point2Point do
|
|
170
170
|
|
171
171
|
trip.should be_a(Ratis::Point2Point::Trip)
|
172
172
|
|
173
|
-
trip.on_time.should eql('05:
|
174
|
-
trip.off_time.should eql('05:
|
173
|
+
trip.on_time.should eql('05:01 PM')
|
174
|
+
trip.off_time.should eql('05:08 PM')
|
175
175
|
end
|
176
176
|
|
177
177
|
it 'parses out the service' do
|
@@ -181,22 +181,22 @@ describe Ratis::Point2Point do
|
|
181
181
|
|
182
182
|
service.should be_a(Ratis::Point2Point::Service)
|
183
183
|
|
184
|
-
service.route.should eql('
|
185
|
-
service.direction.should eql('
|
184
|
+
service.route.should eql('I10E')
|
185
|
+
service.direction.should eql('O')
|
186
186
|
service.service_type.should eql('W')
|
187
|
-
service.signage.should eql('
|
187
|
+
service.signage.should eql('I-10 EAST RAPID To 40 St/Pecos')
|
188
188
|
service.route_type.should eql('X')
|
189
189
|
service.exception.should eql('N')
|
190
190
|
end
|
191
191
|
|
192
192
|
it "should only return result groups for filtered route" do
|
193
|
-
schedule = Ratis::Point2Point.where(@conditions.dup.merge(:routes => ['
|
193
|
+
schedule = Ratis::Point2Point.where(@conditions.dup.merge(:routes => ['I10E']))
|
194
194
|
schedule.groups.size.should eq(1)
|
195
195
|
end
|
196
196
|
|
197
197
|
it "should only return result groups for filtered routes" do
|
198
|
-
schedule = Ratis::Point2Point.where(@conditions.dup.merge(:routes => ['1', '
|
199
|
-
schedule.groups.size.should
|
198
|
+
schedule = Ratis::Point2Point.where(@conditions.dup.merge(:routes => ['1', 'I10E']))
|
199
|
+
schedule.groups.size.should be > 0
|
200
200
|
end
|
201
201
|
|
202
202
|
it "should raise error if the trip is NOT possible for a route being attempted to filter on" do
|
@@ -13,7 +13,7 @@ describe Ratis::Timetable do
|
|
13
13
|
|
14
14
|
before do
|
15
15
|
@today = Time.now.strftime("%m/%d/%Y")
|
16
|
-
@conditions = {:route_short_name => '
|
16
|
+
@conditions = {:route_short_name => 'ZERO',
|
17
17
|
:direction => 'N',
|
18
18
|
:service_type => 'W',
|
19
19
|
:date => @today}
|
@@ -28,7 +28,7 @@ describe Ratis::Timetable do
|
|
28
28
|
it 'requests the correct SOAP action with correct args' do
|
29
29
|
Ratis::Request.should_receive(:get) do |action, options|
|
30
30
|
action.should eq('Timetable')
|
31
|
-
options["Route"].should eq('
|
31
|
+
options["Route"].should eq('ZERO')
|
32
32
|
options["Direction"].should eq('N')
|
33
33
|
options["Date"].should eq(@today)
|
34
34
|
options["Servicetype"].should be_nil
|
@@ -59,11 +59,11 @@ describe Ratis::Timetable do
|
|
59
59
|
it "should parse the timetable/stop/trip fields" do
|
60
60
|
timetable = Ratis::Timetable.where(@conditions.dup)
|
61
61
|
|
62
|
-
expect(timetable.route_short_name).to eq('
|
62
|
+
expect(timetable.route_short_name).to eq('ZERO')
|
63
63
|
expect(timetable.direction).to eq('N')
|
64
64
|
expect(timetable.service_type).to eq('Weekday')
|
65
65
|
expect(timetable.operator).to eq('AP')
|
66
|
-
expect(timetable.effective).to eq('
|
66
|
+
expect(timetable.effective).to eq('07/22/13')
|
67
67
|
|
68
68
|
stop = timetable.timepoints.first
|
69
69
|
|
@@ -1,96 +1,50 @@
|
|
1
1
|
---
|
2
|
-
recorded_with: VCR 2.5.0
|
3
2
|
http_interactions:
|
4
|
-
- request:
|
5
|
-
method: post
|
6
|
-
uri: http://example.com/soap.cgi
|
7
|
-
body:
|
8
|
-
base64_string: |
|
9
|
-
PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48ZW52OkVu
|
10
|
-
dmVsb3BlIHhtbG5zOndzZGw9IlRFU1RfTlMiIHhtbG5zOnhzZD0iaHR0cDov
|
11
|
-
L3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zOnhzaT0iaHR0cDov
|
12
|
-
L3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zOmVu
|
13
|
-
dj0iaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvc29hcC9lbnZlbG9wZS8i
|
14
|
-
PjxlbnY6Qm9keT48UG9pbnQycG9pbnQgeG1sbnM9IlBYX1dFQiI+PERlc3Rp
|
15
|
-
bmF0aW9ubGF0PjMzLjQ0NzA5ODwvRGVzdGluYXRpb25sYXQ+PFJvdXRlc29u
|
16
|
-
bHk+WTwvUm91dGVzb25seT48U3RhcnR0aW1lPjE3MDA8L1N0YXJ0dGltZT48
|
17
|
-
RW5kdGltZT4xODAwPC9FbmR0aW1lPjxPcmlnaW5sb25nPi0xMTIuMDk3OTAz
|
18
|
-
PC9PcmlnaW5sb25nPjxPcmlnaW5sYXQ+MzMuNDQ2OTMxPC9PcmlnaW5sYXQ+
|
19
|
-
PERlc3RpbmF0aW9ubG9uZz4tMTEyLjA3NzIxMzwvRGVzdGluYXRpb25sb25n
|
20
|
-
PjxEYXRlPjA0LzExLzIwMTM8L0RhdGU+PFJvdXRlcz48L1JvdXRlcz48L1Bv
|
21
|
-
aW50MnBvaW50PjwvZW52OkJvZHk+PC9lbnY6RW52ZWxvcGU+
|
22
|
-
|
23
|
-
headers:
|
24
|
-
Soapaction:
|
25
|
-
- "\"PX_WEB#Point2point\""
|
26
|
-
Content-Length:
|
27
|
-
- "576"
|
28
|
-
Content-Type:
|
29
|
-
- text/xml;charset=UTF-8
|
30
|
-
Accept:
|
31
|
-
- "*/*"
|
32
|
-
response:
|
33
|
-
status:
|
34
|
-
code: 302
|
35
|
-
message: Found
|
36
|
-
headers:
|
37
|
-
Content-Length:
|
38
|
-
- "0"
|
39
|
-
Connection:
|
40
|
-
- Keep-Alive
|
41
|
-
Server:
|
42
|
-
- BigIP
|
43
|
-
Location:
|
44
|
-
- http://www.iana.org/domains/example/
|
45
|
-
body:
|
46
|
-
base64_string: ""
|
47
|
-
http_version:
|
48
|
-
recorded_at: Fri, 12 Apr 2013 01:39:08 GMT
|
49
3
|
- request:
|
50
4
|
method: post
|
51
5
|
uri: http://soap.valleymetro.org/cgi-bin-soap-web-252/soap.cgi
|
52
6
|
body:
|
53
7
|
base64_string: |
|
54
8
|
PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48ZW52OkVu
|
55
|
-
|
56
|
-
|
9
|
+
dmVsb3BlIHhtbG5zOmVudj0iaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcv
|
10
|
+
c29hcC9lbnZlbG9wZS8iIHhtbG5zOndzZGw9IlBYX1dFQiIgeG1sbnM6eHNk
|
57
11
|
PSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYSIgeG1sbnM6eHNp
|
58
12
|
PSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYS1pbnN0YW5jZSI+
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
13
|
+
PGVudjpCb2R5PjxQb2ludDJwb2ludCB4bWxucz0iUFhfV0VCIj48RGF0ZT4w
|
14
|
+
Ny8xNS8yMDEzPC9EYXRlPjxTdGFydHRpbWU+MTcwMDwvU3RhcnR0aW1lPjxP
|
15
|
+
cmlnaW5sb25nPi0xMTIuMDk3OTAzPC9PcmlnaW5sb25nPjxEZXN0aW5hdGlv
|
16
|
+
bmxhdD4zMy40NDcwOTg8L0Rlc3RpbmF0aW9ubGF0PjxPcmlnaW5sYXQ+MzMu
|
17
|
+
NDQ2OTMxPC9PcmlnaW5sYXQ+PFJvdXRlcz48L1JvdXRlcz48RW5kdGltZT4x
|
18
|
+
ODAwPC9FbmR0aW1lPjxSb3V0ZXNvbmx5Plk8L1JvdXRlc29ubHk+PERlc3Rp
|
19
|
+
bmF0aW9ubG9uZz4tMTEyLjA3NzIxMzwvRGVzdGluYXRpb25sb25nPjwvUG9p
|
20
|
+
bnQycG9pbnQ+PC9lbnY6Qm9keT48L2VudjpFbnZlbG9wZT4=
|
67
21
|
|
68
22
|
headers:
|
69
23
|
Soapaction:
|
70
24
|
- "\"PX_WEB#Point2point\""
|
71
|
-
Content-Length:
|
72
|
-
- "576"
|
73
25
|
Content-Type:
|
74
26
|
- text/xml;charset=UTF-8
|
75
27
|
Accept:
|
76
28
|
- "*/*"
|
29
|
+
Content-Length:
|
30
|
+
- "575"
|
77
31
|
response:
|
78
32
|
status:
|
79
33
|
code: 200
|
80
34
|
message: OK
|
81
35
|
headers:
|
36
|
+
Date:
|
37
|
+
- Fri, 12 Jul 2013 15:39:35 GMT
|
38
|
+
Content-Type:
|
39
|
+
- text/xml; charset=utf-8
|
82
40
|
Soapserver:
|
83
41
|
- SOAP::Lite/Perl/0.55
|
84
|
-
Content-Length:
|
85
|
-
- "4558"
|
86
42
|
Connection:
|
87
43
|
- close
|
88
|
-
Content-Type:
|
89
|
-
- text/xml; charset=utf-8
|
90
|
-
Date:
|
91
|
-
- Fri, 12 Jul 2013 00:35:04 GMT
|
92
44
|
Server:
|
93
45
|
- Apache/2.2.3 (CentOS)
|
46
|
+
Content-Length:
|
47
|
+
- "4558"
|
94
48
|
body:
|
95
49
|
base64_string: |
|
96
50
|
PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48U09BUC1F
|
@@ -197,4 +151,5 @@ http_interactions:
|
|
197
151
|
RU5WOkVudmVsb3BlPg==
|
198
152
|
|
199
153
|
http_version:
|
200
|
-
recorded_at: Fri, 12 Jul 2013
|
154
|
+
recorded_at: Fri, 12 Jul 2013 15:39:35 GMT
|
155
|
+
recorded_with: VCR 2.5.0
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ratis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 3.3.
|
9
|
+
- 1
|
10
|
+
version: 3.3.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Burst Software
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-07-
|
18
|
+
date: 2013-07-22 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: savon
|