ratis 3.3.6 → 3.3.7
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.
- checksums.yaml +7 -0
- data/.rvmrc +1 -1
- data/CHANGELOG +8 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +33 -35
- data/lib/ratis.rb +1 -1
- data/lib/ratis/landmark.rb +4 -3
- data/lib/ratis/landmark_category.rb +11 -7
- data/lib/ratis/location.rb +1 -0
- data/lib/ratis/route_stops.rb +0 -6
- data/lib/ratis/version.rb +1 -1
- data/lib/ratis/walkstop.rb +54 -0
- data/ratis.gemspec +3 -5
- data/spec/ratis/area_spec.rb +1 -1
- data/spec/ratis/closest_stop_spec.rb +2 -2
- data/spec/ratis/itinerary_spec.rb +8 -711
- data/spec/ratis/landmark_category_spec.rb +40 -32
- data/spec/ratis/landmark_spec.rb +4 -33
- data/spec/ratis/location_spec.rb +69 -177
- data/spec/ratis/next_bus2_spec.rb +21 -21
- data/spec/ratis/next_bus_spec.rb +19 -21
- data/spec/ratis/pattern_spec.rb +3 -3
- data/spec/ratis/plantrip_spec.rb +92 -0
- data/spec/ratis/point_2_point_spec.rb +12 -12
- data/spec/ratis/request_spec.rb +0 -1
- data/spec/ratis/route_pattern_spec.rb +16 -15
- data/spec/ratis/route_stops_spec.rb +10 -10
- data/spec/ratis/routes_spec.rb +5 -5
- data/spec/ratis/schedule_nearby_spec.rb +1 -1
- data/spec/ratis/timetable_spec.rb +3 -3
- data/spec/ratis/walkstop_spec.rb +94 -0
- data/spec/spec_helper.rb +16 -11
- data/spec/support/vcr_cassettes/Nextbus2_running_LATE.yml +142 -574
- data/spec/support/vcr_cassettes/Nextbus_running_LATE.yml +101 -137
- data/spec/support/vcr_cassettes/Point2Point.yml +63 -162
- data/spec/support/vcr_cassettes/Ratis_Area/_all/only_makes_one_request.yml +52 -0
- data/spec/support/vcr_cassettes/Ratis_ClosestStop/_where/only_makes_one_request.yml +70 -0
- data/spec/support/vcr_cassettes/Ratis_ClosestStop/_where/parses_out_the_stop_fields_correctly.yml +70 -0
- data/spec/support/vcr_cassettes/Ratis_ClosestStop/_where/returns_multiple_locations.yml +70 -0
- data/spec/support/vcr_cassettes/Ratis_ClosestStop/_where/should_return_a_collection_of_Ratis_Stop_s_.yml +70 -0
- data/spec/support/vcr_cassettes/Ratis_LandmarkCategory/_all/only_makes_one_request.yml +117 -0
- data/spec/support/vcr_cassettes/Ratis_LandmarkCategory/_all/should_return_a_collection_of_Ratis_LandmarkCategory_s_.yml +117 -0
- data/spec/support/vcr_cassettes/Ratis_LandmarkCategory/_all/should_return_all_landmark_categories.yml +117 -0
- data/spec/support/vcr_cassettes/Ratis_LandmarkCategory/_web_categories/does_something.yml +117 -0
- data/spec/support/vcr_cassettes/Ratis_Location/_where/only_makes_one_request.yml +54 -0
- data/spec/support/vcr_cassettes/Ratis_Location/_where/parses_out_fields_correctly.yml +54 -0
- data/spec/support/vcr_cassettes/Ratis_Location/_where/should_return_a_collection_of_Ratis_Location_s_.yml +54 -0
- data/spec/support/vcr_cassettes/Ratis_NextBus/_where/multiple_services_returned/only_makes_one_request.yml +109 -0
- data/spec/support/vcr_cassettes/Ratis_NextBus/_where/multiple_services_returned/returns_the_next_4_bus_times.yml +109 -0
- data/spec/support/vcr_cassettes/Ratis_NextBus/_where/multiple_services_returned/should_map_all_the_services_to_service_openstruct_objects.yml +109 -0
- data/spec/support/vcr_cassettes/Ratis_NextBus/_where/multiple_services_returned/should_raise_error_if_datetime_condition_is_not_a_DateTime_or_Time.yml +211 -0
- data/spec/support/vcr_cassettes/Ratis_NextBus/_where/single_service_return/only_makes_one_request.yml +75 -0
- data/spec/support/vcr_cassettes/Ratis_NextBus/_where/single_service_return/returns_the_next_bus_times.yml +75 -0
- data/spec/support/vcr_cassettes/Ratis_NextBus/_where/single_service_return/should_raise_error_if_datetime_condition_is_not_a_DateTime_or_Time.yml +143 -0
- data/spec/support/vcr_cassettes/Ratis_NextBus/_where/single_service_return/should_set_all_the_service_values_to_instance_vars.yml +75 -0
- data/spec/support/vcr_cassettes/Ratis_NextBus2/_where/Developer_can_find_a_late_bus_to_a_stop/runs/should_set_the_run_values_to_instance_vars.yml +180 -0
- data/spec/support/vcr_cassettes/Ratis_NextBus2/_where/Developer_can_find_a_late_bus_to_a_stop/single_next_bus/only_makes_one_request.yml +180 -0
- data/spec/support/vcr_cassettes/Ratis_NextBus2/_where/Developer_can_find_a_late_bus_to_a_stop/single_next_bus/requests_the_correct_SOAP_action.yml +180 -0
- data/spec/support/vcr_cassettes/Ratis_NextBus2/_where/Developer_can_find_a_late_bus_to_a_stop/stops/should_set_the_stop_values_to_instance_vars.yml +180 -0
- data/spec/support/vcr_cassettes/Ratis_Pattern/_all/only_makes_one_request.yml +56 -0
- data/spec/support/vcr_cassettes/Ratis_Pattern/_all/should_parse_the_route_info_fields.yml +56 -0
- data/spec/support/vcr_cassettes/Ratis_Pattern/_all/should_return_a_collection_Pattern_RouteInfo_s_.yml +56 -0
- data/spec/support/vcr_cassettes/Ratis_Pattern/_all/should_return_no_data_error_when_date_is_in_the_past.yml +53 -0
- data/spec/support/vcr_cassettes/Ratis_Plantrip/_where/creates_Ratis_Itineraries_for_each_trip_itinerary.yml +88 -0
- data/spec/support/vcr_cassettes/Ratis_Plantrip/_where/only_makes_one_request.yml +88 -0
- data/spec/support/vcr_cassettes/Ratis_Plantrip/_where/returns_a_Plantrip_object.yml +88 -0
- data/spec/support/vcr_cassettes/Ratis_Plantrip/_where/should_set_all_the_Plantrip_values_to_instance_vars.yml +88 -0
- data/spec/support/vcr_cassettes/Ratis_Point2Point/Routesonly_N/_where/gets_the_groups.yml +134 -0
- data/spec/support/vcr_cassettes/Ratis_Point2Point/Routesonly_N/_where/gets_the_trips_within_each_group.yml +134 -0
- data/spec/support/vcr_cassettes/Ratis_Point2Point/Routesonly_N/_where/only_makes_one_request.yml +134 -0
- data/spec/support/vcr_cassettes/Ratis_Point2Point/Routesonly_N/_where/parses_out_the_off_stop_fields.yml +134 -0
- data/spec/support/vcr_cassettes/Ratis_Point2Point/Routesonly_N/_where/parses_out_the_on_stop_fields.yml +134 -0
- data/spec/support/vcr_cassettes/Ratis_Point2Point/Routesonly_N/_where/parses_out_the_service.yml +134 -0
- data/spec/support/vcr_cassettes/Ratis_Point2Point/Routesonly_N/_where/parses_out_the_trip.yml +134 -0
- data/spec/support/vcr_cassettes/Ratis_Point2Point/Routesonly_N/_where/should_only_return_result_groups_for_filtered_route.yml +62 -0
- data/spec/support/vcr_cassettes/Ratis_Point2Point/Routesonly_N/_where/should_only_return_result_groups_for_filtered_routes.yml +68 -0
- data/spec/support/vcr_cassettes/Ratis_Point2Point/Routesonly_N/_where/should_raise_error_if_the_trip_is_NOT_possible_for_a_route_being_attempted_to_filter_on.yml +53 -0
- data/spec/support/vcr_cassettes/Ratis_Point2Point/Routesonly_Y/_where/services_from_origin_to_destination/only_makes_one_request.yml +72 -0
- data/spec/support/vcr_cassettes/Ratis_Point2Point/Routesonly_Y/_where/services_from_origin_to_destination/parses_out_service_fields.yml +72 -0
- data/spec/support/vcr_cassettes/Ratis_Point2Point/Routesonly_Y/_where/services_from_origin_to_destination/returns_a_routes_only_response_for_each_matched_service.yml +72 -0
- data/spec/support/vcr_cassettes/Ratis_Point2Point/Routesonly_Y/_where/services_from_origin_to_destination/returns_all_matching_services_that_fit_the_origin/destination_for_a_given_time_frame.yml +72 -0
- data/spec/support/vcr_cassettes/Ratis_Point2Point/Routesonly_Y/_where/services_from_origin_to_destination/should_NOT_filter_by_passed_in_routes.yml +72 -0
- data/spec/support/vcr_cassettes/Ratis_RoutePattern/_where/only_makes_one_request.yml +152 -0
- data/spec/support/vcr_cassettes/Ratis_RoutePattern/_where/should_parse_the_stop_fields.yml +152 -0
- data/spec/support/vcr_cassettes/Ratis_RoutePattern/_where/should_return_a_collection_Ratis_RoutePattern_Point_s_.yml +152 -0
- data/spec/support/vcr_cassettes/Ratis_RoutePattern/_where/should_return_a_collection_Ratis_RoutePattern_Stop_s_.yml +152 -0
- data/spec/support/vcr_cassettes/Ratis_RouteStops/_all/only_makes_one_request.yml +94 -0
- data/spec/support/vcr_cassettes/Ratis_RouteStops/_all/parses_out_the_stop_fields_correctly.yml +94 -0
- data/spec/support/vcr_cassettes/Ratis_RouteStops/_all/should_return_a_collection_of_Ratis_RouteStops_Stop_s_.yml +94 -0
- data/spec/support/vcr_cassettes/Ratis_Routes/_all/only_makes_one_request.yml +779 -0
- data/spec/support/vcr_cassettes/Ratis_Routes/_all/returns_all_routes.yml +779 -0
- data/spec/support/vcr_cassettes/Ratis_Routes/_all/should_set_directions_and_short_name_to_variables.yml +779 -0
- data/spec/support/vcr_cassettes/Ratis_ScheduleNearby/_where/only_makes_one_request.yml +92 -0
- data/spec/support/vcr_cassettes/Ratis_ScheduleNearby/_where/returns_a_non_nil_ScheduleNearby.yml +92 -0
- data/spec/support/vcr_cassettes/Ratis_ScheduleNearby/_where/returns_a_single_service_at_the_stop.yml +92 -0
- data/spec/support/vcr_cassettes/Ratis_ScheduleNearby/_where/returns_all_the_stops.yml +92 -0
- data/spec/support/vcr_cassettes/Ratis_ScheduleNearby/_where/should_return_no_data_error_when_date_is_in_the_past.yml +53 -0
- data/spec/support/vcr_cassettes/Ratis_Timetable/_where/only_makes_one_request.yml +722 -0
- data/spec/support/vcr_cassettes/Ratis_Timetable/_where/should_parse_the_timetable/stop/trip_fields.yml +722 -0
- data/spec/support/vcr_cassettes/Ratis_Timetable/_where/should_return_a_collection_Timetable_Stop_s_.yml +722 -0
- data/spec/support/vcr_cassettes/Ratis_Walkstop/_where/only_makes_one_request.yml +53 -0
- data/spec/support/vcr_cassettes/Ratis_Walkstop/_where/should_set_all_the_walkstop_values_to_instance_vars.yml +53 -0
- metadata +241 -219
- data/lib/ratis/walk.rb +0 -37
- data/spec/ratis/walk_spec.rb +0 -72
- data/spec/support/vcr_cassettes/Nextbus.yml +0 -145
- data/spec/support/vcr_cassettes/Nextbus2.yml +0 -336
data/spec/ratis/next_bus_spec.rb
CHANGED
@@ -15,7 +15,7 @@ describe Ratis::NextBus do
|
|
15
15
|
|
16
16
|
describe "Developer can find a late bus to a stop" do
|
17
17
|
it "will give developer happiness :-)" do
|
18
|
-
|
18
|
+
pending
|
19
19
|
@conditions = {:app_id => 'ratis-specs', # a short string that can be used to separate requests from different applications or different modules with
|
20
20
|
:type => 'N',
|
21
21
|
:datetime => Chronic.parse('now') }
|
@@ -42,7 +42,7 @@ describe Ratis::NextBus do
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
describe '#where',
|
45
|
+
describe '#where', vcr: {} do #
|
46
46
|
# TODO: Light Rails Stops can return 2 Atstop tags... how do we best handle this case
|
47
47
|
describe 'Light Rails stops' do
|
48
48
|
it "description" do
|
@@ -113,7 +113,7 @@ describe Ratis::NextBus do
|
|
113
113
|
expect(response).to be_a(Ratis::NextBus)
|
114
114
|
expect(response.services).to be_a(Array)
|
115
115
|
|
116
|
-
expect(service.status).to eq('
|
116
|
+
expect(service.status).to eq('D')
|
117
117
|
expect(service.sign).to eq('0 CENTRAL North to Dunlap/3rd St.')
|
118
118
|
expect(service.routetype).to eq('B')
|
119
119
|
expect(service.times).to eq("05:49 AM, 06:09 AM, 06:29 AM, 06:49 AM")
|
@@ -130,11 +130,11 @@ describe Ratis::NextBus do
|
|
130
130
|
|
131
131
|
lambda {
|
132
132
|
Ratis::NextBus.where(@conditions.dup.merge(:datetime => Time.now))
|
133
|
-
}.should_not raise_error
|
133
|
+
}.should_not raise_error
|
134
134
|
|
135
135
|
lambda {
|
136
|
-
Ratis::NextBus.where(@conditions.dup.merge(:datetime =>
|
137
|
-
}.should_not raise_error
|
136
|
+
Ratis::NextBus.where(@conditions.dup.merge(:datetime => Date.today.to_time))
|
137
|
+
}.should_not raise_error
|
138
138
|
end
|
139
139
|
|
140
140
|
it "should raise error if stop id is not provided" do
|
@@ -205,25 +205,25 @@ describe Ratis::NextBus do
|
|
205
205
|
expect(service).to be_a(OpenStruct)
|
206
206
|
|
207
207
|
expect(service.status).to eq('N')
|
208
|
-
expect(service.sign).to eq('
|
208
|
+
expect(service.sign).to eq('108 Elliot/48th St West To 40th St/Pecos')
|
209
209
|
expect(service.routetype).to eq('B')
|
210
|
-
expect(service.times).to eq("
|
211
|
-
expect(service.direction).to eq('
|
210
|
+
expect(service.times).to eq("07:07 AM, 03:07 PM, 03:37 PM, 04:07 PM")
|
211
|
+
expect(service.direction).to eq('W')
|
212
212
|
expect(service.servicetype).to eq('W')
|
213
|
-
expect(service.route).to eq('
|
214
|
-
expect(service.operator).to eq('
|
213
|
+
expect(service.route).to eq('108')
|
214
|
+
expect(service.operator).to eq('FTE')
|
215
215
|
|
216
216
|
service = response.services.last
|
217
217
|
expect(service).to be_a(OpenStruct)
|
218
218
|
|
219
219
|
expect(service.status).to eq('N')
|
220
|
-
expect(service.sign).to eq('
|
220
|
+
expect(service.sign).to eq('108 Elliot/48th St West To 48th St/Chandler Via Sosmn/Bsnln')
|
221
221
|
expect(service.routetype).to eq('B')
|
222
|
-
expect(service.times).to eq("
|
223
|
-
expect(service.direction).to eq('
|
222
|
+
expect(service.times).to eq("02:37 PM, 06:37 PM")
|
223
|
+
expect(service.direction).to eq('W')
|
224
224
|
expect(service.servicetype).to eq('W')
|
225
|
-
expect(service.route).to eq('
|
226
|
-
expect(service.operator).to eq('
|
225
|
+
expect(service.route).to eq('108')
|
226
|
+
expect(service.operator).to eq('FTE')
|
227
227
|
end
|
228
228
|
|
229
229
|
it "should raise error if datetime condition is not a DateTime or Time" do
|
@@ -233,11 +233,11 @@ describe Ratis::NextBus do
|
|
233
233
|
|
234
234
|
lambda {
|
235
235
|
Ratis::NextBus.where(@conditions.dup.merge(:datetime => Time.now))
|
236
|
-
}.should_not raise_error
|
236
|
+
}.should_not raise_error
|
237
237
|
|
238
238
|
lambda {
|
239
|
-
Ratis::NextBus.where(@conditions.dup.merge(:datetime =>
|
240
|
-
}.should_not raise_error
|
239
|
+
Ratis::NextBus.where(@conditions.dup.merge(:datetime => Date.today.to_time))
|
240
|
+
}.should_not raise_error
|
241
241
|
end
|
242
242
|
|
243
243
|
it "should raise error if stop id is not provided" do
|
@@ -262,8 +262,6 @@ describe Ratis::NextBus do
|
|
262
262
|
end
|
263
263
|
end
|
264
264
|
|
265
|
-
|
266
|
-
|
267
265
|
end
|
268
266
|
|
269
267
|
# EXAMPLE RESPONSE
|
data/spec/ratis/pattern_spec.rb
CHANGED
@@ -9,7 +9,7 @@ describe Ratis::Pattern do
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
describe '#all' do
|
12
|
+
describe '#all', vcr: {} do
|
13
13
|
|
14
14
|
before do
|
15
15
|
@today = Chronic.parse('tomorrow at 8am') # Time.now.strftime("%m/%d/%Y")
|
@@ -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('
|
66
|
+
expect(routeinfo.routeid).to eq('123130')
|
67
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("10/28/13")
|
70
70
|
expect(routeinfo.tripcount).to eq('51')
|
71
71
|
|
72
72
|
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Ratis::Plantrip do
|
4
|
+
before do
|
5
|
+
Ratis.reset
|
6
|
+
Ratis.configure do |config|
|
7
|
+
config.endpoint = 'http://soap.valleymetro.org/cgi-bin-soap-web-262/soap.cgi'
|
8
|
+
config.namespace = 'PX_WEB'
|
9
|
+
end
|
10
|
+
|
11
|
+
@datetime = Chronic.parse('next monday at 6am')
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:empty_body){ {:plantrip_response => {:input => {}} }}
|
15
|
+
|
16
|
+
describe '#where', vcr: {} do
|
17
|
+
before do
|
18
|
+
@conditions = {
|
19
|
+
:datetime => @datetime,
|
20
|
+
:minimize => 'T',
|
21
|
+
:origin_lat => '33.452082',
|
22
|
+
:origin_long => '-112.074374',
|
23
|
+
:destination_lat => '33.446347',
|
24
|
+
:destination_long => '-112.068689'}
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'only makes one request' do
|
28
|
+
# false just to stop further processing of response
|
29
|
+
Ratis::Request.should_receive(:get).once.and_call_original
|
30
|
+
Ratis::Plantrip.where(@conditions.dup)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'requests the correct SOAP action' do
|
34
|
+
Ratis::Request.should_receive(:get) do |action, options|
|
35
|
+
action.should eq('Plantrip')
|
36
|
+
options["Appid"].should eq('ratis-gem')
|
37
|
+
options["Date"].should eq(@datetime.strftime("%m/%d/%Y"))
|
38
|
+
options["Time"].should eq(@datetime.strftime("%H%M"))
|
39
|
+
options["Minimize"].should eq('T')
|
40
|
+
options['Originlat'].should eq(33.452082)
|
41
|
+
options['Originlong'].should eq(-112.074374)
|
42
|
+
options['Destinationlat'].should eq(33.446347)
|
43
|
+
options['Destinationlong'].should eq(-112.068689)
|
44
|
+
|
45
|
+
end.and_return(double('response', :success? => false, :body => empty_body, :to_array => [])) # false only to stop further running
|
46
|
+
|
47
|
+
Ratis::Plantrip.where(@conditions.dup)
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'returns a Plantrip object' do
|
51
|
+
@itineraries = Ratis::Plantrip.where(@conditions.dup)
|
52
|
+
expect(@itineraries).to be_a(Ratis::Plantrip)
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'creates Ratis::Itineraries for each trip itinerary' do
|
56
|
+
@plantrip = Ratis::Plantrip.where(@conditions.dup)
|
57
|
+
@plantrip.itineraries.should have(3).items
|
58
|
+
expect(@plantrip.itineraries.first).to be_a(Ratis::Itinerary)
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should set all the Plantrip values to instance vars" do
|
62
|
+
plantrip = Ratis::Plantrip.where(@conditions.dup)
|
63
|
+
expect(plantrip.walkable).to eq(nil)
|
64
|
+
expect(plantrip.walkadjust).to eq(nil)
|
65
|
+
|
66
|
+
input = {
|
67
|
+
:accessible => "N",
|
68
|
+
:arrdep => "D",
|
69
|
+
:date => "01/13/2014",
|
70
|
+
:destinationlandmarkid => "0",
|
71
|
+
:destinationlat => "33.446347",
|
72
|
+
:destinationlong => "-112.068689",
|
73
|
+
:destinationtext => "Destination",
|
74
|
+
:minimize => "T",
|
75
|
+
:originlandmarkid => "0",
|
76
|
+
:originlat => "33.452082",
|
77
|
+
:originlong => "-112.074374",
|
78
|
+
:origintext => "Origin",
|
79
|
+
:time => "06:00 AM",
|
80
|
+
:walkdestination => "0.50",
|
81
|
+
:walkdist => "0.50",
|
82
|
+
:walkorigin => "0.50",
|
83
|
+
:walkspeed => " 2.00 "
|
84
|
+
}
|
85
|
+
|
86
|
+
HashDiff.diff(plantrip.input, input).should eql []
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
|
@@ -10,8 +10,8 @@ describe Ratis::Point2Point do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
describe 'Routesonly => Y' do
|
13
|
-
describe '#where' do
|
14
|
-
describe 'services from origin to destination'
|
13
|
+
describe '#where', vcr: {} do
|
14
|
+
describe 'services from origin to destination' do
|
15
15
|
before do
|
16
16
|
@today = Chronic.parse('next monday at 6am').strftime("%m/%d/%Y")
|
17
17
|
@conditions = {:routes_only => true,
|
@@ -81,7 +81,7 @@ describe Ratis::Point2Point do
|
|
81
81
|
|
82
82
|
describe 'Routesonly => N' do
|
83
83
|
|
84
|
-
describe '#where' do
|
84
|
+
describe '#where', vcr: {} do
|
85
85
|
|
86
86
|
before do
|
87
87
|
@today = Time.now.strftime("%m/%d/%Y")
|
@@ -139,11 +139,11 @@ describe Ratis::Point2Point do
|
|
139
139
|
on_stop.should be_a(Ratis::Point2Point::Stop)
|
140
140
|
|
141
141
|
on_stop.description.should eql('JEFFERSON ST & 18TH AVE')
|
142
|
-
on_stop.latitude.should eql(33.
|
143
|
-
on_stop.longitude.should eql(-112.
|
142
|
+
on_stop.latitude.should eql(33.4469)
|
143
|
+
on_stop.longitude.should eql(-112.097897)
|
144
144
|
on_stop.atis_stop_id.should eql(9469)
|
145
|
-
on_stop.walk_dist.should eql(0.
|
146
|
-
on_stop.walk_dir.should eql('
|
145
|
+
on_stop.walk_dist.should eql(0.013)
|
146
|
+
on_stop.walk_dir.should eql('S')
|
147
147
|
on_stop.walk_hint.should eql('N')
|
148
148
|
end
|
149
149
|
|
@@ -155,11 +155,11 @@ describe Ratis::Point2Point do
|
|
155
155
|
off_stop.should be_a(Ratis::Point2Point::Stop)
|
156
156
|
|
157
157
|
off_stop.description.should eql('JEFFERSON ST & 3RD AVE')
|
158
|
-
off_stop.latitude.should eql(33.
|
159
|
-
off_stop.longitude.should eql(-112.
|
158
|
+
off_stop.latitude.should eql(33.447029)
|
159
|
+
off_stop.longitude.should eql(-112.077181)
|
160
160
|
off_stop.atis_stop_id.should eql(1463)
|
161
|
-
off_stop.walk_dist.should eql(0.
|
162
|
-
off_stop.walk_dir.should eql('
|
161
|
+
off_stop.walk_dist.should eql(0.014)
|
162
|
+
off_stop.walk_dir.should eql('SE')
|
163
163
|
off_stop.walk_hint.should eql('N')
|
164
164
|
end
|
165
165
|
|
@@ -185,7 +185,7 @@ describe Ratis::Point2Point do
|
|
185
185
|
service.direction.should eql('O')
|
186
186
|
service.service_type.should eql('W')
|
187
187
|
service.signage.should eql('I-10 EAST RAPID To 40 St/Pecos')
|
188
|
-
service.route_type.should eql('
|
188
|
+
service.route_type.should eql('N')
|
189
189
|
service.exception.should eql('N')
|
190
190
|
end
|
191
191
|
|
data/spec/ratis/request_spec.rb
CHANGED
@@ -9,15 +9,16 @@ describe Ratis::RoutePattern do
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
describe '#where' do
|
13
|
-
|
12
|
+
describe '#where', vcr: {} do
|
13
|
+
# :route_short_name => "LTRL", :direction => "E", :date => "01/01/2014", :service_type => 'W', :routeid => "46880"
|
14
14
|
before do
|
15
|
-
@today = Chronic.parse('
|
16
|
-
@conditions = {:route_short_name => '
|
17
|
-
:direction => '
|
15
|
+
@today = Chronic.parse('today at 12pm')
|
16
|
+
@conditions = {:route_short_name => 'LTRL',
|
17
|
+
:direction => 'E',
|
18
18
|
:date => @today,
|
19
19
|
:service_type => 'W',
|
20
|
-
:routeid => '
|
20
|
+
:routeid => '46880'
|
21
|
+
}
|
21
22
|
end
|
22
23
|
|
23
24
|
it 'only makes one request' do
|
@@ -29,11 +30,11 @@ describe Ratis::RoutePattern do
|
|
29
30
|
it 'requests the correct SOAP action' do
|
30
31
|
Ratis::Request.should_receive(:get) do |action, options|
|
31
32
|
action.should eq('Routepattern')
|
32
|
-
options["Route"].should eq('
|
33
|
-
options["Direction"].should eq('
|
33
|
+
options["Route"].should eq('LTRL')
|
34
|
+
options["Direction"].should eq('E')
|
34
35
|
options["Date"].should eq(@today)
|
35
36
|
options["Servicetype"].should eq('W')
|
36
|
-
options["Routeid"].should eq('
|
37
|
+
options["Routeid"].should eq('46880')
|
37
38
|
|
38
39
|
end.and_return(double('response', :success? => false))
|
39
40
|
|
@@ -60,13 +61,13 @@ describe Ratis::RoutePattern do
|
|
60
61
|
routepattern = Ratis::RoutePattern.all(@conditions.dup)
|
61
62
|
stop = routepattern.stops.first
|
62
63
|
|
63
|
-
expect(stop.desc).to eq('
|
64
|
+
expect(stop.desc).to eq('MONTEBELLO/19TH AVE LIGHT RAIL STATION')
|
64
65
|
expect(stop.area).to eq('Phoenix')
|
65
|
-
expect(stop.atisid).to eq('
|
66
|
-
expect(stop.stopid).to eq('
|
67
|
-
expect(stop.point).to eq("33.
|
68
|
-
expect(stop.lat).to eq('33.
|
69
|
-
expect(stop.lng).to eq('-112.
|
66
|
+
expect(stop.atisid).to eq('10869')
|
67
|
+
expect(stop.stopid).to eq('10001')
|
68
|
+
expect(stop.point).to eq("33.52120,-112.09975")
|
69
|
+
expect(stop.lat).to eq('33.52120')
|
70
|
+
expect(stop.lng).to eq('-112.09975')
|
70
71
|
expect(stop.boardflag).to eq('E')
|
71
72
|
expect(stop.timepoint).to eq('Y')
|
72
73
|
end
|
@@ -9,12 +9,12 @@ describe Ratis::RouteStops do
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
describe '
|
12
|
+
describe '.all', vcr: {} do
|
13
13
|
|
14
14
|
before do
|
15
15
|
@today = Time.now.strftime("%m/%d/%Y")
|
16
|
-
@conditions = {:route => '
|
17
|
-
:direction => '
|
16
|
+
@conditions = {:route => '1',
|
17
|
+
:direction => 'E',
|
18
18
|
:order => 'A' }
|
19
19
|
end
|
20
20
|
|
@@ -27,8 +27,8 @@ describe Ratis::RouteStops do
|
|
27
27
|
it 'requests the correct SOAP action with correct args' do
|
28
28
|
Ratis::Request.should_receive(:get) do |action, options|
|
29
29
|
action.should eq('Routestops')
|
30
|
-
options["Route"].should eq('
|
31
|
-
options["Direction"].should eq('
|
30
|
+
options["Route"].should eq('1')
|
31
|
+
options["Direction"].should eq('E')
|
32
32
|
options["Order"].should eq('A')
|
33
33
|
|
34
34
|
end.and_return(double('response', :success? => false))
|
@@ -47,15 +47,15 @@ describe Ratis::RouteStops do
|
|
47
47
|
route_stops = Ratis::RouteStops.all(@conditions.dup)
|
48
48
|
stop = route_stops.first
|
49
49
|
|
50
|
-
expect(stop.description).to eq('
|
50
|
+
expect(stop.description).to eq('7TH ST & VAN BUREN ST')
|
51
51
|
expect(stop.area).to eq('Phoenix')
|
52
|
-
expect(stop.atis_stop_id).to eq('
|
53
|
-
expect(stop.stop_seq).to eq('
|
52
|
+
expect(stop.atis_stop_id).to eq('4390')
|
53
|
+
expect(stop.stop_seq).to eq('20')
|
54
54
|
expect(stop.stop_id).to be_nil
|
55
55
|
expect(stop.point).to be_nil
|
56
56
|
expect(stop.alpha_seq).to be_nil
|
57
|
-
expect(stop.latitude).to eq('33.
|
58
|
-
expect(stop.longitude).to eq('-112.
|
57
|
+
expect(stop.latitude).to eq('33.450994')
|
58
|
+
expect(stop.longitude).to eq('-112.065249')
|
59
59
|
end
|
60
60
|
|
61
61
|
it "should raise error for missing arg route" do
|
data/spec/ratis/routes_spec.rb
CHANGED
@@ -11,10 +11,10 @@ describe Ratis::Routes do
|
|
11
11
|
|
12
12
|
let(:empty_body){ {:allroutes2_response => {:routes => []}} }
|
13
13
|
|
14
|
-
describe '#all' do
|
14
|
+
describe '#all', vcr: {} do
|
15
15
|
it 'returns all routes' do
|
16
16
|
response = Ratis::Routes.all
|
17
|
-
expect(response).to have(
|
17
|
+
expect(response).to have(104).items
|
18
18
|
expect(response.all?{|rte| rte.is_a?(Ratis::Route) }).to be_true
|
19
19
|
end
|
20
20
|
|
@@ -37,10 +37,10 @@ describe Ratis::Routes do
|
|
37
37
|
|
38
38
|
expect(response).to be_a(Array)
|
39
39
|
expect(route).to be_a(Ratis::Route)
|
40
|
-
expect(route.short_name).to eq('
|
40
|
+
expect(route.short_name).to eq('1')
|
41
41
|
expect(route.directions).to have(2).directions
|
42
|
-
expect(route.directions).to include('
|
43
|
-
expect(route.directions).to include('
|
42
|
+
expect(route.directions).to include('E')
|
43
|
+
expect(route.directions).to include('W')
|
44
44
|
end
|
45
45
|
|
46
46
|
end
|
@@ -9,7 +9,7 @@ describe Ratis::Timetable do
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
describe '#where' do
|
12
|
+
describe '#where', vcr: {} do
|
13
13
|
|
14
14
|
before do
|
15
15
|
@today = Time.now.strftime("%m/%d/%Y")
|
@@ -63,14 +63,14 @@ describe Ratis::Timetable do
|
|
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('10/28/13')
|
67
67
|
|
68
68
|
stop = timetable.timepoints.first
|
69
69
|
|
70
70
|
expect(stop.ratis_stop_id).to eq(0)
|
71
71
|
expect(stop.atis_stop_id).to eq('3317')
|
72
72
|
expect(stop.stop_id).to eq('10050')
|
73
|
-
expect(stop.description).to eq('CENTRAL AVE & DOBBINS RD')
|
73
|
+
expect(stop.description).to eq('CENTRAL AVE & DOBBINS RD')
|
74
74
|
expect(stop.area).to eq('Phoenix')
|
75
75
|
|
76
76
|
trip = timetable.trips.first
|