ratis 2.5.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ module Ratis
2
+
3
+ class ScheduleTrip < Struct.new(:on_time, :off_time, :service)
4
+
5
+ end
6
+
7
+ end
@@ -0,0 +1,7 @@
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 ADDED
@@ -0,0 +1,12 @@
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
@@ -0,0 +1,36 @@
1
+ module Ratis
2
+
3
+ class Timetable
4
+
5
+ attr_accessor :route_short_name, :direction, :service_type, :operator, :effective
6
+
7
+ def self.where(conditions)
8
+ short_name = conditions.delete :route_short_name
9
+ direction = conditions.delete :direction
10
+ date = conditions.delete :date
11
+ service_type = conditions.delete :service_type
12
+
13
+ raise ArgumentError.new('You must provide a route_short_name') unless short_name
14
+ raise ArgumentError.new('You must provide a direction') unless direction
15
+ raise ArgumentError.new('You must provide either date or service_type') unless date ^ service_type
16
+ Ratis.all_conditions_used? conditions
17
+
18
+ request_params = { 'Route' => short_name, 'Direction' => direction }
19
+ request_params.merge! date ? { 'Date' => date } : { 'Servicetype' => service_type }
20
+
21
+ response = Request.get 'Timetable', request_params
22
+ return nil unless response.success?
23
+
24
+ headway = response.to_hash[:timetable_response][:headway]
25
+ timetable = Timetable.new
26
+ timetable.route_short_name = headway[:route]
27
+ timetable.direction = headway[:direction]
28
+ timetable.service_type = headway[:servicetype]
29
+ timetable.operator = headway[:operator]
30
+ timetable.effective = headway[:effective]
31
+ timetable
32
+ end
33
+
34
+ end
35
+
36
+ end
@@ -0,0 +1,33 @@
1
+ module Ratis
2
+
3
+ extend self
4
+
5
+ def version
6
+ @version ||= begin
7
+ string = '2.5.2.1'
8
+
9
+ def string.parts
10
+ split('.').map { |p| p.to_i }
11
+ end
12
+
13
+ def string.major
14
+ parts[0]
15
+ end
16
+
17
+ def string.minor
18
+ parts[1]
19
+ end
20
+
21
+ def string.build
22
+ parts[2]
23
+ end
24
+
25
+ def string.patch
26
+ parts[3]
27
+ end
28
+
29
+ string
30
+ end
31
+ end
32
+
33
+ end
data/lib/ratis/walk.rb ADDED
@@ -0,0 +1,37 @@
1
+ module Ratis
2
+
3
+ class Walk
4
+
5
+ attr_accessor :legs, :walk_distance, :walk_units, :walk_time
6
+
7
+ def self.walk_stop(conditions)
8
+ start_latitude = conditions.delete :start_latitude
9
+ start_longitude = conditions.delete :start_longitude
10
+ end_latitude = conditions.delete :end_latitude
11
+ end_longitude = conditions.delete :end_longitude
12
+
13
+ raise ArgumentError.new('You must provide a start_latitude') unless start_latitude
14
+ raise ArgumentError.new('You must provide a start_longitude') unless start_longitude
15
+ raise ArgumentError.new('You must provide an end_latitude') unless end_latitude
16
+ raise ArgumentError.new('You must provide an end_longitude') unless end_longitude
17
+
18
+ response = Request.get 'Walkstop', 'Startlat' => start_latitude, 'Startlong' => start_longitude, 'Endlat' => end_latitude, 'Endlong' => end_longitude
19
+ return nil unless response.success?
20
+
21
+ response_walk = response[:walkstop_response]
22
+
23
+ walk = Walk.new
24
+ walk.legs = response_walk[:walk][:leg].map {|l| { :description => l } }
25
+ walk.walk_distance = response_walk[:walkinfo][:walkdistance]
26
+ walk.walk_units = response_walk[:walkinfo][:walkunits]
27
+ walk.walk_time = response_walk[:walkinfo][:walktime]
28
+ walk
29
+ end
30
+
31
+ def to_hash
32
+ keys = [:legs, :walk_distance, :walk_units, :walk_time]
33
+ Hash[keys.map { |k| [k, send(k)] }]
34
+ end
35
+ end
36
+
37
+ end
metadata ADDED
@@ -0,0 +1,217 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ratis
3
+ version: !ruby/object:Gem::Version
4
+ hash: 77
5
+ prerelease:
6
+ segments:
7
+ - 2
8
+ - 5
9
+ - 2
10
+ - 1
11
+ version: 2.5.2.1
12
+ platform: ruby
13
+ authors:
14
+ - AuthorityLabs
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2012-08-15 00:00:00 Z
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: savon
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: activesupport
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :development
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: rspec
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
60
+ version: "0"
61
+ type: :development
62
+ version_requirements: *id003
63
+ - !ruby/object:Gem::Dependency
64
+ name: simplecov
65
+ prerelease: false
66
+ requirement: &id004 !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ hash: 3
72
+ segments:
73
+ - 0
74
+ version: "0"
75
+ type: :development
76
+ version_requirements: *id004
77
+ - !ruby/object:Gem::Dependency
78
+ name: webmock
79
+ prerelease: false
80
+ requirement: &id005 !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ hash: 3
86
+ segments:
87
+ - 0
88
+ version: "0"
89
+ type: :development
90
+ version_requirements: *id005
91
+ - !ruby/object:Gem::Dependency
92
+ name: hashdiff
93
+ prerelease: false
94
+ requirement: &id006 !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ hash: 3
100
+ segments:
101
+ - 0
102
+ version: "0"
103
+ type: :development
104
+ version_requirements: *id006
105
+ - !ruby/object:Gem::Dependency
106
+ name: bundler
107
+ prerelease: false
108
+ requirement: &id007 !ruby/object:Gem::Requirement
109
+ none: false
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ hash: 23
114
+ segments:
115
+ - 1
116
+ - 0
117
+ - 0
118
+ version: 1.0.0
119
+ type: :development
120
+ version_requirements: *id007
121
+ - !ruby/object:Gem::Dependency
122
+ name: yard
123
+ prerelease: false
124
+ requirement: &id008 !ruby/object:Gem::Requirement
125
+ none: false
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ hash: 3
130
+ segments:
131
+ - 0
132
+ version: "0"
133
+ type: :development
134
+ version_requirements: *id008
135
+ - !ruby/object:Gem::Dependency
136
+ name: redcarpet
137
+ prerelease: false
138
+ requirement: &id009 !ruby/object:Gem::Requirement
139
+ none: false
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ hash: 3
144
+ segments:
145
+ - 0
146
+ version: "0"
147
+ type: :development
148
+ version_requirements: *id009
149
+ description:
150
+ email: support@authoritylabs.com
151
+ executables: []
152
+
153
+ extensions: []
154
+
155
+ extra_rdoc_files:
156
+ - README.md
157
+ files:
158
+ - lib/ratis/closest_stop.rb
159
+ - lib/ratis/config.rb
160
+ - lib/ratis/core_ext.rb
161
+ - lib/ratis/errors.rb
162
+ - lib/ratis/itinerary.rb
163
+ - lib/ratis/landmark.rb
164
+ - lib/ratis/landmark_category.rb
165
+ - lib/ratis/location.rb
166
+ - lib/ratis/next_bus.rb
167
+ - lib/ratis/point_2_point.rb
168
+ - lib/ratis/request.rb
169
+ - lib/ratis/route.rb
170
+ - lib/ratis/route_stops.rb
171
+ - lib/ratis/schedule.rb
172
+ - lib/ratis/schedule_group.rb
173
+ - lib/ratis/schedule_nearby.rb
174
+ - lib/ratis/schedule_trip.rb
175
+ - lib/ratis/service.rb
176
+ - lib/ratis/stop.rb
177
+ - lib/ratis/timetable.rb
178
+ - lib/ratis/version.rb
179
+ - lib/ratis/walk.rb
180
+ - lib/ratis.rb
181
+ - README.md
182
+ homepage:
183
+ licenses: []
184
+
185
+ post_install_message:
186
+ rdoc_options:
187
+ - --charset=UTF-8 --main=README.md
188
+ require_paths:
189
+ - lib
190
+ required_ruby_version: !ruby/object:Gem::Requirement
191
+ none: false
192
+ requirements:
193
+ - - ">="
194
+ - !ruby/object:Gem::Version
195
+ hash: 3
196
+ segments:
197
+ - 0
198
+ version: "0"
199
+ required_rubygems_version: !ruby/object:Gem::Requirement
200
+ none: false
201
+ requirements:
202
+ - - ">="
203
+ - !ruby/object:Gem::Version
204
+ hash: 3
205
+ segments:
206
+ - 0
207
+ version: "0"
208
+ requirements: []
209
+
210
+ rubyforge_project:
211
+ rubygems_version: 1.8.24
212
+ signing_key:
213
+ specification_version: 3
214
+ summary: A Ruby wrapper around the ATIS SOAP Interface
215
+ test_files: []
216
+
217
+ has_rdoc: