Class: SpotifyWebApi::MePlayerRequest
- Defined in:
- lib/spotify_web_api/models/me_player_request.rb
Overview
MePlayerRequest Model.
Instance Attribute Summary collapse
-
#device_ids ⇒ Array[String]
A JSON array containing the ID of the device on which playback should be started/transferred.<br/>For example:‘"74ASZWbe4lXaubB36ztrGX"`<br/>_Note: Although an array is accepted, only a single device_id is currently supported.
-
#play ⇒ TrueClass | FalseClass
true: ensure playback happens on new device.<br/>false or not provided: keep the current playback state.
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(device_ids = nil, play = SKIP) ⇒ MePlayerRequest
constructor
A new instance of MePlayerRequest.
Methods inherited from BaseModel
Constructor Details
#initialize(device_ids = nil, play = SKIP) ⇒ MePlayerRequest
Returns a new instance of MePlayerRequest.
45 46 47 48 |
# File 'lib/spotify_web_api/models/me_player_request.rb', line 45 def initialize(device_ids = nil, play = SKIP) @device_ids = device_ids @play = play unless play == SKIP end |
Instance Attribute Details
#device_ids ⇒ Array[String]
A JSON array containing the ID of the device on which playback should be started/transferred.<br/>For example:‘"74ASZWbe4lXaubB36ztrGX"`<br/>_Note: Although an array is accepted, only a single device_id is currently supported. Supplying more than one will return `400 Bad Request`_
18 19 20 |
# File 'lib/spotify_web_api/models/me_player_request.rb', line 18 def device_ids @device_ids end |
#play ⇒ TrueClass | FalseClass
true: ensure playback happens on new device.<br/>false or not provided: keep the current playback state.
23 24 25 |
# File 'lib/spotify_web_api/models/me_player_request.rb', line 23 def play @play end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/spotify_web_api/models/me_player_request.rb', line 51 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. device_ids = hash.key?('device_ids') ? hash['device_ids'] : nil play = hash.key?('play') ? hash['play'] : SKIP # Create object from extracted values. MePlayerRequest.new(device_ids, play) end |
.names ⇒ Object
A mapping from model property names to API property names.
26 27 28 29 30 31 |
# File 'lib/spotify_web_api/models/me_player_request.rb', line 26 def self.names @_hash = {} if @_hash.nil? @_hash['device_ids'] = 'device_ids' @_hash['play'] = 'play' @_hash end |
.nullables ⇒ Object
An array for nullable fields
41 42 43 |
# File 'lib/spotify_web_api/models/me_player_request.rb', line 41 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
34 35 36 37 38 |
# File 'lib/spotify_web_api/models/me_player_request.rb', line 34 def self.optionals %w[ play ] end |