travel_time 0.5.7 → 0.6.1

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
  SHA256:
3
- metadata.gz: d7a2b13991042791d77578dc894e869564b289137381fc5c8b319fd37efb2b11
4
- data.tar.gz: 587fac0cd53502b30c3834c7320e9b66dce1589dcb3d8757e8f0f1c7356ef920
3
+ metadata.gz: af716d7c4c1267d934bb7c5800e3c0e4b87e58d6ec58d5ecdc4a9fa86b8be88d
4
+ data.tar.gz: 472cbf1e167a1dba7f776f7729a47de3f1648267836ccd23fd04ff34b13fc491
5
5
  SHA512:
6
- metadata.gz: 5cd13c389968b3b96684d9f36002dcc783f23c01cc90968af58e3ffb671dfb1ea6eed776e60cc7791bb15d78005753b5bc6fb5fa0574f58c0f6b92aa14157949
7
- data.tar.gz: 6720fd0d83332a628d44743381c27c3d63f981c46f667fa228ca1fbb4ae015a84d127627a0acf91d76742d850c8794532fe0fae07e0cfc29ad2ff2c7adc10c45
6
+ metadata.gz: 32e49cd7b6fc8fefd2fb84ad7b30dbf8c67d323548d9c4904263b3a6a1b51b0de60af27f73edd4d1b8ab910664225be4884817d93a7a7ed6bfc9e690a2c2a54d
7
+ data.tar.gz: 46394883839d6dfc3ec8893fce80d9abab8ba6dbed2329c595155fc719533ac120de7ecf5d1a22a815d4993c17152d51b437ec6c0cf43efca90c5f35e5acaf67
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
@@ -561,14 +620,47 @@ puts response.body
561
620
 
562
621
  ## Development
563
622
 
564
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can
565
- also run `bin/console` for an interactive prompt that will allow you to experiment.
623
+ ### Set up Ruby Version Manager
624
+
625
+ This is optional, but enables you not installing gems to system directories.
626
+
627
+ 1. Install RVM: https://rvm.io/
628
+ 2. Optional gnome-terminal integration: https://rvm.io/integration/gnome-terminal
629
+ 3. Install and set up Ruby with RVM:
630
+ ```shell
631
+ rvm install ruby-3.2.2
632
+ rvm alias create default ruby-3.2.2
633
+ rvm use ruby-3.2.2
634
+ rvm gemset create traveltime-sdk
635
+ ```
636
+
637
+ ### Start using RVM
638
+
639
+ ```shell
640
+ rvm use default@traveltime-sdk
641
+ ```
642
+
643
+ ### Install dependencies
644
+
645
+ Run `bin/setup` to install dependencies.
646
+
647
+ ### Run tests
648
+
649
+ Run `rake spec` to run the tests.
650
+
651
+ ### Interactive prompt
652
+
653
+ Run `bin/console` for an interactive prompt that will allow you to experiment.
654
+
655
+ ### Installing TravelTime gem
566
656
 
567
657
  To install this gem onto your local machine, run `bundle exec rake install`.
568
658
 
659
+ ### Release
660
+
569
661
  To release a new version, update the version number in `version.rb` and then create a GitHub release. This will trigger
570
662
  a GitHub Action which will push the `.gem` file to [rubygems.org](https://rubygems.org).
571
663
 
572
664
  ## Contributing
573
665
 
574
- Bug reports and pull requests are welcome on GitHub at https://github.com/traveltime-dev/travel_time.
666
+ Bug reports and pull requests are welcome on GitHub at https://github.com/traveltime-dev/traveltime-sdk-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.1'
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.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - TravelTime Team
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-12 00:00:00.000000000 Z
11
+ date: 2025-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-configurable
@@ -50,20 +50,14 @@ dependencies:
50
50
  requirements:
51
51
  - - ">="
52
52
  - !ruby/object:Gem::Version
53
- version: '3.21'
54
- - - "<"
55
- - !ruby/object:Gem::Version
56
- version: 3.21.9
53
+ version: 3.25.5
57
54
  type: :runtime
58
55
  prerelease: false
59
56
  version_requirements: !ruby/object:Gem::Requirement
60
57
  requirements:
61
58
  - - ">="
62
59
  - !ruby/object:Gem::Version
63
- version: '3.21'
64
- - - "<"
65
- - !ruby/object:Gem::Version
66
- version: 3.21.9
60
+ version: 3.25.5
67
61
  - !ruby/object:Gem::Dependency
68
62
  name: ruby-limiter
69
63
  requirement: !ruby/object:Gem::Requirement
@@ -112,7 +106,7 @@ metadata:
112
106
  homepage_uri: https://traveltime.com
113
107
  source_code_uri: https://github.com/traveltime-dev/traveltime-sdk-ruby
114
108
  changelog_uri: https://github.com/traveltime-dev/traveltime-sdk-ruby/releases
115
- post_install_message:
109
+ post_install_message:
116
110
  rdoc_options: []
117
111
  require_paths:
118
112
  - lib
@@ -128,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
122
  version: '0'
129
123
  requirements: []
130
124
  rubygems_version: 3.1.6
131
- signing_key:
125
+ signing_key:
132
126
  specification_version: 4
133
127
  summary: TravelTime SDK for Ruby programming language
134
128
  test_files: []