Class: Tellus::Client
- Inherits:
-
Object
- Object
- Tellus::Client
- Defined in:
- lib/tellus/client.rb
Instance Attribute Summary collapse
-
#latitude ⇒ Object
readonly
Returns the value of attribute latitude.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #get_address ⇒ Object
-
#initialize(latitude, longitude) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(latitude, longitude) ⇒ Client
Returns a new instance of Client.
10 11 12 13 |
# File 'lib/tellus/client.rb', line 10 def initialize latitude, longitude @latitude, @longitude = latitude, longitude @url = "https://nominatim.openstreetmap.org/reverse?format=json&lat=#{@latitude}&lon=#{@longitude}&zoom=14" end |
Instance Attribute Details
#latitude ⇒ Object (readonly)
Returns the value of attribute latitude.
8 9 10 |
# File 'lib/tellus/client.rb', line 8 def latitude @latitude end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
8 9 10 |
# File 'lib/tellus/client.rb', line 8 def longitude @longitude end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
8 9 10 |
# File 'lib/tellus/client.rb', line 8 def url @url end |
Instance Method Details
#get_address ⇒ Object
15 16 17 18 |
# File 'lib/tellus/client.rb', line 15 def get_address response = HTTParty.get @url return response['display_name'] end |