Class: AddressGeocoder::UrlGenerator Abstract
- Inherits:
-
Object
- Object
- AddressGeocoder::UrlGenerator
- 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).
Direct Known Subclasses
Instance Attribute Summary collapse
- #address ⇒ Hash
-
#api_key ⇒ String
The user’s key to the chosen maps API.
-
#language ⇒ String
The language in which to return the address.
Instance Method Summary collapse
-
#generate_url ⇒ String
abstract
A URL to use in calling a maps API.
-
#initialize(args = {}) ⇒ UrlGenerator
constructor
A new instance of UrlGenerator.
Constructor Details
#initialize(args = {}) ⇒ UrlGenerator
Returns a new instance of UrlGenerator.
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
#address ⇒ Hash
19 20 21 |
# File 'lib/address_geocoder/url_generator.rb', line 19 def address @address end |
#api_key ⇒ String
Returns 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 |
#language ⇒ String
Returns 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_url ⇒ String
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.
30 31 32 |
# File 'lib/address_geocoder/url_generator.rb', line 30 def generate_url raise NeedToOveride, 'generate_url' end |