Class: GeoGoogle::ApiResponse
- Inherits:
-
Object
- Object
- GeoGoogle::ApiResponse
- Defined in:
- lib/geo_google/geo_google_api.rb
Instance Attribute Summary collapse
-
#formatted_address ⇒ Object
readonly
Returns the value of attribute formatted_address.
-
#latitude ⇒ Object
readonly
Returns the value of attribute latitude.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(result) ⇒ ApiResponse
constructor
A new instance of ApiResponse.
Constructor Details
#initialize(result) ⇒ ApiResponse
Returns a new instance of ApiResponse.
30 31 32 33 34 35 36 |
# File 'lib/geo_google/geo_google_api.rb', line 30 def initialize(result) r = JSON.parse(result) @status = r["status"] @formatted_address = r["results"][0]["formatted_address"] @latitude = r["results"][0]["geometry"]["location"]["lat"] @longitude = r["results"][0]["geometry"]["location"]["lng"] end |
Instance Attribute Details
#formatted_address ⇒ Object (readonly)
Returns the value of attribute formatted_address.
25 26 27 |
# File 'lib/geo_google/geo_google_api.rb', line 25 def formatted_address @formatted_address end |
#latitude ⇒ Object (readonly)
Returns the value of attribute latitude.
25 26 27 |
# File 'lib/geo_google/geo_google_api.rb', line 25 def latitude @latitude end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
25 26 27 |
# File 'lib/geo_google/geo_google_api.rb', line 25 def longitude @longitude end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
25 26 27 |
# File 'lib/geo_google/geo_google_api.rb', line 25 def status @status end |