Class: Scrobbler::Shout
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#date ⇒ Object
readonly
Returns the value of attribute date.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(input = {}) ⇒ Shout
constructor
A new instance of Shout.
Methods inherited from Base
api_key=, connection, get, maybe_streamable_attribute, maybe_streamable_node, post_request, request, sanitize, secret=
Constructor Details
#initialize(input = {}) ⇒ Shout
17 18 19 |
# File 'lib/scrobbler/shout.rb', line 17 def initialize(input={}) populate_data(input) end |
Instance Attribute Details
#author ⇒ Object (readonly)
Returns the value of attribute author.
3 4 5 |
# File 'lib/scrobbler/shout.rb', line 3 def end |
#body ⇒ Object (readonly)
Returns the value of attribute body.
3 4 5 |
# File 'lib/scrobbler/shout.rb', line 3 def body @body end |
#date ⇒ Object (readonly)
Returns the value of attribute date.
3 4 5 |
# File 'lib/scrobbler/shout.rb', line 3 def date @date end |
Class Method Details
.new_from_libxml(xml) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/scrobbler/shout.rb', line 6 def new_from_libxml(xml) data={} xml.children.each do |child| data[:body] = child.content if child.name == 'body' data[:author] = Scrobbler::User.new(child.content) if child.name == 'author' data[:date] = Time.parse(child.content) if child.name == 'date' end Shout.new(data) end |