mapricot-api 0.10.0 → 0.11.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 (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -4
  3. data/lib/mapricot/api.rb +6 -5
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e778f6345129b270ba0ba06c9e791051a9093d5c361dbd17afa00aa15a5f0f8e
4
- data.tar.gz: '092b116567111f7fc1b702add90dff4caf06e7c7ef46307a58346b229ce62730'
3
+ metadata.gz: 3aa156c2854ba75ee6f5277d91f46bc586e5c1807b47057a253fa7b0b117a930
4
+ data.tar.gz: f321e6ebdbcceb3f94ae5b51e8af98da8aa1abc4fac9d05914f7377df6feb63c
5
5
  SHA512:
6
- metadata.gz: '093e71c5a7d7ab43b19c13a30671e3c20b334ebf115daefd01204600f021c7abe97c83dbe0b467c3f8bdac914bf26033de7c956b283c8a102db34f532cc5ebfe'
7
- data.tar.gz: 7ec4ba130fa05c424d2d19b5caa40c0d3ab4323962fe4a08363e295f01c15535d47b8f2feaab95a1caaef4f79b7e901d0bfbbe690c5c90a479ff6bba13ffd497
6
+ metadata.gz: 25afe81cbda109fc6272517af7b6bf1b3d3b29ec2a6d81eda812830834da030a3c7bbb23e7ef644f63875771b1ff907a97870c56d930a448965ab34195ef3866
7
+ data.tar.gz: 73c41d224dc22f7c5c90db74814fb7cb5202110bab0f0abc3610dced8adca8334c430887a28d4a02c279359eaf7a4c617d1baef53982ea5a61b754036dd9331c
data/README.md CHANGED
@@ -24,7 +24,7 @@ puts place["label"], place["lat"], place["lon"]
24
24
 
25
25
  ## Methods
26
26
 
27
- Methods are grouped by product, the same way as the API's paths. Each returns the API's JSON as a Hash with string keys, with the same field names as the [API reference](https://mapricot.com/api-reference/).
27
+ Methods are grouped by product, the same way as the API's paths. Each returns the API's JSON as a Hash with string keys, with the same field names as the [API reference](https://mapricot.com/docs/api-reference/).
28
28
 
29
29
  | Method | Endpoint |
30
30
  | --- | --- |
@@ -36,7 +36,7 @@ Methods are grouped by product, the same way as the API's paths. Each returns th
36
36
  | `client.places.get(id, lang:)` | [`GET /places/v1/{id}`](https://mapricot.com/docs/places/#look-up-a-saved-place) |
37
37
  | `client.routing.route(waypoints, mode:, geometries:, steps:, lang:, costing:)` | [`POST /routing/v1/route`](https://mapricot.com/docs/routing/#get-a-route) |
38
38
  | `client.routing.optimize(waypoints, mode:, geometries:, steps:, lang:, costing:)` | [`POST /routing/v1/optimize`](https://mapricot.com/docs/routing/#optimize-the-order-of-stops) |
39
- | `client.routing.isochrone(location, minutes, mode:, costing:)` | [`POST /routing/v1/isochrone`](https://mapricot.com/docs/routing/#get-an-isochrone) |
39
+ | `client.routing.isochrone(location, minutes, mode:, costing:, generalize:)` | [`POST /routing/v1/isochrone`](https://mapricot.com/docs/routing/#get-an-isochrone) |
40
40
  | `client.ip_geolocation.lookup(ip)` | [`GET /ip-geolocation/v1/{ip}`](https://mapricot.com/docs/ip-geolocation/#look-up-an-address) |
41
41
  | `client.account` | `GET /account`, which checks a key and is never billed |
42
42
 
@@ -70,6 +70,8 @@ area = client.routing.isochrone({ lat: 45.5189, lon: -122.6793 }, [5, 10], mode:
70
70
  puts area["features"].map { |feature| feature["properties"]["minutes"] }.inspect
71
71
  ```
72
72
 
73
+ `generalize` smooths each outline to within that many meters, from 10 to 5000, so it has fewer points. The API picks it from the travel time when you leave it out. A long drive's outlines are detailed and large, and `generalize: 300` makes them much smaller while keeping their shape at city scale.
74
+
73
75
  If your app shows results, show the credits in each response's `attribution`.
74
76
 
75
77
  ## Errors and retries
@@ -84,11 +86,11 @@ rescue Mapricot::Error => e
84
86
  end
85
87
  ```
86
88
 
87
- The client retries `503` responses and `429 concurrency_exceeded`, up to twice, waiting longer each time. Errors aren't billed. Pass `max_retries:` and `timeout:` (seconds) to `Mapricot::Client.new` to change this. The [API reference](https://mapricot.com/api-reference/#errors) lists every status.
89
+ The client retries `503` responses and `429 concurrency_exceeded`, up to twice, waiting longer each time. Errors aren't billed. Pass `max_retries:` and `timeout:` (seconds) to `Mapricot::Client.new` to change this. The [API reference](https://mapricot.com/docs/api-reference/#errors) lists every status.
88
90
 
89
91
  ## Links
90
92
 
91
93
  - [Mapricot](https://mapricot.com/)
92
94
  - [Ruby docs](https://mapricot.com/docs/ruby/)
93
- - [API reference](https://mapricot.com/api-reference/)
95
+ - [API reference](https://mapricot.com/docs/api-reference/)
94
96
  - [Pricing](https://mapricot.com/pricing/)
data/lib/mapricot/api.rb CHANGED
@@ -7,7 +7,7 @@ require "net/http"
7
7
  # The official client for the Mapricot API: address and place search, reverse geocoding, nearby places, routing,
8
8
  # and IP geolocation. See https://mapricot.com/docs/ruby/.
9
9
  module Mapricot
10
- VERSION = "0.10.0"
10
+ VERSION = "0.11.0"
11
11
 
12
12
  # An error response from the API.
13
13
  class Error < StandardError
@@ -22,7 +22,7 @@ module Mapricot
22
22
  end
23
23
 
24
24
  # Methods are grouped by product, as in client.geocoding.search. Each returns the API's JSON as a Hash with string
25
- # keys, as in https://mapricot.com/api-reference/.
25
+ # keys, as in https://mapricot.com/docs/api-reference/.
26
26
  class Client
27
27
  attr_reader :geocoding, :places, :routing, :ip_geolocation
28
28
 
@@ -175,9 +175,10 @@ module Mapricot
175
175
  end
176
176
 
177
177
  # The areas reachable from a location, {lat:, lon:}, within 1 to 4 times, each 1 to 60 minutes, as a GeoJSON
178
- # FeatureCollection with one polygon per time, largest first. mode and costing are as for route.
179
- def isochrone(location, minutes, mode: nil, costing: nil)
180
- @post.call("/routing/v1/isochrone", { location: location, minutes: minutes, mode: mode, costing: costing })
178
+ # FeatureCollection with one polygon per time, largest first. mode and costing are as for route. generalize smooths
179
+ # each outline to within that many meters, from 10 to 5000; left out, the API picks it from the travel time.
180
+ def isochrone(location, minutes, mode: nil, costing: nil, generalize: nil)
181
+ @post.call("/routing/v1/isochrone", { location: location, minutes: minutes, mode: mode, costing: costing, generalize: generalize })
181
182
  end
182
183
  end
183
184
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mapricot-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mapricot