Class: ItunesApi::Music::Song
- Inherits:
-
Object
- Object
- ItunesApi::Music::Song
- Defined in:
- lib/itunes_api/music/song.rb
Overview
Wrapper for song results.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.find_by_collection_id(collection_id, store) ⇒ Object
21 22 23 |
# 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) ⇒ Object
25 26 27 28 29 |
# 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 |
Instance Method Details
#explicit? ⇒ Boolean
38 39 40 |
# File 'lib/itunes_api/music/song.rb', line 38 def explicit? explicitness == 'explicit' end |
#streamable? ⇒ Boolean
42 43 44 45 46 |
# File 'lib/itunes_api/music/song.rb', line 42 def streamable? return false if streamable.nil? streamable end |
#to_hash ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# 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 |