Class: SpotifyWebApi::PlaylistsTracksRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- SpotifyWebApi::PlaylistsTracksRequest
- Defined in:
- lib/spotify_web_api/models/playlists_tracks_request.rb
Overview
PlaylistsTracksRequest Model.
Instance Attribute Summary collapse
-
#position ⇒ Integer
The position to insert the items, a zero-based index.
-
#uris ⇒ Array[String]
A JSON array of the [Spotify URIs](/documentation/web-api/concepts/spotify-uris-ids) to add.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(uris = SKIP, position = SKIP) ⇒ PlaylistsTracksRequest
constructor
A new instance of PlaylistsTracksRequest.
Methods inherited from BaseModel
Constructor Details
#initialize(uris = SKIP, position = SKIP) ⇒ PlaylistsTracksRequest
Returns a new instance of PlaylistsTracksRequest.
54 55 56 57 |
# File 'lib/spotify_web_api/models/playlists_tracks_request.rb', line 54 def initialize(uris = SKIP, position = SKIP) @uris = uris unless uris == SKIP @position = position unless position == SKIP end |
Instance Attribute Details
#position ⇒ Integer
The position to insert the items, a zero-based index. For example, to insert the items in the first position: ‘position=0` ; to insert the items in the third position: `position=2`. If omitted, the items will be appended to the playlist. Items are added in the order they appear in the uris array. For example: `[“spotify:track:4iV5W9uYEdYUVa79Axb7Rh”,“spotify:track:1301WleyT98MSxVHPZC A6M”], “position”: 3`
31 32 33 |
# File 'lib/spotify_web_api/models/playlists_tracks_request.rb', line 31 def position @position end |
#uris ⇒ Array[String]
A JSON array of the [Spotify URIs](/documentation/web-api/concepts/spotify-uris-ids) to add. For example: ‘[“spotify:track:4iV5W9uYEdYUVa79Axb7Rh”,“spotify:track:1301WleyT98MSxVHPZC A6M”, “spotify:episode:512ojhOuo1ktJprKbVcKyQ”]`<br/>A maximum of 100 items can be added in one request. _Note: if the `uris` parameter is present in the query string, any URIs listed here in the body will be ignored._
21 22 23 |
# File 'lib/spotify_web_api/models/playlists_tracks_request.rb', line 21 def uris @uris end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/spotify_web_api/models/playlists_tracks_request.rb', line 60 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. uris = hash.key?('uris') ? hash['uris'] : SKIP position = hash.key?('position') ? hash['position'] : SKIP # Create object from extracted values. PlaylistsTracksRequest.new(uris, position) end |
.names ⇒ Object
A mapping from model property names to API property names.
34 35 36 37 38 39 |
# File 'lib/spotify_web_api/models/playlists_tracks_request.rb', line 34 def self.names @_hash = {} if @_hash.nil? @_hash['uris'] = 'uris' @_hash['position'] = 'position' @_hash end |
.nullables ⇒ Object
An array for nullable fields
50 51 52 |
# File 'lib/spotify_web_api/models/playlists_tracks_request.rb', line 50 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
42 43 44 45 46 47 |
# File 'lib/spotify_web_api/models/playlists_tracks_request.rb', line 42 def self.optionals %w[ uris position ] end |