Class: LastFM::Shout

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

Instance Attribute Summary collapse

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

#authorString



6
7
8
# File 'lib/lastfm/shout.rb', line 6

def author
  @author
end

#bodyString



6
7
8
# File 'lib/lastfm/shout.rb', line 6

def body
  @body
end

#dateTime



6
7
8
# File 'lib/lastfm/shout.rb', line 6

def date
  @date
end

Instance Method Details

#update_from_node(node) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/lastfm/shout.rb', line 8

def update_from_node(node)
  case node.name.to_sym
    when :author
      self.author = node.content
    when :body
      self.body = node.content
    when :date
      self.date = Time.parse(node.content) rescue nil
  end
end