class ItunesApi::Music::Song
Wrapper for song results.
Public Class Methods
find_by_collection_id(collection_id, store)
click to toggle source
# File lib/itunes_api/music/song.rb, line 21 def find_by_collection_id(collection_id, store) songs(collection_id, store).map { |song| new(*song.attributes) } end
find_by_track_id(track_id, store)
click to toggle source
# File lib/itunes_api/music/song.rb, line 25 def find_by_track_id(track_id, store) result = songs(track_id, store).first new(*result.attributes) if result end
Private Class Methods
songs(id, store)
click to toggle source
# File lib/itunes_api/music/song.rb, line 33 def songs(id, store) Requests::Songs.find_by_id(id, store) end
Public Instance Methods
explicit?()
click to toggle source
# File lib/itunes_api/music/song.rb, line 38 def explicit? explicitness == 'explicit' end
streamable?()
click to toggle source
# File lib/itunes_api/music/song.rb, line 42 def streamable? return false if streamable.nil? streamable end
to_hash()
click to toggle source
# File lib/itunes_api/music/song.rb, line 48 def to_hash { album: album, artist: artist, duration: duration, explicit: explicit?, genre: genre, link: link, name: name, number: number, preview: preview, store: store, streamable: streamable?, track_id: track_id } end