Class: SpotifyWebApi::PlaylistsRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- SpotifyWebApi::PlaylistsRequest
- Defined in:
- lib/spotify_web_api/models/playlists_request.rb
Overview
PlaylistsRequest Model.
Instance Attribute Summary collapse
-
#collaborative ⇒ TrueClass | FalseClass
If ‘true`, the playlist will become collaborative and other users will be able to modify the playlist in their Spotify client.
-
#description ⇒ String
Value for playlist description as displayed in Spotify Clients and in the Web API.
-
#name ⇒ String
The new name for the playlist, for example ‘“My New Playlist Title”`.
-
#public ⇒ TrueClass | FalseClass
If ‘true` the playlist will be public, if `false` it will be private.
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(name = SKIP, public = SKIP, collaborative = SKIP, description = SKIP) ⇒ PlaylistsRequest
constructor
A new instance of PlaylistsRequest.
Methods inherited from BaseModel
Constructor Details
#initialize(name = SKIP, public = SKIP, collaborative = SKIP, description = SKIP) ⇒ PlaylistsRequest
Returns a new instance of PlaylistsRequest.
57 58 59 60 61 62 63 |
# File 'lib/spotify_web_api/models/playlists_request.rb', line 57 def initialize(name = SKIP, public = SKIP, collaborative = SKIP, description = SKIP) @name = name unless name == SKIP @public = public unless public == SKIP @collaborative = collaborative unless collaborative == SKIP @description = description unless description == SKIP end |
Instance Attribute Details
#collaborative ⇒ TrueClass | FalseClass
If ‘true`, the playlist will become collaborative and other users will be able to modify the playlist in their Spotify client. <br/> _Note: You can only set `collaborative` to `true` on non-public playlists._
25 26 27 |
# File 'lib/spotify_web_api/models/playlists_request.rb', line 25 def collaborative @collaborative end |
#description ⇒ String
Value for playlist description as displayed in Spotify Clients and in the Web API.
30 31 32 |
# File 'lib/spotify_web_api/models/playlists_request.rb', line 30 def description @description end |
#name ⇒ String
The new name for the playlist, for example ‘“My New Playlist Title”`
14 15 16 |
# File 'lib/spotify_web_api/models/playlists_request.rb', line 14 def name @name end |
#public ⇒ TrueClass | FalseClass
If ‘true` the playlist will be public, if `false` it will be private.
18 19 20 |
# File 'lib/spotify_web_api/models/playlists_request.rb', line 18 def public @public end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/spotify_web_api/models/playlists_request.rb', line 66 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. name = hash.key?('name') ? hash['name'] : SKIP public = hash.key?('public') ? hash['public'] : SKIP collaborative = hash.key?('collaborative') ? hash['collaborative'] : SKIP description = hash.key?('description') ? hash['description'] : SKIP # Create object from extracted values. PlaylistsRequest.new(name, public, collaborative, description) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 |
# File 'lib/spotify_web_api/models/playlists_request.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['name'] = 'name' @_hash['public'] = 'public' @_hash['collaborative'] = 'collaborative' @_hash['description'] = 'description' @_hash end |
.nullables ⇒ Object
An array for nullable fields
53 54 55 |
# File 'lib/spotify_web_api/models/playlists_request.rb', line 53 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
43 44 45 46 47 48 49 50 |
# File 'lib/spotify_web_api/models/playlists_request.rb', line 43 def self.optionals %w[ name public collaborative description ] end |