Class: SpotifyWebApi::UsersPlaylistsRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- SpotifyWebApi::UsersPlaylistsRequest
- Defined in:
- lib/spotify_web_api/models/users_playlists_request.rb
Overview
UsersPlaylistsRequest Model.
Instance Attribute Summary collapse
-
#collaborative ⇒ TrueClass | FalseClass
Defaults to
false. -
#description ⇒ String
value for playlist description as displayed in Spotify Clients and in the Web API.
-
#name ⇒ String
The name for the new playlist, for example ‘“Your Coolest Playlist”`.
-
#public ⇒ TrueClass | FalseClass
Defaults to
true.
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 = nil, public = SKIP, collaborative = SKIP, description = SKIP) ⇒ UsersPlaylistsRequest
constructor
A new instance of UsersPlaylistsRequest.
Methods inherited from BaseModel
Constructor Details
#initialize(name = nil, public = SKIP, collaborative = SKIP, description = SKIP) ⇒ UsersPlaylistsRequest
Returns a new instance of UsersPlaylistsRequest.
62 63 64 65 66 67 68 |
# File 'lib/spotify_web_api/models/users_playlists_request.rb', line 62 def initialize(name = nil, public = SKIP, collaborative = SKIP, description = SKIP) @name = name @public = public unless public == SKIP @collaborative = collaborative unless collaborative == SKIP @description = description unless description == SKIP end |
Instance Attribute Details
#collaborative ⇒ TrueClass | FalseClass
Defaults to false. If true the playlist will be collaborative. _Note: to create a collaborative playlist you must also set public to false. To create collaborative playlists you must have granted playlist-modify-private and playlist-modify-public [scopes](/documentation/web-api/concepts/scopes/#list-of-scopes)._
31 32 33 |
# File 'lib/spotify_web_api/models/users_playlists_request.rb', line 31 def collaborative @collaborative end |
#description ⇒ String
value for playlist description as displayed in Spotify Clients and in the Web API.
36 37 38 |
# File 'lib/spotify_web_api/models/users_playlists_request.rb', line 36 def description @description end |
#name ⇒ String
The name for the new playlist, for example ‘“Your Coolest Playlist”`. This name does not need to be unique; a user may have several playlists with the same name.
16 17 18 |
# File 'lib/spotify_web_api/models/users_playlists_request.rb', line 16 def name @name end |
#public ⇒ TrueClass | FalseClass
Defaults to true. If true the playlist will be public, if false it will be private. To be able to create private playlists, the user must have granted the playlist-modify-private [scope](/documentation/web-api/concepts/scopes/#list-of-scopes)
23 24 25 |
# File 'lib/spotify_web_api/models/users_playlists_request.rb', line 23 def public @public end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/spotify_web_api/models/users_playlists_request.rb', line 71 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. name = hash.key?('name') ? hash['name'] : nil 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. UsersPlaylistsRequest.new(name, public, collaborative, description) end |
.names ⇒ Object
A mapping from model property names to API property names.
39 40 41 42 43 44 45 46 |
# File 'lib/spotify_web_api/models/users_playlists_request.rb', line 39 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
58 59 60 |
# File 'lib/spotify_web_api/models/users_playlists_request.rb', line 58 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
49 50 51 52 53 54 55 |
# File 'lib/spotify_web_api/models/users_playlists_request.rb', line 49 def self.optionals %w[ public collaborative description ] end |