doublemap_api 2.0.0 → 2.1.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: dde680b8393299472cc7dcb6a01ce62778cc5298
4
- data.tar.gz: f1865c943dc16601c7d9b603ec9346b4cbd85aca
3
+ metadata.gz: 7cb99a5dd13b41e24c011472f4eecf8debdc3840
4
+ data.tar.gz: bf6ad05c4cb57a3b9d1a472ef05149552895f612
5
5
  SHA512:
6
- metadata.gz: 47372e2dece943ae5ada69ff5820e019d582a797c2694269ebdfb281abb772cb0c8bb6d2691d6e6a079f50398b80acdc2b2b4bfbc688fb3a79d1acee380fec27
7
- data.tar.gz: 37ad58f6f57c6e8314172109998bbaeeefd98582dfd5fcc810f86c2e94c770c1e99146ea00178c4a7a0da73b48a2a989a3fc6a5d6c5e9362831926b305514f93
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
@@ -1,3 +1,3 @@
1
1
  module DoubleMap
2
- VERSION = "2.0.0"
2
+ VERSION = "2.1.0"
3
3
  end
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.0.0
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: 2016-07-02 00:00:00.000000000 Z
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.4.8
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.