travel_time 0.5.7 → 0.6.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
  SHA256:
3
- metadata.gz: d7a2b13991042791d77578dc894e869564b289137381fc5c8b319fd37efb2b11
4
- data.tar.gz: 587fac0cd53502b30c3834c7320e9b66dce1589dcb3d8757e8f0f1c7356ef920
3
+ metadata.gz: 94289b84d4537470999d6c534d87f3471ab7975ad55f0c88a4926cdbc96e97f0
4
+ data.tar.gz: ad709dc58a04d251f394b7b268dff697cbbe7e20f4cc397f255d4c96b05a395d
5
5
  SHA512:
6
- metadata.gz: 5cd13c389968b3b96684d9f36002dcc783f23c01cc90968af58e3ffb671dfb1ea6eed776e60cc7791bb15d78005753b5bc6fb5fa0574f58c0f6b92aa14157949
7
- data.tar.gz: 6720fd0d83332a628d44743381c27c3d63f981c46f667fa228ca1fbb4ae015a84d127627a0acf91d76742d850c8794532fe0fae07e0cfc29ad2ff2c7adc10c45
6
+ metadata.gz: 9fc6e8b0a487da700f015594c1777ceee6b85c7728d7ff9269e97bbb8f687b5063234c0d4e8a0741fca7f6072d42fb46a515cb44335818a7a566f86ccc7901a8
7
+ data.tar.gz: d50f406b9301cf4e45379318fc4bc2403a87c340b0bc48f024a717deb4e17da0c2f037c3b2ae59d16367bb8641f4aad5532b8a5bdb88ca5fc64a5e392a34bd33
data/README.md CHANGED
@@ -15,11 +15,15 @@ gem 'travel_time'
15
15
 
16
16
  And then execute:
17
17
 
18
- $ bundle install
18
+ ```bash
19
+ $ bundle install
20
+ ```
19
21
 
20
22
  Or install it yourself as:
21
23
 
22
- $ gem install travel_time
24
+ ```bash
25
+ $ gem install travel_time
26
+ ```
23
27
 
24
28
  ## Usage
25
29
 
@@ -27,8 +31,8 @@ In order to be able to call the API, you'll first need to set your Application I
27
31
 
28
32
  ```ruby
29
33
  TravelTime.configure do |config|
30
- config.application_id = '<your app id>'
31
- config.api_key = '<your app key>'
34
+ config.application_id = 'YOUR_APP_ID'
35
+ config.api_key = 'YOUR_APP_KEY'
32
36
  end
33
37
  ```
34
38
 
@@ -76,7 +80,7 @@ You may specify an optional rate limit when initializing your client. The `rate_
76
80
  client = TravelTime::Client.new(rate_limit = 60)
77
81
  ```
78
82
 
79
- ### [Isochrones (Time Map)](https://traveltime.com/docs/api/reference/isochrones)
83
+ ### [Isochrones (Time Map)](https://docs.traveltime.com/api/reference/isochrones)
80
84
  Given origin coordinates, find shapes of zones reachable within corresponding travel time.
81
85
  Find unions/intersections between different searches.
82
86
 
