Class: Shortwave::Model::Location
- Defined in:
- lib/shortwave/model/location.rb
Overview
A location
Attributes
latitude
-
Latitude
longitude
-
Longitude
street_address
-
Street address
city
-
City
postcode
-
Post code
country
-
Country name
Instance Method Summary collapse
-
#artists ⇒ Object
Popular artists in this country.
-
#events ⇒ Object
Return events near this location.
-
#tracks ⇒ Object
Popular tracks in this location.
Methods inherited from BaseModel
facade_name, identified_by, inherited, link_to, #session=, sharable, shoutable, taggable
Instance Method Details
#artists ⇒ Object
Popular artists in this country. Needs country to be defined
22 23 24 |
# File 'lib/shortwave/model/location.rb', line 22 def artists link :top_artists, :Artist, country end |
#events ⇒ Object
Return events near this location
34 35 36 37 38 39 40 41 42 |
# File 'lib/shortwave/model/location.rb', line 34 def events if latitude && longitude link :events, :Event, :lat => latitude, :long => longitude elsif city link :events, :Event, :location => city elsif country link :events, :Event, :location => country end end |
#tracks ⇒ Object
Popular tracks in this location
27 28 29 30 31 |
# File 'lib/shortwave/model/location.rb', line 27 def tracks args = [country] args << {:location => city} if city link :top_tracks, :Track, *args end |