Class: Shortwave::Model::Event

Inherits:
BaseModel show all
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

Methods inherited from BaseModel

facade_name, identified_by, inherited, link_to, #session=, sharable, shoutable, taggable

Instance Method Details

#artistsObject

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

#attendeesObject

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

#headlinerObject

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