class AddressGeocoder::UrlGenerator

@abstract Abstract base class for generatoring URLs to call maps APIs @todo If not other apis need this class then maybe this should be a map api

specific class (ie. might not need an abstract base class).

Attributes

address[RW]

@!attribute address @return [Hash]

api_key[RW]

@!attribute api_key @return (see AddressGeocoder::Client#api_key)

language[RW]

@!attribute language @return (see AddressGeocoder::Client#language)

Public Class Methods

new(args = {}) click to toggle source
# File lib/address_geocoder/url_generator.rb, line 21
def initialize(args = {})
  @api_key  = args[:api_key]
  @language = args[:language]
  @address  = args[:address]
end

Public Instance Methods

generate_url() click to toggle source

@abstract Abstract base method for generating a URL with which to call a

maps API

@return [String] a URL to use in calling a maps API

# File lib/address_geocoder/url_generator.rb, line 30
def generate_url
  raise NeedToOveride, 'generate_url'
end

Private Instance Methods

hash_to_query(hash) click to toggle source

Translate a hash into a query string @param hash [Hash] the object to be transformed @return [String] a URL query

# File lib/address_geocoder/url_generator.rb, line 39
def hash_to_query(hash)
  URI.encode_www_form(hash)
end