ratis 2.5.2.4 → 2.5.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -92,7 +92,7 @@ Development
92
92
  ssh -i ~/.ssh/authoritylabs.pem -L 8080:localhost:3128 ubuntu@codingsanctum.com
93
93
 
94
94
  1. Run the test suite with `rake`
95
- 1. Test it out with `irb -r config/valley_metro.rb -I lib/ -r rubygems -r ratis`
95
+ 1. Test it out with `irb -I lib/ -r rubygems -r ratis`
96
96
 
97
97
  ### Extending
98
98
 
data/lib/ratis.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  require 'savon'
2
2
 
3
+ require 'ratis/closest_stop'
3
4
  require 'ratis/config'
4
5
  require 'ratis/core_ext'
5
- require 'ratis/closest_stop'
6
6
  require 'ratis/errors'
7
7
  require 'ratis/itinerary'
8
8
  require 'ratis/landmark'
@@ -11,6 +11,7 @@ require 'ratis/location'
11
11
  require 'ratis/next_bus'
12
12
  require 'ratis/point_2_point'
13
13
  require 'ratis/point_2_point/group'
14
+ require 'ratis/point_2_point/routes_only_response'
14
15
  require 'ratis/point_2_point/service'
15
16
  require 'ratis/point_2_point/standard_response'
16
17
  require 'ratis/point_2_point/stop'
data/lib/ratis/config.rb CHANGED
@@ -2,7 +2,7 @@ module Ratis
2
2
 
3
3
  class Config
4
4
 
5
- attr_accessor :endpoint, :namespace, :proxy, :timeout
5
+ attr_accessor :endpoint, :namespace, :proxy, :timeout, :log, :log_level
6
6
 
7
7
  def valid?
8
8
  return false if endpoint.nil? or namespace.nil?
@@ -44,13 +44,13 @@ 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 = Point2Point::RoutesOnlyResponse.new
48
- atis_service.route = service[:route]
49
- atis_service.direction = service[:direction]
50
- atis_service.service_type = service[:servicetype]
51
- atis_service.signage = service[:signage]
52
- atis_service.route_type = service[:routetype]
53
- atis_service
47
+ Point2Point::RoutesOnlyResponse.new({
48
+ :route => service[:route],
49
+ :direction => service[:direction],
50
+ :service_type => service[:servicetype],
51
+ :signage => service[:signage],
52
+ :route_type => service[:routetype]
53
+ })
54
54
  end
55
55
  end
56
56
 
@@ -0,0 +1,16 @@
1
+ module Ratis
2
+
3
+ class Point2Point::RoutesOnlyResponse
4
+
5
+ VALID_ATTRS = [:route, :direction, :service_type, :signage, :route_type]
6
+ VALID_ATTRS.each { |attr| attr_accessor attr }
7
+
8
+ def initialize(attrs = {})
9
+ VALID_ATTRS.each do |attr|
10
+ instance_variable_set "@#{attr.to_s}", attrs[attr] || attrs[attr.to_s]
11
+ end
12
+ end
13
+
14
+ end
15
+
16
+ end
@@ -4,4 +4,4 @@ module Ratis
4
4
 
5
5
  end
6
6
 
7
- end
7
+ end
@@ -1,7 +1,6 @@
1
1
  module Ratis
2
2
 
3
- class Point2Point::Stop < Struct.new(:description, :atis_stop_id, :latitude, :longitude,
4
- :walk_dist, :walk_dir, :walk_hint)
3
+ class Point2Point::Stop < Struct.new(:description, :atis_stop_id, :latitude, :longitude, :walk_dist, :walk_dir, :walk_hint)
5
4
 
6
5
  end
7
6
 
@@ -1,4 +1,6 @@
1
1
  module Ratis
2
- class RouteStops::Stop < Struct.new(:description, :area, :stop_id, :atis_stop_id, :point, :alpha_seq, :stop_seq, :latitude, :longitude)
2
+
3
+ class RouteStops::Stop < Struct.new(:description, :area, :stop_id, :atis_stop_id, :point, :alpha_seq, :stop_seq, :latitude, :longitude)
3
4
  end
4
- end
5
+
6
+ end
@@ -55,6 +55,7 @@ module Ratis
55
55
  :walkdist => atstop[:walkdist],
56
56
  :walkdir => atstop[:walkdir],
57
57
  :stopid => atstop[:stopid],
58
+ :heading => atstop[:heading],
58
59
  :lat => atstop[:lat],
59
60
  :long => atstop[:long],
60
61
  :services => atstop[:services].map do |service|
@@ -28,8 +28,13 @@ module Ratis
28
28
  timetable.service_type = headway[:servicetype]
29
29
  timetable.operator = headway[:operator]
30
30
  timetable.effective = headway[:effective]
31
- timetable.timepoints = headway[:timepoints][:stop].collect{|tp| Timetable::Stop.new(tp[:atisstopid], tp[:stopid], tp[:description], tp[:area])}
32
- timetable.trips = headway[:times][:trip].collect{|t| Timetable::Trip.new(t[:time], t[:comment])}
31
+
32
+ stop = headway[:timepoints][:stop]
33
+ timetable.timepoints = [ Timetable::Stop.new(stop[:atisstopid], stop[:stopid], stop[:description], stop[:area]) ]
34
+
35
+ trip = headway[:times][:trip]
36
+ timetable.trips = [ Timetable::Trip.new(trip[:time], trip[:comment]) ]
37
+
33
38
  timetable
34
39
  end
35
40
 
@@ -1,4 +1,6 @@
1
1
  module Ratis
2
+
2
3
  class Timetable::Stop < Struct.new(:atis_stop_id, :stop_id, :description, :area)
3
4
  end
4
- end
5
+
6
+ end
@@ -1,4 +1,6 @@
1
1
  module Ratis
2
+
2
3
  class Timetable::Trip < Struct.new(:times, :comment)
3
4
  end
4
- end
5
+
6
+ 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.4'
7
+ string = '2.5.2.5'
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: 71
4
+ hash: 69
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 5
9
9
  - 2
10
- - 4
11
- version: 2.5.2.4
10
+ - 5
11
+ version: 2.5.2.5
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-10-26 00:00:00 Z
19
+ date: 2013-01-16 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: savon
@@ -24,12 +24,13 @@ dependencies:
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ">="
27
+ - - <
28
28
  - !ruby/object:Gem::Version
29
29
  hash: 3
30
30
  segments:
31
+ - 2
31
32
  - 0
32
- version: "0"
33
+ version: "2.0"
33
34
  type: :runtime
34
35
  version_requirements: *id001
35
36
  - !ruby/object:Gem::Dependency
@@ -165,6 +166,7 @@ files:
165
166
  - lib/ratis/location.rb
166
167
  - lib/ratis/next_bus.rb
167
168
  - lib/ratis/point_2_point/group.rb
169
+ - lib/ratis/point_2_point/routes_only_response.rb
168
170
  - lib/ratis/point_2_point/service.rb
169
171
  - lib/ratis/point_2_point/standard_response.rb
170
172
  - lib/ratis/point_2_point/stop.rb