ratis 2.5.2.1 → 2.5.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/ratis.rb CHANGED
@@ -10,15 +10,16 @@ require 'ratis/landmark_category'
10
10
  require 'ratis/location'
11
11
  require 'ratis/next_bus'
12
12
  require 'ratis/point_2_point'
13
+ require 'ratis/point_2_point/standard_response'
14
+ require 'ratis/point_2_point/group'
15
+ require 'ratis/point_2_point/trip'
16
+ require 'ratis/point_2_point/service'
17
+ require 'ratis/point_2_point/stop'
13
18
  require 'ratis/request'
14
19
  require 'ratis/route'
15
20
  require 'ratis/route_stops'
16
- require 'ratis/schedule'
17
- require 'ratis/schedule_group'
21
+ require 'ratis/route_stops/stop'
18
22
  require 'ratis/schedule_nearby'
19
- require 'ratis/schedule_trip'
20
- require 'ratis/service'
21
- require 'ratis/stop'
22
23
  require 'ratis/timetable'
23
24
  require 'ratis/walk'
24
25
 
@@ -3,7 +3,7 @@ module Ratis
3
3
  class Point2Point
4
4
 
5
5
  def self.where(conditions)
6
- routes_only = conditions.delete(:routes_only)
6
+ routes_only = conditions.delete(:routes_only) || 'N'
7
7
 
8
8
  origin_lat = conditions.delete(:origin_lat).to_f
9
9
  origin_long = conditions.delete(:origin_long).to_f
@@ -11,7 +11,7 @@ module Ratis
11
11
  destination_long = conditions.delete(:destination_long).to_f
12
12
 
13
13
  date = conditions.delete :date
14
- start_time = conditions.delete :start_time
14
+ start_time = conditions.delete(:start_time)
15
15
  end_time = conditions.delete :end_time
16
16
 
17
17
  raise ArgumentError.new("You must specify routes only with true, false, 'y' or 'n'") unless routes_only.y_or_n rescue false
@@ -44,7 +44,7 @@ module Ratis
44
44
 
45
45
  def self.parse_routes_only_yes(response)
46
46
  response.to_array(:point2point_response, :routes, :service).map do |service|
47
- atis_service = Service.new
47
+ atis_service = Point2Point::RoutesOnlyResponse.new
48
48
  atis_service.route = service[:route]
49
49
  atis_service.direction = service[:direction]
50
50
  atis_service.service_type = service[:servicetype]
@@ -57,9 +57,9 @@ module Ratis
57
57
  def self.parse_routes_only_no(response)
58
58
  return nil unless response.success?
59
59
 
60
- atis_schedule = Schedule.new
60
+ atis_schedule = Point2Point::StandardResponse.new
61
61
  atis_schedule.groups = response.to_array(:point2point_response, :groups, :group).map do |group|
62
- atis_schedule_group = ScheduleGroup.new
62
+ atis_schedule_group = Point2Point::Group.new
63
63
 
64
64
  # Point2point 1.3 uses inconsistent tag naming, thus: <onstop> <onwalk...>, but <offstop> <offstopwalk...>
65
65
  # this docs says this is fixed in 1.4, so watch out
@@ -67,12 +67,12 @@ module Ratis
67
67
  atis_schedule_group.off_stop = atis_stop_from_hash 'offstop', group[:offstop]
68
68
 
69
69
  atis_schedule_group.trips = group.to_array(:trips, :trip).map do |trip|
70
- atis_trip = ScheduleTrip.new
70
+ atis_trip = Point2Point::Trip.new
71
71
  atis_trip.on_time = trip[:ontime]
72
72
  atis_trip.off_time = trip[:offtime]
73
73
 
74
74
  atis_trip.service = trip.to_array(:service).map do |service|
75
- atis_service = Service.new
75
+ atis_service = Point2Point::Service.new
76
76
 
77
77
  atis_service.route = service[:route]
78
78
  atis_service.direction = service[:direction]
@@ -95,7 +95,7 @@ module Ratis
95
95
  def self.atis_stop_from_hash(prefix, stop)
96
96
  return nil if stop.blank?
97
97
 
98
- atis_stop = Stop.new
98
+ atis_stop = Point2Point::Stop.new
99
99
  atis_stop.description = stop[:description]
100
100
  atis_stop.atis_stop_id = stop[:atisstopid].to_i
101
101
  atis_stop.latitude = stop[:lat].to_f
