Class: SpotTracks::Feed
- Inherits:
-
Object
- Object
- SpotTracks::Feed
- Defined in:
- lib/spot_tracks/feed.rb
Constant Summary collapse
- HOST =
'http://ws.audioscrobbler.com'
Instance Attribute Summary collapse
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(username) ⇒ Feed
constructor
A new instance of Feed.
- #title ⇒ Object
- #to_json ⇒ Object
- #tracks ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(username) ⇒ Feed
Returns a new instance of Feed.
9 10 11 |
# File 'lib/spot_tracks/feed.rb', line 9 def initialize(username) @username = username end |
Instance Attribute Details
#username ⇒ Object (readonly)
Returns the value of attribute username.
5 6 7 |
# File 'lib/spot_tracks/feed.rb', line 5 def username @username end |
Instance Method Details
#title ⇒ Object
13 14 15 |
# File 'lib/spot_tracks/feed.rb', line 13 def title client.title end |
#to_json ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/spot_tracks/feed.rb', line 27 def to_json { title: title, url: url, tracks: tracks.map(&:to_h) }.to_json end |
#tracks ⇒ Object
21 22 23 24 25 |
# File 'lib/spot_tracks/feed.rb', line 21 def tracks client.entries.map do |entry| SpotTracks::Track.search entry.title end.compact end |
#url ⇒ Object
17 18 19 |
# File 'lib/spot_tracks/feed.rb', line 17 def url client.url end |