Class: Shortwave::Model::Event
- Defined in:
- lib/shortwave/model/event.rb
Overview
An event.
Attributes
id
-
Last.fm id
name
-
Event name
description
-
Event description
attendance_count
-
Number of last.fm user’s attending
review_count
-
Number of reviews
starts_at
-
The start time
url
-
Last.fm site url
venue
-
Event venue
Instance Method Summary collapse
-
#artists ⇒ Object
Returns the list of artists playing at this event.
-
#attend(status = :yes) ⇒ Object
Mark the current session user’s attendance at this event.
-
#attendees ⇒ Object
Returns the list of users attending this event.
-
#headliner ⇒ Object
Returns the headline act for this event.
Methods inherited from BaseModel
facade_name, identified_by, inherited, link_to, #session=, sharable, shoutable, taggable
Instance Method Details
#artists ⇒ Object
Returns the list of artists playing at this event
50 51 52 |
# File 'lib/shortwave/model/event.rb', line 50 def artists @artists ||= artists_raw.map {|a| @session.artist.build(:name => a) } end |
#attend(status = :yes) ⇒ Object
Mark the current session user’s attendance at this event
Possible statuses are :yes
, :no
and :maybe
38 39 40 41 42 |
# File 'lib/shortwave/model/event.rb', line 38 def attend(status=:yes) i = [:yes, :maybe, :no].index(status) @session.event_facade.attend(id, i) true end |
#attendees ⇒ Object
Returns the list of users attending this event
31 32 33 |
# File 'lib/shortwave/model/event.rb', line 31 def attendees link :attendees, :User, id end |
#headliner ⇒ Object
Returns the headline act for this event
45 46 47 |
# File 'lib/shortwave/model/event.rb', line 45 def headliner @headliner ||= artists.detect {|a| a.name == headliner_raw } end |