class Decidim::Map::Provider::StaticMap::Here

The static map utility class for the HERE maps service

Public Instance Methods

url_params(latitude:, longitude:, options: {}) click to toggle source

@See Decidim::Map::StaticMap#url_params

# File lib/decidim/map/provider/static_map/here.rb, line 10
def url_params(latitude:, longitude:, options: {})
  params = {
    c: "#{latitude}, #{longitude}",
    z: options[:zoom] || 15,
    w: options[:width] || 120,
    h: options[:height] || 120,
    f: 1
  }

  api_key = configuration[:api_key]
  if api_key.is_a?(Array)
    # Legacy way of configuring the API credentials
    params[:app_id] = api_key[0]
    params[:app_code] = api_key[1]
  else
    # The new way of configuring the API key
    params[:apiKey] = api_key
  end

  params
end