mapricot-api 0.12.0 → 0.13.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.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/lib/mapricot/api.rb +4 -4
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3e555ba729e27b2a4b8f31959f110398f56aa56c4194a49c96526d4542bcfa9b
|
|
4
|
+
data.tar.gz: 9c870fcd6884cf91cfc5d0bf3eb4bebf33fc06a03cb0782f5249a7503c3155e6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 77f1c6898440dfa8da979f9ace452144ab8b29b2e79d6e5c310537b81ee5d9abdc344be15f4de3da5ce5a0a95c8b774af64d1d644320c20661cade5b37e45657
|
|
7
|
+
data.tar.gz: 33f7c9d70cc13f80a9e22d2b6170dd8da78b673adea5a0c4056db9ba9385fdcfd9c834cf8e3af9e6d9b1557959454c4eca7fd9887eefd8695159b8f88e674fe1
|
data/README.md
CHANGED
|
@@ -31,19 +31,19 @@ Methods are grouped by product, the same way as the API's paths. Each returns th
|
|
|
31
31
|
| `client.geocoding.search(q, address:, locality:, county:, region:, postal_code:, focus:, country:, limit:, lang:)` | [`GET /geocoding/v1/search`](https://mapricot.com/docs/geocoding/#find-an-address) |
|
|
32
32
|
| `client.geocoding.search_batch(queries)` | [`POST /geocoding/v1/search/batch`](https://mapricot.com/docs/geocoding/#search-a-list-of-addresses) |
|
|
33
33
|
| `client.geocoding.autocomplete(q, focus:, country:, limit:, lang:)` | [`GET /geocoding/v1/autocomplete`](https://mapricot.com/docs/geocoding/#suggest-as-people-type) |
|
|
34
|
-
| `client.geocoding.reverse(lat
|
|
35
|
-
| `client.places.nearby(lat
|
|
34
|
+
| `client.geocoding.reverse(lat:, lon:, limit:, lang:)` | [`GET /geocoding/v1/reverse`](https://mapricot.com/docs/geocoding/#find-the-address-at-a-point) |
|
|
35
|
+
| `client.places.nearby(lat:, lon:, category:, radius:, limit:, lang:)` | [`GET /places/v1/nearby`](https://mapricot.com/docs/places/#list-places-around-a-point) |
|
|
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
|
|
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
|
|
|
43
43
|
Every keyword argument is optional. `focus` and each waypoint are `{ lat:, lon: }`. `country` and `category` take an Array or a comma-separated String.
|
|
44
44
|
|
|
45
45
|
```ruby
|
|
46
|
-
nearby = client.places.nearby(45.52, -122.68, category: ["food:coffee_shop"], radius: 1000)
|
|
46
|
+
nearby = client.places.nearby(lat: 45.52, lon: -122.68, category: ["food:coffee_shop"], radius: 1000)
|
|
47
47
|
route = client.routing.route([{ lat: 45.5189, lon: -122.6793 }, { lat: 45.5214, lon: -122.6828 }], mode: "walk")
|
|
48
48
|
puts route["routes"][0]["durationSeconds"]
|
|
49
49
|
```
|
|
@@ -72,7 +72,7 @@ Pass `steps: true` and each leg's `steps` has its turn-by-turn directions: an `i
|
|
|
72
72
|
An isochrone is a GeoJSON `FeatureCollection` with one polygon per time, largest first, so a map that draws them in order shows the smaller ones on top:
|
|
73
73
|
|
|
74
74
|
```ruby
|
|
75
|
-
area = client.routing.isochrone({ lat: 45.5189, lon: -122.6793 }, [5, 10], mode: "walk")
|
|
75
|
+
area = client.routing.isochrone(location: { lat: 45.5189, lon: -122.6793 }, minutes: [5, 10], mode: "walk")
|
|
76
76
|
puts area["features"].map { |feature| feature["properties"]["minutes"] }.inspect
|
|
77
77
|
```
|
|
78
78
|
|
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
|
+
VERSION = "0.13.0"
|
|
11
11
|
|
|
12
12
|
# An error response from the API.
|
|
13
13
|
class Error < StandardError
|
|
@@ -133,7 +133,7 @@ module Mapricot
|
|
|
133
133
|
end
|
|
134
134
|
|
|
135
135
|
# Find the address nearest a coordinate, or the area around it.
|
|
136
|
-
def reverse(lat
|
|
136
|
+
def reverse(lat:, lon:, limit: nil, lang: nil)
|
|
137
137
|
@get.call("/geocoding/v1/reverse", lat: lat, lon: lon, limit: limit, lang: lang)
|
|
138
138
|
end
|
|
139
139
|
end
|
|
@@ -145,7 +145,7 @@ module Mapricot
|
|
|
145
145
|
end
|
|
146
146
|
|
|
147
147
|
# List places around a coordinate, optionally by category, an Array or a String.
|
|
148
|
-
def nearby(lat
|
|
148
|
+
def nearby(lat:, lon:, category: nil, radius: nil, limit: nil, lang: nil)
|
|
149
149
|
@get.call("/places/v1/nearby", lat: lat, lon: lon, category: category, radius: radius, limit: limit, lang: lang)
|
|
150
150
|
end
|
|
151
151
|
|
|
@@ -181,7 +181,7 @@ module Mapricot
|
|
|
181
181
|
# The areas reachable from a location, {lat:, lon:}, within 1 to 4 times, each 1 to 60 minutes, as a GeoJSON
|
|
182
182
|
# FeatureCollection with one polygon per time, largest first. mode and costing are as for route. generalize smooths
|
|
183
183
|
# each outline to within that many meters, from 10 to 5000; left out, the API picks it from the travel time.
|
|
184
|
-
def isochrone(location
|
|
184
|
+
def isochrone(location:, minutes:, mode: nil, costing: nil, generalize: nil)
|
|
185
185
|
@post.call("/routing/v1/isochrone", { location: location, minutes: minutes, mode: mode, costing: costing, generalize: generalize })
|
|
186
186
|
end
|
|
187
187
|
end
|