Class: Yar::NearestResource

Inherits:
Resource show all
Defined in:
lib/Yar/resources/nearest.rb,
lib/yar/resources/nearest.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Yar::Resource

Instance Method Details

#city(lat:, long:) ⇒ Object



10
11
12
# File 'lib/Yar/resources/nearest.rb', line 10

def city(lat:, long:)
  City.new get("nearest_settlement/?lat=#{lat}&lng=#{long}").body
end

#stations(lat:, long:, distance:) ⇒ Object



5
6
7
8
# File 'lib/Yar/resources/nearest.rb', line 5

def stations(lat:, long:, distance:)
  resp = get("nearest_stations/?lat=#{lat}&lng=#{long}&distance=#{distance}")
  Collection.from_response(resp, key: "stations", type: Station)
end