Class: Spotted::Resources::Me::Tracks
- Inherits:
-
Object
- Object
- Spotted::Resources::Me::Tracks
- Defined in:
- lib/spotted/resources/me/tracks.rb
Instance Method Summary collapse
-
#check(ids: , request_options: {}) ⇒ Array<Boolean>
Some parameter documentations has been truncated, see Models::Me::TrackCheckParams for more details.
-
#initialize(client:) ⇒ Tracks
constructor
private
A new instance of Tracks.
-
#list(limit: nil, market: nil, offset: nil, request_options: {}) ⇒ Spotted::Internal::CursorURLPage<Spotted::Models::Me::TrackListResponse>
Some parameter documentations has been truncated, see Models::Me::TrackListParams for more details.
-
#remove(body_ids: nil, request_options: {}) ⇒ nil
Some parameter documentations has been truncated, see Models::Me::TrackRemoveParams for more details.
-
#save(ids: , timestamped_ids: nil, request_options: {}) ⇒ nil
Some parameter documentations has been truncated, see Models::Me::TrackSaveParams for more details.
Constructor Details
#initialize(client:) ⇒ Tracks
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Tracks.
115 116 117 |
# File 'lib/spotted/resources/me/tracks.rb', line 115 def initialize(client:) @client = client end |
Instance Method Details
#check(ids: , request_options: {}) ⇒ Array<Boolean>
Some parameter documentations has been truncated, see Models::Me::TrackCheckParams for more details.
Check if one or more tracks is already saved in the current Spotify user’s ‘Your Music’ library.
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/spotted/resources/me/tracks.rb', line 53 def check(params) parsed, = Spotted::Me::TrackCheckParams.dump_request(params) @client.request( method: :get, path: "me/tracks/contains", query: parsed, model: Spotted::Internal::Type::ArrayOf[Spotted::Internal::Type::Boolean], options: ) end |
#list(limit: nil, market: nil, offset: nil, request_options: {}) ⇒ Spotted::Internal::CursorURLPage<Spotted::Models::Me::TrackListResponse>
Some parameter documentations has been truncated, see Models::Me::TrackListParams for more details.
Get a list of the songs saved in the current Spotify user’s ‘Your Music’ library.
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/spotted/resources/me/tracks.rb', line 26 def list(params = {}) parsed, = Spotted::Me::TrackListParams.dump_request(params) @client.request( method: :get, path: "me/tracks", query: parsed, page: Spotted::Internal::CursorURLPage, model: Spotted::Models::Me::TrackListResponse, options: ) end |
#remove(body_ids: nil, request_options: {}) ⇒ nil
Some parameter documentations has been truncated, see Models::Me::TrackRemoveParams for more details.
Remove one or more tracks from the current user’s ‘Your Music’ library.
78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/spotted/resources/me/tracks.rb', line 78 def remove(params = {}) parsed, = Spotted::Me::TrackRemoveParams.dump_request(params) query_params = [:query_ids] @client.request( method: :delete, path: "me/tracks", query: parsed.slice(*query_params).transform_keys(query_ids: "ids"), body: parsed.except(*query_params), model: NilClass, options: ) end |
#save(ids: , timestamped_ids: nil, request_options: {}) ⇒ nil
Some parameter documentations has been truncated, see Models::Me::TrackSaveParams for more details.
Save one or more tracks to the current user’s ‘Your Music’ library.
107 108 109 110 |
# File 'lib/spotted/resources/me/tracks.rb', line 107 def save(params) parsed, = Spotted::Me::TrackSaveParams.dump_request(params) @client.request(method: :put, path: "me/tracks", body: parsed, model: NilClass, options: ) end |