Class: LastFM::Event
Instance Attribute Summary collapse
-
#artists ⇒ Array<String>
The current value of artists.
-
#attendance ⇒ Fixnum
The current value of attendance.
-
#cancelled ⇒ Boolean
The current value of cancelled.
-
#description ⇒ String
The current value of description.
-
#headliner ⇒ String
The current value of headliner.
-
#id ⇒ Fixnum
The current value of id.
-
#images ⇒ Hash
The current value of images.
-
#reviews ⇒ Fixnum
The current value of reviews.
-
#start_date ⇒ Time
The current value of start_date.
-
#tag ⇒ String
The current value of tag.
-
#tags ⇒ Array<String>
The current value of tags.
-
#title ⇒ String
The current value of title.
-
#url ⇒ String
Last.fm url for the event.
-
#venue ⇒ LastFM::Venue
The current value of venue.
-
#website ⇒ String
Event website (different from Last.fm url).
Class Method Summary collapse
-
.attend(params) ⇒ Object
Set a user’s attendance status for an event.
-
.get_attendees(params) ⇒ Object
Get a list of attendees for an event.
-
.get_info(params) ⇒ Object
Get the metadata for an event on Last.fm.
-
.get_shouts(params) ⇒ Object
Get shouts for an event.
-
.share(params) ⇒ Object
Share an event with one or more Last.fm users or other friends.
-
.shout(params) ⇒ Object
Shout in an event’s shoutbox.
Instance Method Summary collapse
Methods inherited from Struct
from_xml, inherited, #initialize, package, #to_json
Constructor Details
This class inherits a constructor from LastFM::Struct
Instance Attribute Details
#artists ⇒ Array<String>
Returns the current value of artists.
18 19 20 |
# File 'lib/lastfm/event.rb', line 18 def artists @artists end |
#attendance ⇒ Fixnum
Returns the current value of attendance.
18 19 20 |
# File 'lib/lastfm/event.rb', line 18 def attendance @attendance end |
#cancelled ⇒ Boolean
Returns the current value of cancelled.
18 19 20 |
# File 'lib/lastfm/event.rb', line 18 def cancelled @cancelled end |
#description ⇒ String
Returns the current value of description.
18 19 20 |
# File 'lib/lastfm/event.rb', line 18 def description @description end |
#headliner ⇒ String
Returns the current value of headliner.
18 19 20 |
# File 'lib/lastfm/event.rb', line 18 def headliner @headliner end |
#id ⇒ Fixnum
Returns the current value of id.
18 19 20 |
# File 'lib/lastfm/event.rb', line 18 def id @id end |
#images ⇒ Hash
Returns the current value of images.
18 19 20 |
# File 'lib/lastfm/event.rb', line 18 def images @images end |
#reviews ⇒ Fixnum
Returns the current value of reviews.
18 19 20 |
# File 'lib/lastfm/event.rb', line 18 def reviews @reviews end |
#start_date ⇒ Time
Returns the current value of start_date.
18 19 20 |
# File 'lib/lastfm/event.rb', line 18 def start_date @start_date end |
#tag ⇒ String
Returns the current value of tag.
18 19 20 |
# File 'lib/lastfm/event.rb', line 18 def tag @tag end |
#tags ⇒ Array<String>
Returns the current value of tags.
18 19 20 |
# File 'lib/lastfm/event.rb', line 18 def @tags end |
#title ⇒ String
Returns the current value of title.
18 19 20 |
# File 'lib/lastfm/event.rb', line 18 def title @title end |
#url ⇒ String
Last.fm url for the event
18 19 20 |
# File 'lib/lastfm/event.rb', line 18 def url @url end |
#venue ⇒ LastFM::Venue
Returns the current value of venue.
18 19 20 |
# File 'lib/lastfm/event.rb', line 18 def venue @venue end |
#website ⇒ String
Event website (different from Last.fm url)
18 19 20 |
# File 'lib/lastfm/event.rb', line 18 def website @website end |
Class Method Details
.attend(params) ⇒ Object
Set a user’s attendance status for an event.
69 70 71 72 73 74 |
# File 'lib/lastfm/event.rb', line 69 def attend( params ) LastFM.requires_authentication status_codes = { attending: 0, maybe_attending: 1, not_attending: 2 } params[:status] = status_codes[params[:status]] if params.include?(:status) LastFM.post( "event.attend", params ) end |
.get_attendees(params) ⇒ Object
Get a list of attendees for an event.
82 83 84 |
# File 'lib/lastfm/event.rb', line 82 def get_attendees( params ) LastFM.get( "event.getAttendees", params ) end |
.get_info(params) ⇒ Object
Get the metadata for an event on Last.fm. Includes attendance and lineup information.
90 91 92 |
# File 'lib/lastfm/event.rb', line 90 def get_info( params ) LastFM.get( "event.getInfo", params ) end |
.get_shouts(params) ⇒ Object
Get shouts for an event.
100 101 102 |
# File 'lib/lastfm/event.rb', line 100 def get_shouts( params ) LastFM.get( "event.getShouts", params ) end |
.share(params) ⇒ Object
Share an event with one or more Last.fm users or other friends.
111 112 113 114 |
# File 'lib/lastfm/event.rb', line 111 def share( params ) LastFM.requires_authentication LastFM.post( "event.share", params ) end |
.shout(params) ⇒ Object
Shout in an event’s shoutbox.
121 122 123 124 |
# File 'lib/lastfm/event.rb', line 121 def shout( params ) LastFM.requires_authentication LastFM.post( "event.shout", params ) end |
Instance Method Details
#update_from_node(node) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/lastfm/event.rb', line 20 def update_from_node(node) case node.name.to_sym when :id self.id = node.content.to_i when :title self.title = node.content when :artists # nested artists and headliner node.find('*').each{|child| self.update_from_node(child)} when :artist self.artists ||= [] self.artists << node.content when :headliner self.headliner = node.content when :venue self.venue = LastFM::Venue.from_xml( node ) when :startDate self.start_date = Time.parse(node.content) rescue nil when :description self.description = node.content when :image self.images ||= {} self.images.merge!({node['size'].to_sym => node.content}) when :attendance self.attendance = node.content.to_i when :reviews self.reviews = node.content.to_i when :tag self.tag = node.content when :url self.url = node.content when :website self.website = node.content when :tickets # ??? when :cancelled self.cancelled = (node.content == '1') when :tags self. = node.find('*').each{|tag| tag.content} end end |