Class: AddressGeocoder::UrlGenerator Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/address_geocoder/url_generator.rb

Overview

This class is 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).

Since:

  • 0.0.1

Direct Known Subclasses

MapsApi::Google::UrlGenerator

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ UrlGenerator

Returns a new instance of UrlGenerator.

Since:

  • 0.0.1



21
22
23
24
25
# File 'lib/address_geocoder/url_generator.rb', line 21

def initialize(args = {})
  @api_key  = args[:api_key]
  @language = args[:language]
  @address  = args[:address]
end

Instance Attribute Details

#addressHash

Returns:

  • (Hash)


19
20
21
# File 'lib/address_geocoder/url_generator.rb', line 19

def address
  @address
end

#api_keyString

Returns the user’s key to the chosen maps API.

Returns:

  • (String)

    the user’s key to the chosen maps API



11
12
13
# File 'lib/address_geocoder/url_generator.rb', line 11

def api_key
  @api_key
end

#languageString

Returns the language in which to return the address.

Returns:

  • (String)

    the language in which to return the address



15
16
17
# File 'lib/address_geocoder/url_generator.rb', line 15

def language
  @language
end

Instance Method Details

#generate_urlString

This method is abstract.

Abstract base method for generating a URL with which to call a maps API

Returns a URL to use in calling a maps API.

Returns:

  • (String)

    a URL to use in calling a maps API

Raises:

Since:

  • 0.0.1



30
31
32
# File 'lib/address_geocoder/url_generator.rb', line 30

def generate_url
  raise NeedToOveride, 'generate_url'
end