@@ -0,0 +1,7 @@
1
+ module Ratis
2
+
3
+ class Point2Point::Group < Struct.new(:on_stop, :off_stop, :trips)
4
+
5
+ end
6
+
7
+ end
@@ -0,0 +1,7 @@
1
+ module Ratis
2
+
3
+ class Point2Point::Service < Struct.new(:route, :direction, :service_type, :signage, :route_type, :exception)
4
+
5
+ end
6
+
7
+ end
@@ -0,0 +1,7 @@
1
+ module Ratis
2
+
3
+ class Point2Point::StandardResponse < Struct.new(:groups)
4
+
5
+ end
6
+
7
+ end
@@ -0,0 +1,8 @@
1
+ module Ratis
2
+
3
+ class Point2Point::Stop < Struct.new(:description, :atis_stop_id, :latitude, :longitude,
4
+ :walk_dist, :walk_dir, :walk_hint)
5
+
6
+ end
7
+
8
+ end
@@ -0,0 +1,7 @@
1
+ module Ratis
2
+
3
+ class Point2Point::Trip < Struct.new(:on_time, :off_time, :service)
4
+
5
+ end
6
+
7
+ end
@@ -25,7 +25,7 @@ module Ratis
25
25
  return [] unless response.success?
26
26
 
27
27
  response.to_hash[:routestops_response][:stops][:stop].map do |s|
28
- stop = Stop.new
28
+ stop = RouteStops::Stop.new
29
29
  stop.description = s[:description]
30
30
  stop.area = s[:area]
31
31
  stop.atis_stop_id = s[:atisstopid]
@@ -0,0 +1,4 @@
1
+ module Ratis
2
+ class RouteStops::Stop < Struct.new(:description, :area, :stop_id, :atis_stop_id, :point, :alpha_seq, :stop_seq, :latitude, :longitude)
3
+ end
4
+ end
data/lib/ratis/version.rb CHANGED
@@ -4,7 +4,7 @@ module Ratis
4
4
 
5
5
  def version
6
6
  @version ||= begin
7
- string = '2.5.2.1'
7
+ string = '2.5.2.2'
8
8
 
9
9
  def string.parts
10
10
  split('.').map { |p| p.to_i }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ratis
3
3
  version: !ruby/object:Gem::Version
4
- hash: 77
4
+ hash: 75
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 5
9
9
  - 2
10
- - 1
11
- version: 2.5.2.1
10
+ - 2
11
+ version: 2.5.2.2
12
12
  platform: ruby
13
13
  authors:
14
14
  - AuthorityLabs
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-08-15 00:00:00 Z
19
+ date: 2012-08-16 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: savon
@@ -164,16 +164,17 @@ files:
164
164
  - lib/ratis/landmark_category.rb
165
165
  - lib/ratis/location.rb
166
166
  - lib/ratis/next_bus.rb
167
+ - lib/ratis/point_2_point/group.rb
168
+ - lib/ratis/point_2_point/service.rb
169
+ - lib/ratis/point_2_point/standard_response.rb
170
+ - lib/ratis/point_2_point/stop.rb
171
+ - lib/ratis/point_2_point/trip.rb
167
172
  - lib/ratis/point_2_point.rb
168
173
  - lib/ratis/request.rb
169
174
  - lib/ratis/route.rb
175
+ - lib/ratis/route_stops/stop.rb
170
176
  - lib/ratis/route_stops.rb
171
- - lib/ratis/schedule.rb
172
- - lib/ratis/schedule_group.rb
173
177
  - lib/ratis/schedule_nearby.rb
174
- - lib/ratis/schedule_trip.rb
175
- - lib/ratis/service.rb
176
- - lib/ratis/stop.rb
177
178
  - lib/ratis/timetable.rb
178
179
  - lib/ratis/version.rb
179
180
  - lib/ratis/walk.rb
@@ -1,7 +0,0 @@
1
- module Ratis
2
-
3
- class Schedule < Struct.new(:groups)
4
-
5
- end
6
-
7
- end
@@ -1,7 +0,0 @@
1
- module Ratis
2
-
3
- class ScheduleGroup < Struct.new(:on_stop, :off_stop, :trips)
4
-
5
- end
6
-
7
- end
@@ -1,7 +0,0 @@
1
- module Ratis
2
-
3
- class ScheduleTrip < Struct.new(:on_time, :off_time, :service)
4
-
5
- end
6
-
7
- end
data/lib/ratis/service.rb DELETED
@@ -1,7 +0,0 @@
1
- module Ratis
2
-
3
- class Service < Struct.new(:route, :direction, :service_type, :signage, :route_type, :exception)
4
-
5
- end
6
-
7
- end
data/lib/ratis/stop.rb DELETED
@@ -1,12 +0,0 @@
1
- module Ratis
2
-
3
- class Stop
4
-
5
- attr_accessor :description, :atis_stop_id, :latitude, :longitude
6
- attr_accessor :walk_dist, :walk_dir, :walk_hint
7
- attr_accessor :stop_id, :side, :heading, :stop_position, :route_dir
8
- attr_accessor :area, :stop_seq
9
-
10
- end
11
-
12
- end