Class: Rocksky::Resources::Song
- Defined in:
- lib/rocksky/resources/song.rb
Overview
‘app.rocksky.song.*` endpoints.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#create_song(title:, artist:, **extra) ⇒ Object
Create a song.
-
#get_song(uri: nil, mbid: nil, isrc: nil, spotify_id: nil) ⇒ Object
Fetch a song by URI, MusicBrainz id, ISRC, or Spotify id.
-
#get_song_recent_listeners(uri:, limit: nil, offset: nil) ⇒ Object
Recent listeners for a song.
-
#get_songs(limit: nil, offset: nil, genre: nil, mbid: nil, isrc: nil, spotify_id: nil) ⇒ Object
List songs.
-
#match_song(title:, artist:, mb_id: nil, isrc: nil) ⇒ Object
Find an existing song by metadata.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Rocksky::Resources::Base
Instance Method Details
#create_song(title:, artist:, **extra) ⇒ Object
Create a song.
32 33 34 35 |
# File 'lib/rocksky/resources/song.rb', line 32 def create_song(title:, artist:, **extra) body = { title: title, artist: artist }.merge(extra).compact procedure("app.rocksky.song.createSong", body: body) end |
#get_song(uri: nil, mbid: nil, isrc: nil, spotify_id: nil) ⇒ Object
Fetch a song by URI, MusicBrainz id, ISRC, or Spotify id.
6 7 8 9 |
# File 'lib/rocksky/resources/song.rb', line 6 def get_song(uri: nil, mbid: nil, isrc: nil, spotify_id: nil) query("app.rocksky.song.getSong", uri: uri, mbid: mbid, isrc: isrc, spotifyId: spotify_id) end |
#get_song_recent_listeners(uri:, limit: nil, offset: nil) ⇒ Object
Recent listeners for a song.
20 21 22 23 |
# File 'lib/rocksky/resources/song.rb', line 20 def get_song_recent_listeners(uri:, limit: nil, offset: nil) query("app.rocksky.song.getSongRecentListeners", uri: uri, limit: limit, offset: offset) end |
#get_songs(limit: nil, offset: nil, genre: nil, mbid: nil, isrc: nil, spotify_id: nil) ⇒ Object
List songs.
12 13 14 15 16 17 |
# File 'lib/rocksky/resources/song.rb', line 12 def get_songs(limit: nil, offset: nil, genre: nil, mbid: nil, isrc: nil, spotify_id: nil) query("app.rocksky.song.getSongs", limit: limit, offset: offset, genre: genre, mbid: mbid, isrc: isrc, spotifyId: spotify_id) end |
#match_song(title:, artist:, mb_id: nil, isrc: nil) ⇒ Object
Find an existing song by metadata.
26 27 28 29 |
# File 'lib/rocksky/resources/song.rb', line 26 def match_song(title:, artist:, mb_id: nil, isrc: nil) query("app.rocksky.song.matchSong", title: title, artist: artist, mbId: mb_id, isrc: isrc) end |