Class: LastFM::Event

Inherits:
Struct
  • Object
show all
Defined in:
lib/lastfm/event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Struct

from_xml, #initialize, package

Constructor Details

This class inherits a constructor from LastFM::Struct

Instance Attribute Details

#artistsArray<String>

Returns the current value of artists.

Returns:

  • (Array<String>)

    the current value of artists



18
19
20
# File 'lib/lastfm/event.rb', line 18

def artists
  @artists
end

#attendanceFixnum

Returns the current value of attendance.

Returns:

  • (Fixnum)

    the current value of attendance



18
19
20
# File 'lib/lastfm/event.rb', line 18

def attendance
  @attendance
end

#cancelledBoolean

Returns the current value of cancelled.

Returns:

  • (Boolean)

    the current value of cancelled



18
19
20
# File 'lib/lastfm/event.rb', line 18

def cancelled
  @cancelled
end

#descriptionString

Returns the current value of description.

Returns:

  • (String)

    the current value of description



18
19
20
# File 'lib/lastfm/event.rb', line 18

def description
  @description
end

#headlinerString

Returns the current value of headliner.

Returns:

  • (String)

    the current value of headliner



18
19
20
# File 'lib/lastfm/event.rb', line 18

def headliner
  @headliner
end

#idFixnum

Returns the current value of id.

Returns:

  • (Fixnum)

    the current value of id



18
19
20
# File 'lib/lastfm/event.rb', line 18

def id
  @id
end

#imagesHash

Returns the current value of images.

Returns:

  • (Hash)

    the current value of images



18
19
20
# File 'lib/lastfm/event.rb', line 18

def images
  @images
end

#reviewsFixnum

Returns the current value of reviews.

Returns:

  • (Fixnum)

    the current value of reviews



18
19
20
# File 'lib/lastfm/event.rb', line 18

def reviews
  @reviews
end

#start_dateTime

Returns the current value of start_date.

Returns:

  • (Time)

    the current value of start_date



18
19
20
# File 'lib/lastfm/event.rb', line 18

def start_date
  @start_date
end

#tagString

Returns the current value of tag.

Returns:

  • (String)

    the current value of tag



18
19
20
# File 'lib/lastfm/event.rb', line 18

def tag
  @tag
end

#tagsArray<String>

Returns the current value of tags.

Returns:

  • (Array<String>)

    the current value of tags



18
19
20
# File 'lib/lastfm/event.rb', line 18

def tags
  @tags
end

#titleString

Returns the current value of title.

Returns:

  • (String)

    the current value of title



18
19
20
# File 'lib/lastfm/event.rb', line 18

def title
  @title
end

#urlString

Last.fm url for the event

Returns:

  • (String)

    the current value of url



18
19
20
# File 'lib/lastfm/event.rb', line 18

def url
  @url
end

#venueLastFM::Venue

Returns the current value of venue.

Returns:



18
19
20
# File 'lib/lastfm/event.rb', line 18

def venue
  @venue
end

#websiteString

Event website (different from Last.fm url)

Returns:

  • (String)

    the current value of website



18
19
20
# File 'lib/lastfm/event.rb', line 18

def website
  @website
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.tags = node.find('*').each{|tag| tag.content}
  end
end