doublemap_api 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cb99a5dd13b41e24c011472f4eecf8debdc3840
|
4
|
+
data.tar.gz: bf6ad05c4cb57a3b9d1a472ef05149552895f612
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfb7c0977dfe2ecd343d301dc9fd83bc3e647cef9843a3d979fa1c987a29cceb6d75ff9359d810d44bc8c9712cc17e1a149066396503218c39af2ba6694b9c7e
|
7
|
+
data.tar.gz: 0a9484d89d3d2a892769339ef3c29d9720e3ae7fae28c4a9dd212cc11da8d8991d04c3c9c7b4f5ab86bbc16b9228767d90196eddbfda628216aba70fb9f96f5f
|
@@ -4,7 +4,7 @@ module DoubleMap
|
|
4
4
|
|
5
5
|
# Return a list of all routes on the system.
|
6
6
|
def list
|
7
|
-
get_request('/map/v2/routes').map{ |route| Route.new(route) }
|
7
|
+
get_request('/map/v2/routes').map{ |route| Route.new(route) }.each(&on_route)
|
8
8
|
end
|
9
9
|
memoize :list
|
10
10
|
alias_method :all, :list
|
@@ -15,5 +15,11 @@ module DoubleMap
|
|
15
15
|
end
|
16
16
|
memoize :get
|
17
17
|
alias_method :find, :get
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def on_route
|
22
|
+
DoubleMap.configuration.on_route
|
23
|
+
end
|
18
24
|
end
|
19
25
|
end
|
@@ -4,7 +4,7 @@ module DoubleMap
|
|
4
4
|
|
5
5
|
# Return a list of all stops on the system.
|
6
6
|
def list
|
7
|
-
get_request('/map/v2/stops').map{ |stop| Stop.new(stop) }
|
7
|
+
get_request('/map/v2/stops').map{ |stop| Stop.new(stop) }.each(&on_stop)
|
8
8
|
end
|
9
9
|
memoize :list
|
10
10
|
alias_method :all, :list
|
@@ -15,5 +15,11 @@ module DoubleMap
|
|
15
15
|
end
|
16
16
|
memoize :get
|
17
17
|
alias_method :find, :get
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def on_stop
|
22
|
+
DoubleMap.configuration.on_stop
|
23
|
+
end
|
18
24
|
end
|
19
25
|
end
|
@@ -4,7 +4,7 @@ module DoubleMap
|
|
4
4
|
|
5
5
|
# Return a list of all vehicles currently traveling on routes.
|
6
6
|
def list
|
7
|
-
get_request('/map/v2/buses').map{ |vehicle| Vehicle.new(vehicle) }
|
7
|
+
get_request('/map/v2/buses').map{ |vehicle| Vehicle.new(vehicle) }.each(&on_vehicle)
|
8
8
|
end
|
9
9
|
memoize :list
|
10
10
|
alias_method :all, :list
|
@@ -15,5 +15,11 @@ module DoubleMap
|
|
15
15
|
end
|
16
16
|
memoize :get
|
17
17
|
alias_method :find, :get
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def on_vehicle
|
22
|
+
DoubleMap.configuration.on_vehicle
|
23
|
+
end
|
18
24
|
end
|
19
25
|
end
|
@@ -8,12 +8,18 @@ module DoubleMap
|
|
8
8
|
attr_accessor :adapter
|
9
9
|
# The output stream to which debug information should be written
|
10
10
|
attr_accessor :debug_output
|
11
|
+
# Optional procs called when a corresponding model object is created,
|
12
|
+
# before it is returned to a caller.
|
13
|
+
attr_accessor :on_route, :on_stop, :on_vehicle
|
11
14
|
|
12
15
|
# The defaults to use for any configuration options that are not provided
|
13
16
|
DEFAULT_CONFIGURATION = {
|
14
17
|
version: '3.2', # Taken from a comment on "http://bus.gocitybus.com/RouteMap/Index"
|
15
18
|
adapter: :httparty,
|
16
|
-
debug_output: false
|
19
|
+
debug_output: false,
|
20
|
+
on_route: ->(route){},
|
21
|
+
on_stop: ->(stop){},
|
22
|
+
on_vehicle: ->(vehicle){},
|
17
23
|
}
|
18
24
|
|
19
25
|
# The options required when configuring a DoubleMap instance
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doublemap_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Egeland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
83
|
version: '0'
|
84
84
|
requirements: []
|
85
85
|
rubyforge_project:
|
86
|
-
rubygems_version: 2.
|
86
|
+
rubygems_version: 2.6.9
|
87
87
|
signing_key:
|
88
88
|
specification_version: 4
|
89
89
|
summary: A Ruby client for the DoubleMap real-time transit API.
|