cta_redux 0.1.0 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 69b3ea9908066bc8bdbf52865df0885b2c7bc5a3
4
- data.tar.gz: 60ec4638cb25ad8a65e1282252bc630972c9fa8f
3
+ metadata.gz: 9e3939dcf2d580a8ef7487ea5f9ef1a3b1464737
4
+ data.tar.gz: d148cd49ce17813bec6bed9b33fd3a0f4fe9393f
5
5
  SHA512:
6
- metadata.gz: f77382a34fb99fce097142a98c22c3bed8a25992e31279ea18887c3a0398c97346717138019486d5cfdebbefe67a0f3173a517383d8021d516faa8366e8efcbd
7
- data.tar.gz: 513d7dca04757788ebc544f1437b852094f9ab1e13c1331380395cc7a369c5d82f97022879052fbfb4bcd6842433fe6c8d15f57e1a66d49597fde5cfd2085200
6
+ metadata.gz: 1633690c5355c45aa87daafaf17fa261f25d495bd6b022b09394e9e067e5071c00e4b1293405ab015c9d88488b3ff1d272821c10a337bedd6f3ac2cc06742454
7
+ data.tar.gz: 82df0c408f08a8c45def1be764730302620a9bfd70309d8ba4cd12617e72926c34b6f5b494a050639d25afa1d4aac739af078dd9c55ce3872de640df725f7437
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.5
6
+ - 2.2.0
7
+ script: bundle exec rspec spec
data/README.md CHANGED
@@ -1,16 +1,40 @@
1
1
  # cta_redux
2
2
 
