Class: GoogleGeocodings::Geocoding

Inherits:
Object
  • Object
show all
Defined in:
lib/google_geocodings/geocoding.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json_result_object, api_key) ⇒ Geocoding

Returns a new instance of Geocoding.



4
5
6
7
8
9
10
11
# File 'lib/google_geocodings/geocoding.rb', line 4

def initialize(json_result_object, api_key)
  @address_components = json_result_object['address_components']
  @formatted_address  = json_result_object['formatted_address']
  @geometry           = json_result_object['geometry']
  @place_id           = json_result_object['place_id']
  @types              = json_result_object['types']
  @api_key            = api_key
end

Instance Attribute Details

#address_componentsObject (readonly)

Returns the value of attribute address_components.



3
4
5
# File 'lib/google_geocodings/geocoding.rb', line 3

def address_components
  @address_components
end

#api_keyObject (readonly)

Returns the value of attribute api_key.



3
4
5
# File 'lib/google_geocodings/geocoding.rb', line 3

def api_key
  @api_key
end

#formatted_addressObject (readonly)

Returns the value of attribute formatted_address.



3
4
5
# File 'lib/google_geocodings/geocoding.rb', line 3

def formatted_address
  @formatted_address
end

#geometryObject (readonly)

Returns the value of attribute geometry.



3
4
5
# File 'lib/google_geocodings/geocoding.rb', line 3

def geometry
  @geometry
end

#place_idObject (readonly)

Returns the value of attribute place_id.



3
4
5
# File 'lib/google_geocodings/geocoding.rb', line 3

def place_id
  @place_id
end

#typesObject (readonly)

Returns the value of attribute types.



3
4
5
# File 'lib/google_geocodings/geocoding.rb', line 3

def types
  @types
end

Instance Method Details

#[](key) ⇒ Object



13
14
15
# File 'lib/google_geocodings/geocoding.rb', line 13

def [] (key)
  send(key)
end