ratis 3.4.3 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/CHANGELOG +40 -39
- data/README.md +1 -15
- data/lib/ratis/area.rb +1 -1
- data/lib/ratis/config.rb +2 -4
- data/lib/ratis/fleet_location.rb +2 -7
- data/lib/ratis/landmark.rb +1 -4
- data/lib/ratis/location.rb +1 -3
- data/lib/ratis/location_type_ahead.rb +1 -4
- data/lib/ratis/next_bus.rb +0 -2
- data/lib/ratis/next_bus2.rb +1 -3
- data/lib/ratis/plantrip.rb +1 -3
- data/lib/ratis/request.rb +5 -2
- data/lib/ratis/schedule_nearby.rb +1 -3
- data/lib/ratis/timetable.rb +1 -5
- data/lib/ratis/version.rb +1 -1
- data/lib/ratis/walkstop.rb +1 -3
- data/ratis.gemspec +15 -15
- data/spec/ratis/area_spec.rb +1 -10
- data/spec/ratis/closest_stop_spec.rb +0 -14
- data/spec/ratis/config_spec.rb +21 -30
- data/spec/ratis/core_ext_spec.rb +0 -11
- data/spec/ratis/fleet_location_spec.rb +8 -25
- data/spec/ratis/itinerary_spec.rb +0 -10
- data/spec/ratis/landmark_category_spec.rb +1 -12
- data/spec/ratis/landmark_spec.rb +12 -25
- data/spec/ratis/location_spec.rb +5 -16
- data/spec/ratis/location_type_ahead_item_spec.rb +11 -9
- data/spec/ratis/location_type_ahead_spec.rb +7 -21
- data/spec/ratis/next_bus2_spec.rb +67 -81
- data/spec/ratis/next_bus_spec.rb +20 -37
- data/spec/ratis/pattern_spec.rb +2 -10
- data/spec/ratis/plantrip_spec.rb +19 -18
- data/spec/ratis/point_2_point_spec.rb +3 -11
- data/spec/ratis/request_spec.rb +1 -20
- data/spec/ratis/route_pattern_spec.rb +2 -14
- data/spec/ratis/route_spec.rb +1 -10
- data/spec/ratis/route_stops_spec.rb +1 -10
- data/spec/ratis/routes_spec.rb +1 -9
- data/spec/ratis/schedule_nearby_spec.rb +1 -11
- data/spec/ratis/timetable_spec.rb +24 -44
- data/spec/ratis/walkstop_spec.rb +22 -47
- data/spec/spec_helper.rb +4 -3
- data/spec/support/vcr_cassettes/Nextbus2_running_LATE.yml +141 -1
- data/spec/support/vcr_cassettes/Nextbus_running_LATE.yml +2 -2
- data/spec/support/vcr_cassettes/Point2Point.yml +2 -2
- data/spec/support/vcr_cassettes/Ratis_Area/_all/only_makes_one_request.yml +19 -9
- data/spec/support/vcr_cassettes/Ratis_ClosestStop/_where/only_makes_one_request.yml +9 -9
- data/spec/support/vcr_cassettes/Ratis_ClosestStop/_where/parses_out_the_stop_fields_correctly.yml +9 -9
- data/spec/support/vcr_cassettes/Ratis_ClosestStop/_where/returns_multiple_locations.yml +9 -9
- data/spec/support/vcr_cassettes/Ratis_ClosestStop/_where/should_return_a_collection_of_Ratis_Stop_s_.yml +9 -9
- data/spec/support/vcr_cassettes/Ratis_FleetLocation/_current/only_makes_one_request.yml +661 -563
- data/spec/support/vcr_cassettes/Ratis_FleetLocation/_current/parses_out_the_vehicle_fields_correctly.yml +661 -584
- data/spec/support/vcr_cassettes/Ratis_FleetLocation/_current/returns_multiple_vehicles.yml +661 -575
- data/spec/support/vcr_cassettes/Ratis_FleetLocation/_current/should_return_a_collection_of_Ratis_Vehicle_s_.yml +661 -575
- data/spec/support/vcr_cassettes/Ratis_Landmark/_where/only_makes_one_request.yml +67 -1444
- data/spec/support/vcr_cassettes/Ratis_Landmark/_where/parses_out_the_landmark_fields_correctly.yml +67 -1444
- data/spec/support/vcr_cassettes/Ratis_Landmark/_where/returns_multiple_landmarks.yml +67 -1444
- data/spec/support/vcr_cassettes/Ratis_Landmark/_where/should_return_a_collection_of_Ratis_Landmark_s_.yml +67 -1444
- data/spec/support/vcr_cassettes/Ratis_LandmarkCategory/_all/only_makes_one_request.yml +9 -9
- data/spec/support/vcr_cassettes/Ratis_LandmarkCategory/_all/should_return_a_collection_of_Ratis_LandmarkCategory_s_.yml +9 -9
- data/spec/support/vcr_cassettes/Ratis_LandmarkCategory/_all/should_return_all_landmark_categories.yml +9 -9
- data/spec/support/vcr_cassettes/Ratis_LandmarkCategory/_web_categories/does_something.yml +9 -9
- data/spec/support/vcr_cassettes/Ratis_Location/_where/only_makes_one_request.yml +11 -11
- data/spec/support/vcr_cassettes/Ratis_Location/_where/parses_out_fields_correctly.yml +11 -11
- data/spec/support/vcr_cassettes/Ratis_Location/_where/should_return_a_collection_of_Ratis_Location_s_.yml +11 -11
- data/spec/support/vcr_cassettes/Ratis_LocationTypeAhead/_where/only_makes_one_request.yml +10 -10
- data/spec/support/vcr_cassettes/Ratis_LocationTypeAhead/_where/parses_out_fields_correctly.yml +10 -10
- data/spec/support/vcr_cassettes/Ratis_LocationTypeAhead/_where/should_return_a_collection_of_Ratis_LocationTypeAheadItem_s_.yml +10 -10
- data/spec/support/vcr_cassettes/Ratis_NextBus/_where/multiple_services_returned/only_makes_one_request.yml +29 -28
- data/spec/support/vcr_cassettes/Ratis_NextBus/_where/multiple_services_returned/returns_the_next_4_bus_times.yml +29 -28
- data/spec/support/vcr_cassettes/Ratis_NextBus/_where/multiple_services_returned/should_map_all_the_services_to_service_openstruct_objects.yml +29 -28
- data/spec/support/vcr_cassettes/Ratis_NextBus/_where/multiple_services_returned/should_raise_error_if_datetime_condition_is_not_a_DateTime_or_Time.yml +62 -80
- data/spec/support/vcr_cassettes/Ratis_NextBus/_where/single_service_return/only_makes_one_request.yml +18 -17
- data/spec/support/vcr_cassettes/Ratis_NextBus/_where/single_service_return/returns_the_next_bus_times.yml +18 -17
- data/spec/support/vcr_cassettes/Ratis_NextBus/_where/single_service_return/should_raise_error_if_datetime_condition_is_not_a_DateTime_or_Time.yml +52 -52
- data/spec/support/vcr_cassettes/Ratis_NextBus/_where/single_service_return/should_set_all_the_service_values_to_instance_vars.yml +18 -17
- data/spec/support/vcr_cassettes/Ratis_NextBus2/_where/runs/should_set_the_run_values_to_instance_vars.yml +125 -0
- data/spec/support/vcr_cassettes/Ratis_NextBus2/_where/single_next_bus/only_makes_one_request.yml +125 -0
- data/spec/support/vcr_cassettes/Ratis_NextBus2/_where/single_next_bus/requests_the_correct_SOAP_action.yml +125 -0
- data/spec/support/vcr_cassettes/Ratis_NextBus2/_where/stops/should_set_the_stop_values_to_instance_vars.yml +125 -0
- data/spec/support/vcr_cassettes/Ratis_Pattern/_all/only_makes_one_request.yml +12 -12
- data/spec/support/vcr_cassettes/Ratis_Pattern/_all/should_parse_the_route_info_fields.yml +12 -12
- data/spec/support/vcr_cassettes/Ratis_Pattern/_all/should_return_a_collection_Pattern_RouteInfo_s_.yml +12 -12
- data/spec/support/vcr_cassettes/Ratis_Pattern/_all/should_return_no_data_error_when_date_is_in_the_past.yml +5 -5
- data/spec/support/vcr_cassettes/Ratis_Plantrip/_where/creates_Ratis_Itineraries_for_each_trip_itinerary.yml +30 -30
- data/spec/support/vcr_cassettes/Ratis_Plantrip/_where/only_makes_one_request.yml +30 -30
- data/spec/support/vcr_cassettes/Ratis_Plantrip/_where/returns_a_Plantrip_object.yml +30 -30
- data/spec/support/vcr_cassettes/Ratis_Plantrip/_where/should_set_all_the_Plantrip_values_to_instance_vars.yml +30 -30
- data/spec/support/vcr_cassettes/Ratis_Point2Point/Routesonly_N/_where/gets_the_groups.yml +68 -74
- data/spec/support/vcr_cassettes/Ratis_Point2Point/Routesonly_N/_where/gets_the_trips_within_each_group.yml +68 -74
- data/spec/support/vcr_cassettes/Ratis_Point2Point/Routesonly_N/_where/only_makes_one_request.yml +68 -74
- data/spec/support/vcr_cassettes/Ratis_Point2Point/Routesonly_N/_where/parses_out_the_off_stop_fields.yml +68 -74
- data/spec/support/vcr_cassettes/Ratis_Point2Point/Routesonly_N/_where/parses_out_the_on_stop_fields.yml +68 -74
- data/spec/support/vcr_cassettes/Ratis_Point2Point/Routesonly_N/_where/parses_out_the_service.yml +68 -74
- data/spec/support/vcr_cassettes/Ratis_Point2Point/Routesonly_N/_where/parses_out_the_trip.yml +68 -74
- data/spec/support/vcr_cassettes/Ratis_Point2Point/Routesonly_N/_where/should_only_return_result_groups_for_filtered_route.yml +15 -17
- data/spec/support/vcr_cassettes/Ratis_Point2Point/Routesonly_N/_where/should_only_return_result_groups_for_filtered_routes.yml +19 -21
- 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 +5 -5
- data/spec/support/vcr_cassettes/Ratis_Point2Point/Routesonly_Y/_where/services_from_origin_to_destination/only_makes_one_request.yml +29 -29
- data/spec/support/vcr_cassettes/Ratis_Point2Point/Routesonly_Y/_where/services_from_origin_to_destination/parses_out_service_fields.yml +29 -29
- 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 +29 -29
- 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 +29 -29
- data/spec/support/vcr_cassettes/Ratis_Point2Point/Routesonly_Y/_where/services_from_origin_to_destination/should_NOT_filter_by_passed_in_routes.yml +29 -29
- data/spec/support/vcr_cassettes/Ratis_RoutePattern/_where/only_makes_one_request.yml +133 -70
- data/spec/support/vcr_cassettes/Ratis_RoutePattern/_where/should_parse_the_stop_fields.yml +133 -70
- data/spec/support/vcr_cassettes/Ratis_RoutePattern/_where/should_return_a_collection_Ratis_RoutePattern_Point_s_.yml +132 -69
- data/spec/support/vcr_cassettes/Ratis_RoutePattern/_where/should_return_a_collection_Ratis_RoutePattern_Stop_s_.yml +133 -70
- data/spec/support/vcr_cassettes/Ratis_RouteStops/_all/only_makes_one_request.yml +50 -50
- data/spec/support/vcr_cassettes/Ratis_RouteStops/_all/parses_out_the_stop_fields_correctly.yml +50 -50
- data/spec/support/vcr_cassettes/Ratis_RouteStops/_all/should_return_a_collection_of_Ratis_RouteStops_Stop_s_.yml +50 -50
- data/spec/support/vcr_cassettes/Ratis_Routes/_all/only_makes_one_request.yml +346 -370
- data/spec/support/vcr_cassettes/Ratis_Routes/_all/returns_all_routes.yml +346 -370
- data/spec/support/vcr_cassettes/Ratis_Routes/_all/should_set_directions_and_short_name_to_variables.yml +346 -370
- data/spec/support/vcr_cassettes/Ratis_ScheduleNearby/_where/only_makes_one_request.yml +42 -41
- data/spec/support/vcr_cassettes/Ratis_ScheduleNearby/_where/returns_a_non_nil_ScheduleNearby.yml +42 -41
- data/spec/support/vcr_cassettes/Ratis_ScheduleNearby/_where/returns_a_single_service_at_the_stop.yml +42 -41
- data/spec/support/vcr_cassettes/Ratis_ScheduleNearby/_where/returns_all_the_stops.yml +42 -41
- data/spec/support/vcr_cassettes/Ratis_ScheduleNearby/_where/should_return_no_data_error_when_date_is_in_the_past.yml +5 -5
- data/spec/support/vcr_cassettes/Ratis_Timetable/_where/ATIS_call/should_not_throw_a_500.yml +719 -0
- data/spec/support/vcr_cassettes/Ratis_Timetable/_where/only_makes_one_request.yml +315 -315
- data/spec/support/vcr_cassettes/Ratis_Timetable/_where/should_parse_the_timetable/stop/trip_fields.yml +315 -315
- data/spec/support/vcr_cassettes/Ratis_Timetable/_where/should_return_a_collection_Timetable_Stop_s_.yml +315 -315
- data/spec/support/vcr_cassettes/Ratis_Walkstop/_where/only_makes_one_request.yml +9 -9
- data/spec/support/vcr_cassettes/Ratis_Walkstop/_where/should_set_all_the_walkstop_values_to_instance_vars.yml +9 -9
- metadata +9 -9
- data/.rvmrc +0 -1
- data/spec/support/vcr_cassettes/Ratis_LocationTypeAhead/_where/should_return_a_collection_of_Ratis_Location_s_.yml +0 -54
- 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 +0 -180
- 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 +0 -180
- 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 +0 -180
- 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 +0 -180
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 282d28c9d2eeafb0d0751b298c7b95f66883674c
|
4
|
+
data.tar.gz: ac3a46211cb5f393f6d9b218d141726cd4d94643
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44d8bf2bb1f431e448fc6b4d91c4c461de8571ede8ed6306332b922a00a951acd459a0f2300ac0a32a1c723f6de4cf3b54a654c01c96e3524f4b513ed7c7805e
|
7
|
+
data.tar.gz: 357ff7d97e92bf572f3cba14433d4221801de2b1f055d1aa570d7b5c5aed1793933726c973c2c734af9259145924794eb8730539eb21c22fcc02f540607b74bb
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ratis
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.0.0-p451
|
data/CHANGELOG
CHANGED
@@ -1,57 +1,58 @@
|
|
1
|
-
3.
|
2
|
-
-
|
3
|
-
-
|
1
|
+
3.5.0
|
2
|
+
- Updated all tests to work against ATIS 2.7.1
|
3
|
+
- Added Ratis.config required option: Appid. Appid is now sent with all ATIS requests.
|
4
4
|
|
5
|
-
3.
|
6
|
-
-
|
5
|
+
3.4.2
|
6
|
+
- added support for ATIS ver 2.7.1's Fleetlocation api
|
7
7
|
|
8
|
-
3.1
|
9
|
-
-
|
10
|
-
- Contains info about the stop (:side, :stopid, :heading, :lat, :area, :servicetype, :route, :operator)
|
8
|
+
3.4.1
|
9
|
+
- regeneration of gem to fix missing files
|
11
10
|
|
12
|
-
3.
|
13
|
-
-
|
11
|
+
3.4 (3/11/14)
|
12
|
+
- added location type ahead support
|
13
|
+
- added test spec for location type ahead support
|
14
14
|
|
15
|
-
3.
|
16
|
-
-
|
15
|
+
3.3.7
|
16
|
+
- all tests now use VCR
|
17
|
+
- fixes for failing tests
|
18
|
+
- changed itinerary_spec to plantrip_spec
|
19
|
+
- created new empty itinerary_spec as stub
|
20
|
+
- changed walk_spec to walkstop_spec
|
17
21
|
|
18
|
-
3.
|
19
|
-
-
|
22
|
+
3.3.5
|
23
|
+
- Refactored Ratis::Location to be usable in Trip Planner
|
20
24
|
|
21
|
-
3.1
|
22
|
-
-
|
25
|
+
3.2.1
|
26
|
+
- Timetable::Trip now contains the trip's headsign
|
23
27
|
|
24
|
-
3.
|
25
|
-
-
|
28
|
+
3.2.0
|
29
|
+
- When querying Nextbus for a Light Rail stop, in most cases you will actually get back 2 stops for a single NextRide ID. One for each side of the stop platform. Made changes to handle this case. Both stops services are flattened into the #services attribute.
|
26
30
|
|
27
31
|
3.1.8
|
28
32
|
- Within to_hash_from_xml, pull route and sign attributes from the service instead of the realtime info (they always seem to be blank)
|
29
33
|
|
30
|
-
3.
|
31
|
-
-
|
34
|
+
3.1.7
|
35
|
+
- Removed to_hash, instead use better named to_hash_for_xml for use with NextRide SMS service end-point
|
32
36
|
|
33
|
-
3.
|
34
|
-
- Timetable::Trip
|
37
|
+
3.1.6
|
38
|
+
- Added field 'sign' to Ratis::Timetable::Trip, this is the headsign for a bus running a given trip
|
35
39
|
|
36
|
-
3.
|
37
|
-
-
|
40
|
+
3.1.5
|
41
|
+
- Bug Fix: NextBus where was incorrectly sending Time in 12 hour format when ATIS needs it in 24 hour format.
|
38
42
|
|
39
|
-
3.
|
40
|
-
-
|
41
|
-
- fixes for failing tests
|
42
|
-
- changed itinerary_spec to plantrip_spec
|
43
|
-
- created new empty itinerary_spec as stub
|
44
|
-
- changed walk_spec to walkstop_spec
|
43
|
+
3.1.4
|
44
|
+
- Bug Fix: NextBus trips returned can be an array or a single hash
|
45
45
|
|
46
|
-
3.
|
47
|
-
-
|
48
|
-
- added test spec for location type ahead support
|
46
|
+
3.1.3
|
47
|
+
- Turns out that in the NextBus calls the <service> tag can come back as either a single node or list of nodes. In one case savon turns this into an array, in the other case it's just a single entity. Rewrote NextBus.where to handle these two cases, this also means NextBus would never really represent a single service. Created a NextBus.services method that returns all these entities in a similar manner. Update test specs
|
49
48
|
|
50
|
-
3.
|
51
|
-
-
|
49
|
+
3.1.2
|
50
|
+
- NextBus#stop added
|
51
|
+
- Contains info about the stop (:side, :stopid, :heading, :lat, :area, :servicetype, :route, :operator)
|
52
52
|
|
53
|
-
3.
|
54
|
-
-
|
53
|
+
3.1.1
|
54
|
+
- spec updates, and general tidy
|
55
55
|
|
56
|
-
3.
|
57
|
-
-
|
56
|
+
3.1
|
57
|
+
- The NextBus class was really using the Nextbus2 api call all along. This was pretty confusing, so 2 seperate classes now exist; one for NextBus and NextBus2. This means any code using NextBus prior to 3.1 will break since it was really calling the Nextbus2 api and we've updated it so the class of matching name is calling the matching api method.
|
58
|
+
- Dev dependencies of chronic and rspec-instafail were also added to aid testing
|
data/README.md
CHANGED
@@ -31,6 +31,7 @@ Gem installation
|
|
31
31
|
|
32
32
|
require 'ratis/config'
|
33
33
|
Ratis.configure do |config|
|
34
|
+
config.appid = '(YOUR APP ID)'
|
34
35
|
config.endpoint = 'http://(YOUR ENDPOINT URL)'
|
35
36
|
config.namespace = '(YOUR NAMESPACE)'
|
36
37
|
config.proxy = 'http://localhost:8080'
|
@@ -44,21 +45,6 @@ NOTE ABOUT VERSIONS
|
|
44
45
|
-------------------
|
45
46
|
The versioning strategy for Ratis gem is the major, minor, and build components are set to match the ATIS version you are running. At the time of this edit, ATIS version 2.5.2 is matched with Ratis gem version 2.5.2.x. The last component is the patch version of the gem. This is the number that increases as we add feature from a particular ATIS version.
|
46
47
|
|
47
|
-
1. Add the following configuration block.
|
48
|
-
|
49
|
-
This must happen before Ratis is `require`d (before `Rails::Initializer.run` in a Rails app).
|
50
|
-
|
51
|
-
require 'ratis/config'
|
52
|
-
Ratis.configure do |config|
|
53
|
-
config.endpoint = 'http://(YOUR ENDPOINT URL)'
|
54
|
-
config.namespace = '(YOUR NAMESPACE)'
|
55
|
-
config.proxy = 'http://localhost:8080'
|
56
|
-
config.timeout = 5
|
57
|
-
end
|
58
|
-
|
59
|
-
If Ratis is `require`d prior to this config being set you will get a `RuntimeError` informing you so.
|
60
|
-
If the provided `endpoint` is invalid an `ArgumentError: Invalid URL: bad URI` will be thrown, but only when a request is made.
|
61
|
-
|
62
48
|
Gem usage
|
63
49
|
-------------------
|
64
50
|
|
data/lib/ratis/area.rb
CHANGED
data/lib/ratis/config.rb
CHANGED
@@ -2,12 +2,10 @@ module Ratis
|
|
2
2
|
|
3
3
|
class Config
|
4
4
|
|
5
|
-
attr_accessor :endpoint, :
|
5
|
+
attr_accessor :appid, :endpoint, :log, :log_level, :namespace, :proxy, :timeout
|
6
6
|
|
7
7
|
def valid?
|
8
|
-
|
9
|
-
return false if endpoint.empty? or namespace.empty?
|
10
|
-
true
|
8
|
+
!(endpoint.nil? || endpoint.empty? || namespace.nil? || namespace.empty? || appid.nil? || appid.empty?)
|
11
9
|
end
|
12
10
|
|
13
11
|
private
|
data/lib/ratis/fleet_location.rb
CHANGED
@@ -24,19 +24,14 @@ module Ratis
|
|
24
24
|
|
25
25
|
class FleetLocation
|
26
26
|
|
27
|
-
def self.current
|
28
|
-
|
29
|
-
|
30
|
-
response = Request.get 'Fleetlocation', {'Appid' => app_id}
|
27
|
+
def self.current
|
28
|
+
response = Request.get 'Fleetlocation'
|
31
29
|
|
32
30
|
return [] unless response.success?
|
33
31
|
|
34
32
|
response.to_array(:fleetlocation_response, :vehicles, :vehicle).map do |vehicle|
|
35
33
|
Vehicle.new(vehicle)
|
36
34
|
end
|
37
|
-
|
38
35
|
end
|
39
|
-
|
40
36
|
end
|
41
|
-
|
42
37
|
end
|
data/lib/ratis/landmark.rb
CHANGED
@@ -12,16 +12,13 @@ module Ratis
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.where(conditions)
|
15
|
-
app_id = conditions.delete(:app_id) || 'WEB'
|
16
15
|
type = conditions.delete(:type).to_s.upcase
|
17
16
|
zipcode = conditions.delete(:zipcode)
|
18
17
|
|
19
18
|
raise ArgumentError.new('You must provide a type') if type.blank?
|
20
19
|
Ratis.all_conditions_used? conditions
|
21
20
|
|
22
|
-
response = Request.get 'Getlandmarks', {'
|
23
|
-
'Type' => type,
|
24
|
-
'Zipcode' => zipcode}
|
21
|
+
response = Request.get 'Getlandmarks', { 'Type' => type, 'Zipcode' => zipcode }
|
25
22
|
|
26
23
|
return [] unless response.success?
|
27
24
|
|
data/lib/ratis/location.rb
CHANGED
@@ -28,7 +28,6 @@ module Ratis
|
|
28
28
|
location = conditions.delete :location
|
29
29
|
media = (conditions.delete(:media) || 'W').to_s.upcase
|
30
30
|
max_answers = conditions.delete(:max_answers) || 20
|
31
|
-
app_id = conditions.delete(:app_id) || 'WEB'
|
32
31
|
area = conditions.delete(:area)
|
33
32
|
region = conditions.delete(:region)
|
34
33
|
|
@@ -38,8 +37,7 @@ module Ratis
|
|
38
37
|
|
39
38
|
Ratis.all_conditions_used? conditions
|
40
39
|
|
41
|
-
response = Request.get 'Locate', {'
|
42
|
-
'Location' => location,
|
40
|
+
response = Request.get 'Locate', {'Location' => location,
|
43
41
|
'Area' => area,
|
44
42
|
'Region' => region,
|
45
43
|
'Maxanswers' => max_answers,
|
@@ -4,14 +4,11 @@ module Ratis
|
|
4
4
|
|
5
5
|
def self.where(conditions={})
|
6
6
|
search_text = conditions.delete(:search)
|
7
|
-
app_id = conditions.delete(:app_id) || 'WEB'
|
8
|
-
|
9
7
|
raise ArgumentError.new('You must provide some search text') unless search_text
|
10
8
|
|
11
9
|
Ratis.all_conditions_used? conditions
|
12
10
|
|
13
|
-
response = Request.get 'Locationtypeahead', {'
|
14
|
-
'Search' => search_text.downcase}
|
11
|
+
response = Request.get 'Locationtypeahead', { 'Search' => search_text.downcase }
|
15
12
|
|
16
13
|
return "" unless response.success?
|
17
14
|
|
data/lib/ratis/next_bus.rb
CHANGED
@@ -79,7 +79,6 @@ module Ratis
|
|
79
79
|
|
80
80
|
def self.where(conditions)
|
81
81
|
stop_id = conditions.delete(:stop_id)
|
82
|
-
app_id = conditions.delete(:app_id) || 'ratis-gem'
|
83
82
|
type = conditions.delete(:type) || 'N' # N for Next Bus
|
84
83
|
|
85
84
|
if datetime = conditions.delete(:datetime)
|
@@ -93,7 +92,6 @@ module Ratis
|
|
93
92
|
Ratis.all_conditions_used?(conditions)
|
94
93
|
|
95
94
|
response = Request.get 'Nextbus', {'Stopid' => stop_id,
|
96
|
-
'Appid' => app_id,
|
97
95
|
'Date' => datetime.strftime("%m/%d/%Y"),
|
98
96
|
'Time' => datetime.strftime("%H%M"),
|
99
97
|
'Type' => type }
|
data/lib/ratis/next_bus2.rb
CHANGED
@@ -39,12 +39,10 @@ module Ratis
|
|
39
39
|
|
40
40
|
def self.where(conditions)
|
41
41
|
stop_id = conditions.delete :stop_id
|
42
|
-
app_id = conditions.delete(:app_id) || 'ratis-gem'
|
43
|
-
|
44
42
|
raise ArgumentError.new('You must provide a stop ID') unless stop_id
|
45
43
|
Ratis.all_conditions_used? conditions
|
46
44
|
|
47
|
-
response = Request.get 'Nextbus2', { 'Stopid' => stop_id
|
45
|
+
response = Request.get 'Nextbus2', { 'Stopid' => stop_id }
|
48
46
|
return [] unless response.success?
|
49
47
|
|
50
48
|
NextBus2.new(response)
|
data/lib/ratis/plantrip.rb
CHANGED
@@ -17,7 +17,6 @@ module Ratis
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.where(conditions)
|
20
|
-
app_id = conditions.delete(:app_id) || 'ratis-gem'
|
21
20
|
minimize = conditions.delete(:minimize).try(:upcase) || 'T'
|
22
21
|
arrdep = conditions.delete(:arrdep).try(:upcase) || "D"
|
23
22
|
maxanswers = conditions.delete(:maxanswers) || '3'
|
@@ -49,8 +48,7 @@ module Ratis
|
|
49
48
|
|
50
49
|
Ratis.all_conditions_used? conditions
|
51
50
|
|
52
|
-
response = Request.get 'Plantrip', {'
|
53
|
-
'Date' => datetime.strftime("%m/%d/%Y"),
|
51
|
+
response = Request.get 'Plantrip', {'Date' => datetime.strftime("%m/%d/%Y"),
|
54
52
|
'Time' => datetime.strftime("%H%M"),
|
55
53
|
'Minimize' => minimize,
|
56
54
|
'Arrdep' => arrdep,
|
data/lib/ratis/request.rb
CHANGED
@@ -6,8 +6,8 @@ module Ratis
|
|
6
6
|
|
7
7
|
def initialize(config = nil)
|
8
8
|
config = Ratis.config if config.nil?
|
9
|
-
raise Errors::ConfigError('It appears that Ratis.configure has not been called') unless config.valid?
|
10
|
-
|
9
|
+
raise Errors::ConfigError('It appears that Ratis.configure has not been called or properly setup') unless config.valid?
|
10
|
+
|
11
11
|
self.class.client do
|
12
12
|
wsdl.endpoint = Ratis.config.endpoint
|
13
13
|
wsdl.namespace = Ratis.config.namespace
|
@@ -22,6 +22,9 @@ module Ratis
|
|
22
22
|
begin
|
23
23
|
raise Errors::ConfigError, 'It appears that Ratis.configure has not been called or properly setup' unless Ratis.config.valid?
|
24
24
|
|
25
|
+
# Merge in the Appid as set in the configuration.
|
26
|
+
params.merge!({ 'Appid' => Ratis.config.appid })
|
27
|
+
|
25
28
|
# ClassMethods from Savon::Model
|
26
29
|
# Necessary since calling Ratis.configure doesn't allow changing of values set during Savon initialization
|
27
30
|
# Savon memoizes the client config
|
@@ -13,7 +13,6 @@ module Ratis
|
|
13
13
|
walk_distance = conditions.delete(:walk_distance)
|
14
14
|
landmark_id = conditions.delete(:landmark_id)
|
15
15
|
stop_id = conditions.delete(:stop_id) || ''
|
16
|
-
app_id = conditions.delete(:app_id) || 'ratis-gem'
|
17
16
|
|
18
17
|
raise ArgumentError.new('You must provide latitude') unless latitude
|
19
18
|
raise ArgumentError.new('You must provide longitude') unless longitude
|
@@ -33,8 +32,7 @@ module Ratis
|
|
33
32
|
'Window' => window,
|
34
33
|
'Walkdist' => walk_distance,
|
35
34
|
'Landmarkid' => landmark_id,
|
36
|
-
'Stopid' => stop_id
|
37
|
-
'Appid' => app_id
|
35
|
+
'Stopid' => stop_id
|
38
36
|
}
|
39
37
|
|
40
38
|
return [] unless response.success?
|
data/lib/ratis/timetable.rb
CHANGED
@@ -34,7 +34,7 @@ module Ratis
|
|
34
34
|
timepoints_array = []
|
35
35
|
|
36
36
|
headway[:timepoints][:stop].each_with_index do |tp, i|
|
37
|
-
timepoints_array << Timetable::Stop.new(i, tp[:atisstopid], tp[:stopid], tp[:description], tp[:area])
|
37
|
+
timepoints_array << Timetable::Stop.new(i, tp[:atisstopid], tp[:stopid], CGI.unescapeHTML(tp[:description]), tp[:area])
|
38
38
|
end rescue []
|
39
39
|
|
40
40
|
timetable.timepoints = timepoints_array
|
@@ -49,9 +49,5 @@ module Ratis
|
|
49
49
|
|
50
50
|
timetable
|
51
51
|
end
|
52
|
-
|
53
|
-
|
54
|
-
|
55
52
|
end
|
56
|
-
|
57
53
|
end
|
data/lib/ratis/version.rb
CHANGED
data/lib/ratis/walkstop.rb
CHANGED
@@ -26,7 +26,6 @@ module Ratis
|
|
26
26
|
start_long = conditions.delete :start_long
|
27
27
|
end_lat = conditions.delete :end_lat
|
28
28
|
end_long = conditions.delete :end_long
|
29
|
-
app_id = conditions.delete(:app_id) || 'ratis-gem'
|
30
29
|
|
31
30
|
raise ArgumentError.new('You must provide a start_lat') unless start_lat
|
32
31
|
raise ArgumentError.new('You must provide a start_long') unless start_long
|
@@ -39,8 +38,7 @@ module Ratis
|
|
39
38
|
'Startlat' => start_lat,
|
40
39
|
'Startlong' => start_long,
|
41
40
|
'Endlat' => end_lat,
|
42
|
-
'Endlong' => end_long
|
43
|
-
'Appid' => app_id
|
41
|
+
'Endlong' => end_long
|
44
42
|
|
45
43
|
Walkstop.new(response)
|
46
44
|
end
|
data/ratis.gemspec
CHANGED
@@ -7,26 +7,26 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.version = Ratis.version
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.summary = 'A Ruby wrapper around the ATIS SOAP Interface'
|
10
|
-
s.authors = ['Velocity
|
10
|
+
s.authors = ['Velocity Labs']
|
11
11
|
s.email = 'irish@velocitylabs.io'
|
12
12
|
s.files = `git ls-files`.split($/)
|
13
13
|
s.require_paths = ['lib']
|
14
14
|
s.rdoc_options = ['--charset=UTF-8 --main=README.md']
|
15
15
|
s.extra_rdoc_files = ['README.md']
|
16
16
|
|
17
|
-
s.add_dependency 'savon', '<2.0'
|
17
|
+
s.add_dependency 'savon', '< 2.0'
|
18
18
|
|
19
|
-
s.add_development_dependency 'activesupport',
|
20
|
-
s.add_development_dependency 'bundler',
|
21
|
-
s.add_development_dependency 'chronic',
|
22
|
-
s.add_development_dependency 'hashdiff',
|
23
|
-
s.add_development_dependency 'rake',
|
24
|
-
s.add_development_dependency 'redcarpet',
|
25
|
-
s.add_development_dependency 'rspec',
|
26
|
-
s.add_development_dependency 'rspec-instafail','~> 0.2'
|
27
|
-
s.add_development_dependency 'byebug',
|
28
|
-
s.add_development_dependency 'nokogiri',
|
29
|
-
s.add_development_dependency 'simplecov',
|
30
|
-
s.add_development_dependency 'vcr',
|
31
|
-
s.add_development_dependency 'webmock',
|
19
|
+
s.add_development_dependency 'activesupport', '< 4.0'
|
20
|
+
s.add_development_dependency 'bundler', '~> 1.5'
|
21
|
+
s.add_development_dependency 'chronic', '~> 0.10'
|
22
|
+
s.add_development_dependency 'hashdiff', '~> 0.1'
|
23
|
+
s.add_development_dependency 'rake', '~> 10.1'
|
24
|
+
s.add_development_dependency 'redcarpet', '~> 2.1'
|
25
|
+
s.add_development_dependency 'rspec', '~> 2.14'
|
26
|
+
s.add_development_dependency 'rspec-instafail', '~> 0.2'
|
27
|
+
s.add_development_dependency 'byebug', '~> 2.7'
|
28
|
+
s.add_development_dependency 'nokogiri', '~> 1.6'
|
29
|
+
s.add_development_dependency 'simplecov', '~> 0.8'
|
30
|
+
s.add_development_dependency 'vcr', '~> 2.8'
|
31
|
+
s.add_development_dependency 'webmock', '~> 1.17'
|
32
32
|
end
|
data/spec/ratis/area_spec.rb
CHANGED
@@ -1,14 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Ratis::Area 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
|
-
end
|
11
|
-
|
12
4
|
describe '#all', vcr: {} do
|
13
5
|
it 'only makes one request' do
|
14
6
|
# false just to stop further processing of response
|
@@ -39,5 +31,4 @@ describe Ratis::Area do
|
|
39
31
|
expect(area.description).to eq('Youngtown')
|
40
32
|
end
|
41
33
|
end
|
42
|
-
|
43
|
-
end
|
34
|
+
end
|