Sha256: dc0cb54e22b3a6796f9e8374c0d877a1b6d735cf4233d006b20de15431206c5b

Contents?: true

Size: 635 Bytes

Versions: 6

Compression:

Stored size: 635 Bytes

Contents

# frozen_string_literal: true

module Regio
  class Routing < Core
    def results
      response.tap do |response|
        raise Unprocessable, response[:message] if response[:message]
      end
    end

    private

    def response
      options[:coordinates]&.map { |lnglat| lnglat.join(',') }&.join(';')

      @response ||= run('/routing', options)
    end

    # NOTE: all options described in the documentation
    # https://api.regio.ee/documentation/#docs/routing_and_directions
    def default_options
      {
        apikey: Configuration.api_key,
        output_format: 'json',
        limit: 25
      }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
regio-0.3.5 lib/regio/routing.rb
regio-0.3.4 lib/regio/routing.rb
regio-0.3.3 lib/regio/routing.rb
regio-0.3.2 lib/regio/routing.rb
regio-0.3.1 lib/regio/routing.rb
regio-0.3.0 lib/regio/routing.rb