Class: Tellus::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/tellus/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#latitudeObject (readonly)

Returns the value of attribute latitude.



8
9
10
# File 'lib/tellus/client.rb', line 8

def latitude
  @latitude
end

#longitudeObject (readonly)

Returns the value of attribute longitude.



8
9
10
# File 'lib/tellus/client.rb', line 8

def longitude
  @longitude
end

#urlObject (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_addressObject



15
16
17
18
# File 'lib/tellus/client.rb', line 15

def get_address
    response = HTTParty.get @url
    return response['display_name']
end