Class: Geocodio::Address
- Inherits:
-
Object
- Object
- Geocodio::Address
- Defined in:
- lib/geocodio/address.rb
Instance Attribute Summary collapse
-
#accuracy ⇒ Float
readonly
How accurate geocod.io deemed this result to be given the original query.
-
#city ⇒ Object
readonly
Returns the value of attribute city.
-
#congressional_district ⇒ Object
readonly
Returns the value of attribute congressional_district.
-
#elementary_school_district ⇒ Object
readonly
Returns the value of attribute elementary_school_district.
-
#house_district ⇒ Object
readonly
Returns the value of attribute house_district.
-
#latitude ⇒ Object
(also: #lat)
readonly
Returns the value of attribute latitude.
-
#longitude ⇒ Object
(also: #lng)
readonly
Returns the value of attribute longitude.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#predirectional ⇒ Object
readonly
Returns the value of attribute predirectional.
-
#secondary_school_district ⇒ Object
readonly
Returns the value of attribute secondary_school_district.
-
#senate_district ⇒ Object
readonly
Returns the value of attribute senate_district.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#street ⇒ Object
readonly
Returns the value of attribute street.
-
#suffix ⇒ Object
readonly
Returns the value of attribute suffix.
-
#timezone ⇒ Object
readonly
Returns the value of attribute timezone.
-
#unified_school_district ⇒ Object
readonly
Returns the value of attribute unified_school_district.
-
#zip ⇒ Object
readonly
Returns the value of attribute zip.
Instance Method Summary collapse
-
#initialize(payload = {}) ⇒ Address
constructor
A new instance of Address.
-
#to_s ⇒ String
Formats the address in the standard way.
Constructor Details
#initialize(payload = {}) ⇒ Address
Returns a new instance of Address.
25 26 27 28 29 30 31 32 |
# File 'lib/geocodio/address.rb', line 25 def initialize(payload = {}) set_attributes(payload['address_components']) if payload['address_components'] set_coordinates(payload['location']) if payload['location'] set_additional_fields(payload['fields']) if payload['fields'] @accuracy = payload['accuracy'] @formatted_address = payload['formatted_address'] end |
Instance Attribute Details
#accuracy ⇒ Float (readonly)
How accurate geocod.io deemed this result to be given the original query.
23 24 25 |
# File 'lib/geocodio/address.rb', line 23 def accuracy @accuracy end |
#city ⇒ Object (readonly)
Returns the value of attribute city.
8 9 10 |
# File 'lib/geocodio/address.rb', line 8 def city @city end |
#congressional_district ⇒ Object (readonly)
Returns the value of attribute congressional_district.
14 15 16 |
# File 'lib/geocodio/address.rb', line 14 def congressional_district @congressional_district end |
#elementary_school_district ⇒ Object (readonly)
Returns the value of attribute elementary_school_district.
14 15 16 |
# File 'lib/geocodio/address.rb', line 14 def elementary_school_district @elementary_school_district end |
#house_district ⇒ Object (readonly)
Returns the value of attribute house_district.
14 15 16 |
# File 'lib/geocodio/address.rb', line 14 def house_district @house_district end |
#latitude ⇒ Object (readonly) Also known as: lat
Returns the value of attribute latitude.
10 11 12 |
# File 'lib/geocodio/address.rb', line 10 def latitude @latitude end |
#longitude ⇒ Object (readonly) Also known as: lng
Returns the value of attribute longitude.
10 11 12 |
# File 'lib/geocodio/address.rb', line 10 def longitude @longitude end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
8 9 10 |
# File 'lib/geocodio/address.rb', line 8 def number @number end |
#predirectional ⇒ Object (readonly)
Returns the value of attribute predirectional.
8 9 10 |
# File 'lib/geocodio/address.rb', line 8 def predirectional @predirectional end |
#secondary_school_district ⇒ Object (readonly)
Returns the value of attribute secondary_school_district.
14 15 16 |
# File 'lib/geocodio/address.rb', line 14 def secondary_school_district @secondary_school_district end |
#senate_district ⇒ Object (readonly)
Returns the value of attribute senate_district.
14 15 16 |
# File 'lib/geocodio/address.rb', line 14 def senate_district @senate_district end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
8 9 10 |
# File 'lib/geocodio/address.rb', line 8 def state @state end |
#street ⇒ Object (readonly)
Returns the value of attribute street.
8 9 10 |
# File 'lib/geocodio/address.rb', line 8 def street @street end |
#suffix ⇒ Object (readonly)
Returns the value of attribute suffix.
8 9 10 |
# File 'lib/geocodio/address.rb', line 8 def suffix @suffix end |
#timezone ⇒ Object (readonly)
Returns the value of attribute timezone.
18 19 20 |
# File 'lib/geocodio/address.rb', line 18 def timezone @timezone end |
#unified_school_district ⇒ Object (readonly)
Returns the value of attribute unified_school_district.
14 15 16 |
# File 'lib/geocodio/address.rb', line 14 def unified_school_district @unified_school_district end |
#zip ⇒ Object (readonly)
Returns the value of attribute zip.
8 9 10 |
# File 'lib/geocodio/address.rb', line 8 def zip @zip end |
Instance Method Details
#to_s ⇒ String
Formats the address in the standard way.
37 38 39 |
# File 'lib/geocodio/address.rb', line 37 def to_s @formatted_address end |