Class: AddressGeocoder::Parser Abstract

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

Overview

This class is abstract.

Abstract base class for parsing maps API responses

Since:

  • 0.0.1

Direct Known Subclasses

MapsApi::Google::Parser

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Parser

Returns a new instance of Parser.

Since:

  • 0.0.1



13
14
15
16
# File 'lib/address_geocoder/parser.rb', line 13

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

Instance Attribute Details

#address=(value) ⇒ Hash (writeonly)

Returns an address object.

Returns:

  • (Hash)

    an address object

Since:

  • 0.0.1



8
9
10
# File 'lib/address_geocoder/parser.rb', line 8

def address=(value)
  @address = value
end

#fields=(value) ⇒ Hash (writeonly)

Returns a maps API response.

Returns:

  • (Hash)

    a maps API response

Since:

  • 0.0.1



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

def fields=(value)
  @fields = value
end

Instance Method Details

#parse_responseArray<Hash>

This method is abstract.

Abstract base method for parsing maps API responses

Returns a list of matching addresses.

Returns:

  • (Array<Hash>)

    a list of matching addresses

Raises:

Since:

  • 0.0.1



20
21
22
# File 'lib/address_geocoder/parser.rb', line 20

def parse_response
  raise NeedToOveride, 'parse_response'
end