@@ -131,6 +135,62 @@ response = client.time_map(
131
135
  puts response.body
132
136
  ```
133
137
 
138
+ ### [Distance Map](https://docs.traveltime.com/api/reference/distance-map)
139
+ Given origin coordinates, find shapes of zones reachable within corresponding travel distance.
140
+ Find unions/intersections between different searches.
141
+
142
+ Body attributes:
143
+ * departure_searches: Searches based on departure times. Leave departure location at no earlier than given time. You can define a maximum of 10 searches.
144
+ * 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.
145
+ * unions: Define unions of shapes that are results of previously defined searches.
146
+ * intersections: Define intersections of shapes that are results of previously defined searches.
147
+
148
+ ```ruby
149
+ require 'time'
150
+
151
+ departure_search = {
152
+ id: "driving from Trafalgar Square",
153
+ coords: {
154
+ lat: 51.506756,
155
+ lng: -0.128050
156
+ },
157
+ transportation: { type: "driving" },
158
+ departure_time: Time.now.iso8601,
159
+ travel_distance: 1800,
160
+ }
161
+
162
+ arrival_search = {
163
+ id: "cycling to Trafalgar Square",
164
+ coords: {
165
+ lat: 51.506756,
166
+ lng: -0.128050
167
+ },
168
+ transportation: { type: "cycling" },
169
+ arrival_time: Time.now.iso8601,
170
+ travel_distance: 1800,
171
+ range: { enabled: true, width: 3600 }
172
+ }
173
+
174
+ union = {
175
+ id: 'union of driving and cycling',
176
+ search_ids: ['driving from Trafalgar Square', 'cycling to Trafalgar Square']
177
+ }
178
+
179
+ intersection = {
180
+ id: 'intersection of driving and cycling',
181
+ search_ids: ['driving from Trafalgar Square', 'cycling to Trafalgar Square']
182
+ }
183
+
184
+ response = client.distance_map(
185
+ departure_searches: [departure_search],
186
+ arrival_searches: [arrival_search],
187
+ unions: [union],
188
+ intersections: [intersection]
189
+ )
190
+
191
+ puts response.body
192
+ ```
193
+
134
194
  ### [Isochrones (Time Map) Fast](https://docs.traveltime.com/api/reference/isochrones-fast)
135
195
  A very fast version of Isochrone API. However, the request parameters are much more limited.
136
196
 
@@ -157,7 +217,7 @@ response = client.time_map_fast(
157
217
  puts response.body
158
218
  ```
159
219
 
160
- ### [Distance Matrix (Time Filter)](https://traveltime.com/docs/api/reference/distance-matrix)
220
+ ### [Distance Matrix (Time Filter)](https://docs.traveltime.com/api/reference/distance-matrix)
161
221
  Given origin and destination points filter out points that cannot be reached within specified time limit.
162
222
  Find out travel times, distances and costs between an origin and up to 2,000 destination points.
163
223
 
@@ -223,10 +283,9 @@ response = client.time_filter(
223
283
  puts response.body
224
284
  ```
225
285
 
226
- ### [Time Filter (Fast)](https://traveltime.com/docs/api/reference/time-filter-fast)
286
+ ### [Time Filter (Fast)](https://docs.traveltime.com/api/reference/time-filter-fast)
227
287
  A very fast version of `time_filter()`.
228
288
  However, the request parameters are much more limited.
229
- Currently only supports UK and Ireland.
230
289
 
231
290
  ```ruby
232
291
  locations = [
@@ -323,7 +382,7 @@ puts(response.body)
323
382
 
324
383
  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.
325
384
 
326
- ### [Routes](https://traveltime.com/docs/api/reference/routes)
385
+ ### [Routes](https://docs.traveltime.com/api/reference/routes)
327
386
  Returns routing information between source and destinations.
328
387
 
329
388
  Body attributes:
@@ -394,7 +453,7 @@ response = client.routes(
394
453
  puts response.body
395
454
  ```
396
455
 
397
- ### [Geocoding (Search)](https://traveltime.com/docs/api/reference/geocoding-search)
456
+ ### [Geocoding (Search)](https://docs.traveltime.com/api/reference/geocoding-search)
398
457
  Match a query string to geographic coordinates.
399
458
 
400
459
  ```ruby
@@ -402,7 +461,7 @@ response = client.geocoding(query: 'London', within_country: 'GB')
402
461
  puts response.body
403
462
  ```
404
463
 
405
- ### [Reverse Geocoding](https://traveltime.com/docs/api/reference/geocoding-reverse)
464
+ ### [Reverse Geocoding](https://docs.traveltime.com/api/reference/geocoding-reverse)
406
465
  Attempt to match a latitude, longitude pair to an address.
407
466
 
408
467
  ```ruby
@@ -410,7 +469,7 @@ response = client.reverse_geocoding(lat: 51.506756, lng: -0.128050)
410
469
  puts response.body
411
470
  ```
412
471
 
413
- ### [Time Filter (Postcodes)](https://traveltime.com/docs/api/reference/postcode-search)
472
+ ### [Time Filter (Postcodes)](https://docs.traveltime.com/api/reference/postcode-search)
414
473
  Find reachable postcodes from origin (or to destination) and get statistics about such postcodes.
415
474
  Currently only supports United Kingdom.
416
475
 
@@ -443,7 +502,7 @@ response = client.time_filter_postcodes(
443
502
  puts response.body
444
503
  ```
445
504
 
446
- ### [Time Filter (Postcode Districts)](https://traveltime.com/docs/api/reference/postcode-district-filter)
505
+ ### [Time Filter (Postcode Districts)](https://docs.traveltime.com/api/reference/postcode-district-filter)
447
506
  Find districts that have a certain coverage from origin (or to destination) and get statistics about postcodes within such districts.
448
507
  Currently only supports United Kingdom.
449
508
 
@@ -478,7 +537,7 @@ response = client.time_filter_postcode_districts(
478
537
  puts response.body
479
538
  ```
480
539
 
481
- ### [Time Filter (Postcode Sectors)](https://traveltime.com/docs/api/reference/postcode-sector-filter)
540
+ ### [Time Filter (Postcode Sectors)](https://docs.traveltime.com/api/reference/postcode-sector-filter)
482
541
  Find sectors that have a certain coverage from origin (or to destination) and get statistics about postcodes within such sectors.
483
542
  Currently only supports United Kingdom.
484
543
 
@@ -513,7 +572,7 @@ response = client.time_filter_postcode_sectors(
513
572
  puts response.body
514
573
  ```
515
574
 
516
- ### [Map Info](https://traveltime.com/docs/api/reference/map-info)
575
+ ### [Map Info](https://docs.traveltime.com/api/reference/map-info)
517
576
  Get information about currently supported countries.
518
577
 
519
578
  ```ruby
@@ -521,7 +580,7 @@ response = client.map_info
521
580
  puts response.body
522
581
  ```
523
582
 
524
- ### [Supported Locations](https://traveltime.com/docs/api/reference/supported-locations)
583
+ ### [Supported Locations](https://docs.traveltime.com/api/reference/supported-locations)
525
584
  Find out what points are supported by the api.
526
585
 
527
586
  ```ruby
@@ -108,6 +108,16 @@ module TravelTime
108
108
  perform_request { connection.post('time-map', payload, { 'Accept' => format }) }
109
109
  end
110
110
 
111
+ def distance_map(departure_searches: nil, arrival_searches: nil, unions: nil, intersections: nil, format: nil)
112
+ payload = {
113
+ departure_searches: departure_searches,
114
+ arrival_searches: arrival_searches,
115
+ unions: unions,
116
+ intersections: intersections
117
+ }.compact
118
+ perform_request { connection.post('distance-map', payload, { 'Accept' => format }) }
119
+ end
120
+
111
121
  def time_map_fast(arrival_searches:, format: nil)
112
122
  payload = {
113
123
  arrival_searches: arrival_searches
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TravelTime
4
- VERSION = '0.5.7'
4
+ VERSION = '0.6.0'
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.7
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - TravelTime Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-12 00:00:00.000000000 Z
11
+ date: 2024-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-configurable