3
- # Reloading CTA GTFS data
3
+ [![Build Status](https://travis-ci.org/ahayworth/cta_redux.svg?branch=master)](https://travis-ci.org/ahayworth/cta_redux)
4
4
 
5
- Note that this will take a long time - there are several million stop_time records.
5
+ The CTA (http://www.transitchicago.com) provides a wealth of information for developers, but it's hard to access, inconsistent, and there are no official clients. CTA Redux is an easy to use, comprehensive client for that data.
6
6
 
7
- 1. cd data && curl 'http://www.transitchicago.com/downloads/sch_data/<latest file>' > gtfs.zip && unzip gtfs.zip
7
+ This gem combines GTFS data with live API responses to create a consistent view of CTA vehicles and status.
8
8
 
9
- 2. cd ../script && for i in `ls ../data/*.txt`; do echo $i; ./gtfs_to_sqlite.rb $i ../data/cta-gtfs.db; done
9
+ Examples:
10
10
 
11
- 3. rm ../data/*{txt,htm,zip}
11
+ ```ruby
12
+ require 'cta_redux'
12
13
 
13
- 4. cd ../data && gzip cta-gtfs.db
14
+ CTA::TrainTracker.key = 'foo'
15
+ CTA::BusTracker.key = 'bar'
14
16
 
15
- 5. Commit / push / create release and gem
17
+ # Pick a random stop on the brown line
18
+ stop = CTA::Route[:brown].stops.all.sample
16
19
 
20
+ routes = []
21
+ stop.predictions!.predictions.sort_by(&:seconds).each do |prd|
22
+ routes << prd.route.route_id
23
+ puts "A #{prd.direction} #{prd.route.route_long_name} " +
24
+ "train will be arriving at #{stop.stop_name} in #{prd.minutes} minutes."
25
+ end
26
+
27
+ # Pick a random stop on the 8-Halsted route
28
+ stop = CTA::Route["8"].stops.all.sample
29
+ stop.predictions!.predictions.sort_by(&:seconds).each do |prd|
30
+ routes << prd.route.route_id
31
+ puts "A(n) #{prd.route.route_id}-#{prd.route.route_long_name} will be " +
32
+ "arriving at #{stop.stop_name} in #{prd.minutes} minutes."
33
+ end
34
+
35
+ CTA::CustomerAlerts.alerts!(:routes => routes.uniq).alerts.each do |alert|
36
+ puts "Alert: #{alert.short_description}"
37
+ end
38
+ ```
39
+
40
+ More information is available at (http://www.rubydoc.info/gems/cta_redux/0.1.0)
data/cta_redux.gemspec CHANGED
@@ -18,12 +18,18 @@ Gem::Specification.new do |spec|
18
18
 
19
19
  spec.files = `git ls-files -z`.split("\x0")
20
20
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
21
+ spec.extensions = ["ext/inflate_database/extconf.rb"]
21
22
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
22
23
  spec.require_paths = ["lib"]
23
24
 
25
+ # TODO - Support 1.8.7, I doubt it'll be that difficult.
26
+ spec.required_ruby_version = ">= 1.9.3"
27
+
24
28
  spec.add_development_dependency "bundler", "~> 1.7"
25
29
  spec.add_development_dependency "rake", "~> 10.0"
26
30
  spec.add_development_dependency "rspec", "~> 3.2.0"
31
+ spec.add_development_dependency "yard", ">= 0.8.7.6"
32
+
27
33
  spec.add_dependency "sequel", ">= 4.19.0"
28
34
  spec.add_dependency "sqlite3", ">= 1.3.10"
29
35
  spec.add_dependency "faraday", ">= 0.9.1"
@@ -0,0 +1,14 @@
1
+ require 'mkmf'
2
+ require 'zlib'
3
+ data_dir = File.join(File.expand_path("../../..", __FILE__), 'data')
4
+ db_filename = File.join(data_dir, 'cta-gtfs.db')
5
+ if !File.exists?(db_filename)
6
+ dbf = File.open(db_filename, 'wb')
7
+ Zlib::GzipReader.open("#{db_filename}.gz") do |gz|
8
+ dbf.puts gz.read
9
+ end
10
+ dbf.close
11
+ File.unlink("#{db_filename}.gz")
12
+ end
13
+
14
+ create_makefile "inflate_database/inflate_database"
data/lib/cta_redux.rb CHANGED
@@ -4,40 +4,60 @@ require "sqlite3"
4
4
  require "faraday"
5
5
  require "faraday_middleware"
6
6
  require "multi_xml"
7
- require "zlib"
8
7
 
9
8
  module CTA
10
9
  base_path = File.expand_path("..", __FILE__)
11
- data_dir = File.join(File.expand_path("../..", __FILE__), 'data')
12
- Dir.glob("#{base_path}/cta_redux/faraday_middleware/*") { |lib| require lib }
13
- Dir.glob("#{base_path}/cta_redux/api/*") { |lib| require lib }
10
+
11
+ require "#{base_path}/cta_redux/faraday_middleware/bus_tracker_parser.rb"
12
+ require "#{base_path}/cta_redux/faraday_middleware/train_tracker_parser.rb"
13
+ require "#{base_path}/cta_redux/faraday_middleware/customer_alerts_parser.rb"
14
+ require "#{base_path}/cta_redux/faraday_middleware/simple_cache.rb"
15
+
16
+ require "#{base_path}/cta_redux/api/api_response.rb"
17
+ require "#{base_path}/cta_redux/api/bus_tracker.rb"
18
+ require "#{base_path}/cta_redux/api/train_tracker.rb"
19
+ require "#{base_path}/cta_redux/api/customer_alerts.rb"
20
+
14
21
  require "#{base_path}/cta_redux/train_tracker.rb"
15
22
  require "#{base_path}/cta_redux/bus_tracker.rb"
16
23
  require "#{base_path}/cta_redux/customer_alerts.rb"
24
+ require "#{base_path}/cta_redux/version.rb"
25
+
17
26
 
27
+ data_dir = File.join(File.expand_path("../..", __FILE__), 'data')
18
28
  db_filename = File.join(data_dir, 'cta-gtfs.db')
19
29
 
20
- # First run
21
- if !File.exists?(db_filename)
22
- dbf = File.open(db_filename, 'wb')
23
- Zlib::GzipReader.open("#{db_filename}.gz") do |gz|
24
- dbf.puts gz.read
30
+ # travis-ci needs to manually unzip things
31
+ if ENV['TRAVIS'] == 'true'
32
+ if !File.exists?(db_filename)
33
+ dbf = File.open(db_filename, 'wb')
34
+ Zlib::GzipReader.open("#{db_filename}.gz") do |gz|
35
+ dbf.puts gz.read
36
+ end
37
+ dbf.close
38
+ File.unlink("#{db_filename}.gz")
25
39
  end
26
- dbf.close
27
40
  end
28
-
29
41
  DB = Sequel.sqlite(:database => db_filename, :readonly => true)
30
42
 
31
- Dir.glob("#{base_path}/cta_redux/models/*") do |lib|
32
- next if lib =~ /train/ || lib =~ /bus/
33
- require lib
34
- end
43
+ require "#{base_path}/cta_redux/models/agency.rb"
44
+ require "#{base_path}/cta_redux/models/calendar.rb"
45
+ require "#{base_path}/cta_redux/models/route.rb"
46
+ require "#{base_path}/cta_redux/models/shape.rb"
47
+ require "#{base_path}/cta_redux/models/stop.rb"
48
+ require "#{base_path}/cta_redux/models/stop_time.rb"
49
+ require "#{base_path}/cta_redux/models/transfer.rb"
50
+ require "#{base_path}/cta_redux/models/trip.rb"
35
51
 
36
52
  require "#{base_path}/cta_redux/models/train.rb"
37
53
  require "#{base_path}/cta_redux/models/bus.rb"
54
+
38
55
  end
39
56
 
40
57
  class Array
58
+ # Encloses the object with an array, if it is not already
59
+ # @param object [Object] the object to enclose
60
+ # @return [Array<Object>] the object, enclosed in an array
41
61
  def self.wrap(object)
42
62
  if object.nil?
43
63
  []
@@ -1,5 +1,6 @@
1
1
  module CTA
2
2
  class BusTracker
3
+ # Returns the connection object we use to talk to the BusTracker API
3
4
  def self.connection
4
5
  raise "You need to set a developer key first. Try CTA::BusTracker.key = 'foo'." unless @key
5
6
 
@@ -13,10 +14,22 @@ module CTA
13
14
  end
14
15
  end
15
16
 
17
+ # Returns the current time according to the BusTime servers that power the BusTracker API.
18
+ # @return [CTA::BusTracker::TimeResponse]
16
19
  def self.time!
17
20
  connection.get('gettime')
18
21
  end
19
22
 
23
+ # Returns status of vehicles out on the road.
24
+ # @param [Hash] options
25
+ # @option options [Array<String>, Array<Integer>, String, Integer] :vehicles A list or single vehicle IDs to query.
26
+ # Not available with :routes.
27
+ # @option options [Array<String>, Array<Integer>, String, Integer] :routes A list or single route IDs to query.
28
+ # Not available with :vehicles.
29
+ # @return [CTA::BusTracker::VehiclesResponse]
30
+ # @example
31
+ # CTA::BusTracker.vehicles!(:routes => [22,36])
32
+ # CTA::BusTracker.vehicles!(:vehicles => 4240)
20
33
  def self.vehicles!(options={})
21
34
  allowed_keys = [:vehicles, :routes]
22
35
  if options.keys.any? { |k| !allowed_keys.include?(k) }
@@ -36,10 +49,18 @@ module CTA
36
49
  connection.get('getvehicles', { :rt => routes, :vid => vehicles })
37
50
  end
38
51
 
52
+ # Returns a list of all routes the BusTracker API knows about - whether or not they are active.
53
+ # @return [CTA::BusTracker::RoutesResponse]
39
54
  def self.routes!
40
55
  connection.get('getroutes')
41
56
  end
42
57
 
58
+ # Returns the directions in which a route operates (eg Eastbound, Westbound)
59
+ # @param [Hash] options
60
+ # @option options [String, Integer] :route The route to query for available directions
61
+ # @return [CTA::BusTracker::DirectionsResponse]
62
+ # @example
63
+ # CTA::BusTracker.directions!(:route => 37)
43
64
  def self.directions!(options={})
44
65
  allowed_keys = [:route]
45
66
  if options.keys.any? { |k| !allowed_keys.include?(k) }
@@ -58,6 +79,13 @@ module CTA
58
79
  connection.get('getdirections', { :rt => routes.first })
59
80
  end
60
81
 
82
+ # Returns the stops along a route and direction
83
+ # @params [Hash] options
84
+ # @option options [String, Integer] :route The route to query for stops
85
+ # @option options [String, Integer] :direction The direction to query for stops
86
+ # @return [CTA::BusTracker::StopsResponse]
87
+ # @example
88
+ # CTA::BusTracker.stops!(:route => 22, :direction => :northbound)
61
89
  def self.stops!(options={})
62
90
  allowed_keys = [:route, :direction]
63
91
  if options.keys.any? { |k| !allowed_keys.include?(k) }
@@ -84,6 +112,14 @@ module CTA
84
112
  connection.get('getstops', { :rt => routes.first, :dir => directions.first.to_s.capitalize })
85
113
  end
86
114
 
115
+ # Returns available patterns for a route
116
+ # @params [Hash] options
117
+ # @option options [String, Integer] :route The route to query for patterns. Not available with :patterns
118
+ # @option options [Array<String>, Array<Integer>, String, Integer] :patterns Patterns to return. Not available with :route
119
+ # @return [CTA::BusTracker::PatternsResponse]
120
+ # @example
121
+ # CTA::BusTracker.patterns!(:route => 22)
122
+ # CTA::BusTracker.patterns!(:patterns => [3936, 3932])
87
123
  def self.patterns!(options={})
88
124
  allowed_keys = [:route, :patterns]
89
125
  if options.keys.any? { |k| !allowed_keys.include?(k) }
@@ -106,6 +142,16 @@ module CTA
106
142
  connection.get('getpatterns', { :pid => patterns, :rt => routes.first })
107
143
  end
108
144
 
145
+ # Returns a set of arrival/departure predictions.
146
+ # @params [Hash] options
147
+ # @option options [Array<String>, Array<Integer>, String, Integer] :vehicles Vehicles to predict. Not available with :routes
148
+ # @option options [Array<String>, Array<Integer>, String, Integer] :routes Routes to predict. Not available with :vehicles
149
+ # @option options [Array<String>, Array<Integer>, String, Integer] :stops Stops along a route to predict. Required with :routes
150
+ # @option options [String, Integer] :limit Maximum number of predictions to return.
151
+ # @return [CTA::BusTracker::PredictionsResponse]
152
+ # @example
153
+ # CTA::BusTracker.predictions!(:routes => 22, :stops => 15895)
154
+ # CTA::BusTracker.predictions!(:vehicles => [2172, 1860], :limit => 1)
109
155
  def self.predictions!(options={})
110
156
  allowed_keys = [:vehicles, :stops, :routes, :limit]
111
157
  if options.keys.any? { |k| !allowed_keys.include?(k) }
@@ -127,6 +173,16 @@ module CTA
127
173
  connection.get('getpredictions', { :rt => routes, :vid => vehicles, :stpid => stops, :top => limit })
128
174
  end
129
175
 
176
+ # Returns active bulletins.
177
+ # @note Consider using {CTA::CustomerAlerts.alerts!} or {CTA::CustomerAlerts.status!}, as those are not rate-limited.
178
+ # @params [Hash] options
179
+ # @option options [Array<String>, Array<Integer>, String, Integer] :routes Routes for which to retrieve bulletins.
180
+ # When combined with :direction or :stops, may only specify one :route.
181
+ # @option options [String, Integer] :direction Direction of a route for which to retrieve bulletins.
182
+ # @option options [String, Integer] :stop Stop along a route for which to retrieve bulletins.
183
+ # @return [CTA::BusTracker::ServiceBulletinsResponse]
184
+ # @example
185
+ # CTA::BusTracker.bulletins!(:routes => [8, 22])
130
186
  def self.bulletins!(options={})
131
187
  allowed_keys = [:routes, :directions, :stop]
132
188
  if options.keys.any? { |k| !allowed_keys.include?(k) }
@@ -162,19 +218,29 @@ module CTA
162
218
  connection.get('getservicebulletins', { :rt => routes, :stpid => stops, :dir => directions.first })
163
219
  end
164
220
 
221
+ # Returns the current API key used to talk to BusTracker
222
+ # @return [String] the api key
165
223
  def self.key
166
224
  @key
167
225
  end
168
226
 
227
+ # Sets the API key used to talk to BusTracker
228
+ # @note If using SimpleCache as a caching strategy, this resets the cache.
229
+ # @param key [String] The key to use
169
230
  def self.key=(key)
170
231
  @key = key
171
232
  @connection = nil
172
233
  end
173
234
 
235
+ # Returns the debug status of the API. When in debug mode, all API responses will additionally return
236
+ # the parsed XML tree, and the original XML for inspection
174
237
  def self.debug
175
238
  !!@debug
176
239
  end
177
240
 
241
+ # Sets the debug status of the API. When in debug mode, all API responses will additionally return
242
+ # the parsed XML tree, and the original XML for inspection
243
+ # @param debug [true, false]
178
244
  def self.debug=(debug)
179
245
  @debug = debug
180
246
  @connection = nil
@@ -1,6 +1,7 @@
1
1
  module CTA
2
2
  class CustomerAlerts
3
3
 
4
+ # Returns the connection object we use to talk to the CustomerAlerts API
4
5
  def self.connection
5
6
  @connection ||= Faraday.new do |faraday|
6
7
  faraday.url_prefix = 'http://www.transitchicago.com/api/1.0/'
@@ -10,14 +11,21 @@ module CTA
10
11
  end
11
12
  end
12
13
 
14
+ # Returns an overview of system status.
15
+ # @param [Hash] options
16
+ # @option options [Array<Integer> Array<String>, Integer, String] :routes Routes to query for status
17
+ # @option options [String, Integer] :stations Station to query for status
18
+ # @return [CTA::CustomerAlerts::RouteStatusResponse]
19
+ # @example
20
+ # CTA::CustomerAlerts.status!(:routes => [8,22])
13
21
  def self.status!(options = {})
14
- allowed_keys = [:routes, :stations]
22
+ allowed_keys = [:routes, :station]
15
23
  if options.keys.any? { |k| !allowed_keys.include?(k) }
16
24
  raise "Illegal argument!"
17
25
  end
18
26
 
19
27
  routes = Array.wrap(options[:routes]).flatten.compact.uniq.join(',')
20
- stations = Array.wrap(options[:stations]).flatten.compact.uniq
28
+ stations = Array.wrap(options[:station]).flatten.compact.uniq
21
29
 
22
30
  if stations.size > 1
23
31
  raise "Can only specify one station!"
@@ -26,6 +34,18 @@ module CTA
26
34
  connection.get('routes.aspx', { :type => options[:type], :routeid => routes, :stationid => stations.first })
27
35
  end
28
36
 
37
+ # Returns alerts for given routes or stations
38
+ # @param [Hash] options
39
+ # @option options [Array<Integer> Array<String>, Integer, String] :routes Routes to query for alerts. Not available with :station
40
+ # @option options [Integer, String] :station Station to query for alerts. Not available with :route
41
+ # @option options [true, false] :active Only return active alerts
42
+ # @option options [true, false] :accessibility Include alerts related to accessibility (elevators, etc)
43
+ # @option options [true, false] :planned Only return planned alerts
44
+ # @option options [Integer] :recent_days Only return alerts within the specified number of days
45
+ # @option options [Integer] :before Only return alerts starting prior to the specified number of days
46
+ # @return [CTA::CustomerAlerts::AlertsResponse]
47
+ # @example
48
+ # CTA::CustomerAlerts.alerts!(:route => 8)
29
49
  def self.alerts!(options = {})
30
50
  allowed_keys = [:active, :accessibility, :planned, :routes, :station, :recent_days, :before]
31
51
  if options.keys.any? { |k| !allowed_keys.include?(k) }
@@ -60,10 +80,15 @@ module CTA
60
80
  connection.get('alerts.aspx', params)
61
81
  end
62
82
 
83
+ # Returns the debug status of the API. When in debug mode, all API responses will additionally return
84
+ # the parsed XML tree, and the original XML for inspection
63
85
  def self.debug
64
86
  !!@debug
65
87
  end
66
88
 
89
+ # Sets the debug status of the API. When in debug mode, all API responses will additionally return
90
+ # the parsed XML tree, and the original XML for inspection
91
+ # @param debug [true, false]
67
92
  def self.debug=(debug)
68
93
  @debug = debug
69
94
  @connection = nil
@@ -1,5 +1,6 @@
1
1
  module CTA
2
2
  class TrainTracker
3
+ # Returns the connection object we use to talk to the TrainTracker API
3
4
  def self.connection
4
5
  raise "You need to set a developer key first. Try CTA::TrainTracker.key = 'foo'." unless @key
5
6
 
@@ -13,6 +14,15 @@ module CTA
13
14
  end
14
15
  end
15
16
 
17
+ # Returns the arrivals for a route, or station
18
+ # @param [Hash] options
19
+ # @option options [String, Integer] :route The route to query
20
+ # @option options [String, Integer] :station The station to query for arrivals
21
+ # @option options [String, Integer] :parent_station The parent station to query for arrivals.
22
+ # @option options [String, Integer] :limit Maximum number of results to return
23
+ # @return [CTA::TrainTracker::ArrivalsResponse]
24
+ # @example
25
+ # CTA::TrainTracker.arrivals!(:route => :red)
16
26
  def self.arrivals!(options={})
17
27
  allowed_keys = [:route, :parent_station, :station, :limit]
18
28
  if options.keys.any? { |k| !allowed_keys.include?(k) }
@@ -48,10 +58,25 @@ module CTA
48
58
  connection.get('ttarrivals.aspx', params)
49
59
  end
50
60
 
61
+ # Returns the arrivals for a route, or station
62
+ # @param [Hash] options
63
+ # @option options [String, Integer] :route The route to query
64
+ # @option options [String, Integer] :station The station to query for arrivals
65
+ # @option options [String, Integer] :parent_station The parent station to query for arrivals.
66
+ # @option options [String, Integer] :limit Maximum number of results to return
67
+ # @return [CTA::TrainTracker::ArrivalsResponse]
68
+ # @example
69
+ # CTA::TrainTracker.predicitons!(:route => :red)
51
70
  def self.predictions!(options={})
52
71
  self.arrivals!(options)
53
72
  end
54
73
 
74
+ # Returns a set of upcoming positions for a train/run
75
+ # @param [Hash] options
76
+ # @option options [String, Integer] :run The run number of the train to follow
77
+ # @return [CTA::TrainTracker::FollowResponse]
78
+ # @example
79
+ # CTA::TrainTracker.follow!(:run => 914)
55
80
  def self.follow!(options={})
56
81
  raise "Must specify a run! Try follow(:run => 914)..." unless options.has_key?(:run)
57
82
 
@@ -64,6 +89,12 @@ module CTA
64
89
  connection.get('ttfollow.aspx', { :runnumber => runs.first })
65
90
  end
66
91
 
92
+ # Returns the position and next station of all trains in service.
93
+ # @param [Hash] options
94
+ # @option options [Array<String>, Array<Integer>, String, Integer] :routes Routes for which to return positions
95
+ # @return [CTA::TrainTracker::LocationsResponse]
96
+ # @example
97
+ # CTA::TrainTracker.locations!(:route => [:red, :blue])
67
98
  def self.locations!(options={})
68
99
  unless options.has_key?(:routes)
69
100
  raise "Must specify at least one route! (Try locations(:routes => [:red, :blue]) )"
@@ -78,23 +109,39 @@ module CTA
78
109
  connection.get('ttpositions.aspx', { :rt => rt.join(',') })
79
110
  end
80
111
 
112
+ # Returns the position and next station of all trains in service.
113
+ # @param [Hash] options
114
+ # @option options [Array<String>, Array<Integer>, String, Integer] :routes Routes for which to return positions
115
+ # @return [CTA::TrainTracker::LocationsResponse]
116
+ # @example
117
+ # CTA::TrainTracker.positions!(:route => [:red, :blue])
81
118
  def self.positions!(options={})
82
119
  self.locations!(options)
83
120
  end
84
121
 
122
+ # Returns the current API key used to talk to TrainTracker
123
+ # @return [String] the api key
85
124
  def self.key
86
125
  @key
87
126
  end
88
127
 
128
+ # Sets the API key used to talk to TrainTracker
129
+ # @note If using SimpleCache as a caching strategy, this resets the cache.
130
+ # @param key [String] The key to use
89
131
  def self.key=(key)
90
132
  @key = key
91
133
  @connection = nil
92
134
  end
93
135
 
136
+ # Returns the debug status of the API. When in debug mode, all API responses will additionally return
137
+ # the parsed XML tree, and the original XML for inspection
94
138
  def self.debug
95
139
  !!@debug
96
140
  end
97
141
 
142
+ # Sets the debug status of the API. When in debug mode, all API responses will additionally return
143
+ # the parsed XML tree, and the original XML for inspection
144
+ # @param debug [true, false]
98
145
  def self.debug=(debug)
99
146
  @debug = debug
100
147
  @connection = nil
@@ -1,3 +1,3 @@
1
1
  module CTA
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cta_redux
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Hayworth
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-14 00:00:00.000000000 Z
11
+ date: 2015-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 3.2.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: yard
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 0.8.7.6
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 0.8.7.6
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: sequel
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -130,11 +144,13 @@ description: |-
130
144
  email:
131
145
  - ahayworth@gmail.com
132
146
  executables: []
133
- extensions: []
147
+ extensions:
148
+ - ext/inflate_database/extconf.rb
134
149
  extra_rdoc_files: []
135
150
  files:
136
151
  - ".gitignore"
137
152
  - ".rspec"
153
+ - ".travis.yml"
138
154
  - Gemfile
139
155
  - LICENSE
140
156
  - README.md
@@ -142,6 +158,7 @@ files:
142
158
  - cta_redux.gemspec
143
159
  - data/.gitkeep
144
160
  - data/cta-gtfs.db.gz
161
+ - ext/inflate_database/extconf.rb
145
162
  - lib/cta_redux.rb
146
163
  - lib/cta_redux/api/api_response.rb
147
164
  - lib/cta_redux/api/bus_tracker.rb
@@ -198,7 +215,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
198
215
  requirements:
199
216
  - - ">="
200
217
  - !ruby/object:Gem::Version
201
- version: '0'
218
+ version: 1.9.3
202
219
  required_rubygems_version: !ruby/object:Gem::Requirement
203
220
  requirements:
204
221
  - - ">="
@@ -232,3 +249,4 @@ test_files:
232
249
  - spec/stubs/ttfollow_run217_response.xml
233
250
  - spec/stubs/ttpositions_response.xml
234
251
  - spec/train_tracker_spec.rb
252
+ has_rdoc: