Class: DoingStream::Streams::LastFM

Inherits:
DoingStream::Stream::JSONStream show all
Defined in:
lib/doing_stream/streams/last_fm.rb

Defined Under Namespace

Classes: Entry

Constant Summary collapse

URI =
'http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=<%= user %>&format=json&limit=5&api_key=<%= api_key %>'

Instance Attribute Summary collapse

Attributes inherited from DoingStream::Stream::Stream

#entries, #user

Instance Method Summary collapse

Methods inherited from DoingStream::Stream::JSONStream

#body, #entries

Methods inherited from DoingStream::Stream::Stream

#entry_class, #name, #uri

Constructor Details

#initialize(user, options = {}) ⇒ LastFM

Returns a new instance of LastFM.



7
8
9
10
# File 'lib/doing_stream/streams/last_fm.rb', line 7

def initialize user, options = {}
  super
  @api_key = options[:api_key]
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



5
6
7
# File 'lib/doing_stream/streams/last_fm.rb', line 5

def api_key
  @api_key
end

Instance Method Details

#jsonObject



12
13
14
# File 'lib/doing_stream/streams/last_fm.rb', line 12

def json
  super['recenttracks']['track']
end