Skip to content

Repository files navigation

pickpoint (Ruby SDK)

Official Ruby SDK for Pickpoint — geocoding, address search, routing, and device registry over HTTP.

APIWhat it does
GeocodingAddress ↔ coordinates (forward, reverse, place lookup)
Address searchTypeahead / autocomplete for address inputs
RoutingRoutes, matrices, optimized multi-stop, elevation
DevicesRegister / manage tracking devices over HTTP

This gem covers the public HTTP API only (no realtime WebSocket / gRPC tracking client). Docs: pickpoint.io/docs.

Apache-2.0. Siblings: @pickpoint/sdk, go-sdk, python-sdk, rust-sdk.

gem install pickpoint
# or in Gemfile:# gem "pickpoint"

Requires Ruby 3.1+. Zero runtime dependencies (stdlib Net::HTTP + JSON).


Public API

One Client, one auth session, whole public HTTP surface:

require"pickpoint"pp=Pickpoint::Client.new(Pickpoint::Config.new(api_key: ENV.fetch("PICKPOINT_API_KEY")))places=pp.forward("q"=>"Berlin","limit"=>"5")pp.reverse("lat"=>"52.52","lon"=>"13.405")pp.search("q"=>"Alexanderplatz")pp.route("locations"=>[{"lat"=>52.52,"lon"=>13.40},{"lat"=>52.53,"lon"=>13.42}],"costing"=>"auto")devices=pp.devices.listputsdevices.total

API map

MethodHTTPNotes
forward / geocoding.forwardGET /v2/geocode/forwardNominatim-style; returns Array
reverse / geocoding.reverseGET /v2/geocode/reverseHash or nil
lookup / geocoding.lookupGET /v2/address/lookupe.g. osm_ids
forward_batch / reverse_batch / lookup_batchsameGeocoding only; conveyor ≤20 in flight
search / address.searchGET /v2/address/searchPhoton autocomplete
route / optimized_route / matrix / locate / elevationPOST /v2/route…Valhalla JSON body
devices.list / get / create / update / delete/v2/devicesTyped structs
devices.commandPOST …/commandPayload bytes (SDK base64-encodes)
Pickpoint.mint_client_tokensPOST /v2/client-tokensNeeds secret api_key

Query params for geocode/address are plain Hash of strings (symbol keys are fine).

Auth

Provide exactly one of:

FieldHeaderUse
api_keyx-api-keyBackends, workers, CLIs
client_authAuthorization: BearerShort-lived pair; auto-refresh
access_tokenAuthorization: BearerStatic token, no refresh

Keep the secret API key on the server. For client apps mint client-tokens and pass client_auth.

pair=Pickpoint.mint_client_tokens(Pickpoint::Config.new(api_key: ENV.fetch("PICKPOINT_API_KEY")),scopes: %w[geocodingaddressroutingdevices],ttl_sec: 600)pp=Pickpoint::Client.new(Pickpoint::Config.new(client_auth: Pickpoint::ClientAuth.new(access_token: pair.access_token,refresh_token: pair.refresh_token,expires_at: pair.expires_at)))

Refresh behavior (same as Go/Python/JS):

  1. Proactive refresh at ~50% of access TTL (single-flight).
  2. On HTTP 401, one refresh + retry.
  3. If refresh fails → Pickpoint::APIError with auth code.

Config

Pickpoint::Config.new(api_key: "…",base_url: "https://api.pickpoint.io",# defaulttimeout: 30.0,max_retries: 3,retry_base: 1.0,concurrency: 20)
ConstantValue
DEFAULT_BASE_URLhttps://api.pickpoint.io
DEFAULT_TIMEOUT30s
DEFAULT_MAX_RETRIES3
DEFAULT_RETRY_BASE1s (MIN_RETRY_BASE = 0.2s)
MAX_CONCURRENCY20

Development

bundle install
bundle exec rake test

Contributing

Fork and open a pull request against dev — not main. Only pickpoint organization members can merge dev or main. Releases are devmain.

About

Official Ruby SDK for Pickpoint — geocoding, address search, routing, devices (HTTP)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages