traveltime-api-ruby 1.0.0 → 1.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.
Files changed (2) hide show
  1. data/lib/traveltime_api.rb +11 -3
  2. metadata +2 -2
@@ -56,7 +56,11 @@ class TravelTimeAPI
56
56
 
57
57
  # Result of #time_filter method.
58
58
  #
59
- # @param points [Hash] {"id1" => time_in_seconds, ...}
59
+ # Properties is a Hash that can have (if you requested them) following pairs:
60
+ # * "time" => Fixnum - time from origin to point in seconds.
61
+ # * "distance" => Fixnum - distance from origin to point in meters.
62
+ #
63
+ # @param points [Hash] {"id1" => Properties, ...}
60
64
  # @param accuracy [Symbol] :exact or :approx. Decrease travel time to switch
61
65
  # from approximate to exact accuracy.
62
66
  class TimeFilterResult < Struct.new(:points, :accuracy); end
@@ -102,14 +106,18 @@ class TravelTimeAPI
102
106
  # @param mode [String] Transportation mode. See class documentation for info.
103
107
  # @param origin [Array] [latitude, longtitude]
104
108
  # @param points [Hash] Points th{"id1" => [latitude, longtitude], ...}
109
+ # @param properties [Array] array of requested point properties. Valid values: :time,
110
+ # :distance. :distance cannot be used with any mode that
111
+ # involves public transport.
105
112
  # @return [TravelTimeAPI::TimeFilterResult]
106
- def time_filter(start_time, travel_time, mode, origin, points)
113
+ def time_filter(start_time, travel_time, mode, origin, points, properties=[:time])
107
114
  request = {
108
115
  :start_time => format_time(start_time),
109
116
  :travel_time => travel_time,
110
117
  :mode => mode,
111
118
  :origin => origin,
112
- :points => points
119
+ :points => points,
120
+ :properties => properties
113
121
  }
114
122
 
115
123
  response = post("/v2/time_filter", request)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: traveltime-api-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-01-25 00:00:00.000000000 Z
13
+ date: 2013-02-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rest-client