travel_time 0.5.1 → 0.5.4

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
  SHA256:
3
- metadata.gz: bbf2f0de892f4913899dc12a618af54bdc0d0cd531233407608e9f95962900c8
4
- data.tar.gz: d78ae9c592b7c8dbab7c29204f81543cda363dc03928182fe34243e7c5893951
3
+ metadata.gz: 479666f568d16431cf279ead2c1bf61c7f8e1f29596970afbd255750bf808f12
4
+ data.tar.gz: 0a83062eebe1621bb576ca3629e35f13c42f4e4ce0145f08d42ff12cce78e224
5
5
  SHA512:
6
- metadata.gz: de6eda8e48059030a5f42fce898f444fd9ff93cdf0e0d22357f038ffc65e989fc818fe0adc2d97479ded35bc469fc20d1477c811390ab6e810a91825e270be76
7
- data.tar.gz: 57ae66632a19f79ee6f8649551b6f4a397634d60a025c98e047c511e257a0e813fcd77699d9a4fe952b373e2b3d954ca497e05a57a01e346d169854024f7e805
6
+ metadata.gz: 587e2360688195fa2caebf53530bd6c8ca0969e757c1f9c9c071903c7ef8f0106f7225915c9e1c0a8c947fbc6d40ac291f30ad1862ed52b8adf5b200cc36c349
7
+ data.tar.gz: 1893e32110aeda9fbea6bec890d59b5f0c3ffeacd38bb9a0bb6668894761a3dce2d9a651b3f8f6afb88e9202bb10ed460518a31004e4c3dca618e7b1fe0a0ada
data/README.md CHANGED
@@ -3,9 +3,7 @@
3
3
  [![Gem Version](https://badge.fury.io/rb/travel_time.svg)](https://rubygems.org/gems/travel_time)
4
4
  [![GitHub Actions CI](https://github.com/traveltime-dev/traveltime-sdk-ruby/workflows/CI/badge.svg)](https://github.com/traveltime-dev/traveltime-sdk-ruby/actions?query=workflow%3ACI)
5
5
 
6
-
7
- This open-source library allows you to access [TravelTime API](https://docs.traveltime.com/overview/introduction)
8
- endpoints.
6
+ [Travel Time](https://docs.traveltime.com/api/overview/introduction) Ruby SDK helps users find locations by journey time rather than using ‘as the crow flies’ distance. Time-based searching gives users more opportunities for personalisation and delivers a more relevant search.
9
7
 
10
8
  ## Installation
11
9
 
@@ -30,7 +28,7 @@ In order to be able to call the API, you'll first need to set your Application I
30
28
  ```ruby
31
29
  TravelTime.configure do |config|
32
30
  config.application_id = '<your app id>'
33
- config.api_key = '<your api key>'
31
+ config.api_key = '<your app key>'
34
32
  end
35
33
  ```
36
34
 
@@ -70,11 +68,16 @@ departure_search = {
70
68
  client.time_map(departure_searches: [departure_search])
71
69
  ```
72
70
 
73
-
74
71
  ### [Isochrones (Time Map)](https://traveltime.com/docs/api/reference/isochrones)
75
72
  Given origin coordinates, find shapes of zones reachable within corresponding travel time.
76
73
  Find unions/intersections between different searches.
77
74
 
75
+ Body attributes:
76
+ * departure_searches: Searches based on departure times. Leave departure location at no earlier than given time. You can define a maximum of 10 searches.
77
+ * arrival_searches: Searches based on arrival times. Arrive at destination location at no later than given time. You can define a maximum of 10 searches.
78
+ * unions: Define unions of shapes that are results of previously defined searches.
79
+ * intersections: Define intersections of shapes that are results of previously defined searches.
80
+
78
81
  ```ruby
79
82
  require 'time'
80
83
 
@@ -133,25 +136,14 @@ arrival_search = {
133
136
  lng: -0.128050
134
137
  },
135
138
  transportation: { type: "public_transport" },
136
- arrival_time: Time.now.iso8601,
139
+ arrival_time_period: 'weekday_morning',
137
140
  travel_time: 1800,
138
141
  }
139
142
 
140
- union = {
141
- id: 'union of driving and public transport',
142
- search_ids: ['public transport from Trafalgar Square', 'public transport to Trafalgar Square']
143
- }
144
- intersection = {
145
- id: 'intersection of driving and public transport',
146
- search_ids: ['public transport from Trafalgar Square', 'public transport to Trafalgar Square']
147
- }
148
-
149
143
  response = client.time_map_fast(
150
144
  arrival_searches: {
151
145
  one_to_many: [arrival_search]
152
- },
153
- unions: [union],
154
- intersections: [intersection]
146
+ },
155
147
  )
156
148
 
157
149
  puts response.body
@@ -161,6 +153,11 @@ puts response.body
161
153
  Given origin and destination points filter out points that cannot be reached within specified time limit.
162
154
  Find out travel times, distances and costs between an origin and up to 2,000 destination points.
163
155
 
156
+ Body attributes:
157
+ * locations: Locations to use. Each location requires an id and lat/lng values
158
+ * departure_searches: Searches based on departure times. Leave departure location at no earlier than given time. You can define a maximum of 10 searches
159
+ * arrival_searches: Searches based on arrival times. Arrive at destination location at no later than given time. You can define a maximum of 10 searches
160
+
164
161
  ```ruby
165
162
  require 'time'
166
163
 
@@ -221,6 +218,11 @@ puts response.body
221
218
  ### [Routes](https://traveltime.com/docs/api/reference/routes)
222
219
  Returns routing information between source and destinations.
223
220
 
221
+ Body attributes:
222
+ * locations: Locations to use. Each location requires an id and lat/lng values.
223
+ * departure_searches: Searches based on departure times. Leave departure location at no earlier than given time. You can define a maximum of 10 searches.
224
+ * arrival_searches: Searches based on arrival times. Arrive at destination location at no later than given time. You can define a maximum of 10 searches.
225
+
224
226
  ```ruby
225
227
  require 'time'
226
228
 
@@ -285,7 +287,7 @@ puts response.body
285
287
  ```
286
288
 
287
289
  ### [Time Filter (Fast)](https://traveltime.com/docs/api/reference/time-filter-fast)
288
- A very fast version of time_filter().
290
+ A very fast version of `time_filter()`.
289
291
  However, the request parameters are much more limited.
290
292
  Currently only supports UK and Ireland.
291
293
 
@@ -347,7 +349,7 @@ response = client.time_filter_fast(
347
349
  puts response.body
348
350
  ```
349
351
 
350
- ### [Time Filter (Fast) Proto](https://docs.traveltime.com/api/reference/travel-time-distance-matrix-proto)
352
+ ### [Time Filter Fast (Proto)](https://docs.traveltime.com/api/reference/travel-time-distance-matrix-proto)
351
353
  A fast version of time filter communicating using [protocol buffers](https://github.com/protocolbuffers/protobuf).
352
354
 
353
355
  The request parameters are much more limited and only travel time is returned. In addition, the results are only approximately correct (95% of the results are guaranteed to be within 5% of the routes returned by regular time filter).
@@ -357,9 +359,9 @@ This inflexibility comes with a benefit of faster response times (Over 5x faster
357
359
  Body attributes:
358
360
  * origin: Origin point.
359
361
  * destinations: Destination points. Cannot be more than 200,000.
362
+ * country: Return the results that are within the specified country.
360
363
  * transport: Transportation type.
361
- * travelTime: Time limit;
362
- * country: Return the results that are within the specified country
364
+ * traveltime: Time limit.
363
365
 
364
366
  ```ruby
365
367
  origin = {
@@ -382,39 +384,7 @@ response = client.time_filter_fast_proto(
382
384
  puts(response.body)
383
385
  ```
384
386
 
385
- ### Time Filter (Fast) Proto Distance
386
- A version of `Time Filter (Fast) Proto` endpoint that also returns distance information. Request parameters are even more limited than `Time Filter (Fast) Proto`.
387
-
388
- This endpoint is not enabled by default, please [contact us](https://traveltime.com/contact-us) if you wish to obtain access.
389
-
390
- Body attributes:
391
- * origin: Origin point.
392
- * destinations: Destination points. Cannot be more than 200,000.
393
- * transport: Transportation type.
394
- * travelTime: Time limit;
395
- * country: Return the results that are within the specified country
396
-
397
- ```ruby
398
- origin = {
399
- lat: 51.508930,
400
- lng: -0.131387,
401
- }
402
-
403
- destinations = [{
404
- lat: 51.508824,
405
- lng: -0.167093,
406
- }]
407
-
408
- response = client.time_filter_fast_proto_distance(
409
- country: 'UK',
410
- origin: origin,
411
- destinations: destinations,
412
- transport: 'driving+ferry',
413
- traveltime: 7200
414
- )
415
- puts(response.body)
416
- ```
417
-
387
+ The responses are in the form of a list where each position denotes either a travel time (in seconds) of a journey, or if negative that the journey from the origin to the destination point is impossible.
418
388
 
419
389
  ### [Time Filter (Postcode Districts)](https://traveltime.com/docs/api/reference/postcode-district-filter)
420
390
  Find districts that have a certain coverage from origin (or to destination) and get statistics about postcodes within such districts.
@@ -66,27 +66,25 @@ module TravelTime
66
66
  end
67
67
 
68
68
  def geocoding(query:, within_country: nil, format_name: nil, exclude: nil, limit: nil, force_postcode: nil,
69
- bounds: nil)
69
+ bounds: nil, accept_language: nil)
70
70
  query = {
71
71
  query: query,
72
- 'within.country': within_country,
72
+ 'within.country': within_country.is_a?(Array) ? within_country.join(',') : within_country,
73
73
  'format.name': format_name,
74
74
  'format.exclude.country': exclude,
75
75
  limit: limit,
76
76
  'force.add.postcode': force_postcode,
77
77
  bounds: bounds&.join(',')
78
78
  }.compact
79
- perform_request { connection.get('geocoding/search', query) }
79
+ perform_request { connection.get('geocoding/search', query, { 'Accept-Language' => accept_language }) }
80
80
  end
81
81
 
82
- def reverse_geocoding(lat:, lng:, within_country: nil, exclude: nil)
82
+ def reverse_geocoding(lat:, lng:, accept_language: nil)
83
83
  query = {
84
84
  lat: lat,
85
- lng: lng,
86
- 'within.country': within_country,
87
- 'exclude.location.types': exclude
85
+ lng: lng
88
86
  }.compact
89
- perform_request { connection.get('geocoding/reverse', query) }
87
+ perform_request { connection.get('geocoding/reverse', query, { 'Accept-Language' => accept_language }) }
90
88
  end
91
89
 
92
90
  def time_map(departure_searches: nil, arrival_searches: nil, unions: nil, intersections: nil, format: nil)
@@ -99,11 +97,9 @@ module TravelTime
99
97
  perform_request { connection.post('time-map', payload, { 'Accept' => format }) }
100
98
  end
101
99
 
102
- def time_map_fast(arrival_searches:, unions: nil, intersections: nil, format: nil)
100
+ def time_map_fast(arrival_searches:, format: nil)
103
101
  payload = {
104
- arrival_searches: arrival_searches,
105
- unions: unions,
106
- intersections: intersections
102
+ arrival_searches: arrival_searches
107
103
  }.compact
108
104
  perform_request { connection.post('time-map/fast', payload, { 'Accept' => format }) }
109
105
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TravelTime
4
- VERSION = '0.5.1'
4
+ VERSION = '0.5.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: travel_time
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - TravelTime Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-19 00:00:00.000000000 Z
11
+ date: 2023-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-configurable