Class: SpotifyWebApi::PlaylistsTracksRequest1

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/spotify_web_api/models/playlists_tracks_request1.rb

Overview

PlaylistsTracksRequest1 Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(uris = SKIP, range_start = SKIP, insert_before = SKIP, range_length = SKIP, snapshot_id = SKIP) ⇒ PlaylistsTracksRequest1

Returns a new instance of PlaylistsTracksRequest1.



69
70
71
72
73
74
75
76
# File 'lib/spotify_web_api/models/playlists_tracks_request1.rb', line 69

def initialize(uris = SKIP, range_start = SKIP, insert_before = SKIP,
               range_length = SKIP, snapshot_id = SKIP)
  @uris = uris unless uris == SKIP
  @range_start = range_start unless range_start == SKIP
  @insert_before = insert_before unless insert_before == SKIP
  @range_length = range_length unless range_length == SKIP
  @snapshot_id = snapshot_id unless snapshot_id == SKIP
end

Instance Attribute Details

#insert_beforeInteger

The position where the items should be inserted.<br/>To reorder the items to the end of the playlist, simply set insert_before to the position after the last item.<br/>Examples:<br/>To reorder the first item to the last position in a playlist with 10 items, set range_start to 0, and insert_before to 10.<br/>To reorder the last item in a playlist with 10 items to the start of the playlist, set range_start to 9, and insert_before to 0.

Returns:

  • (Integer)


28
29
30
# File 'lib/spotify_web_api/models/playlists_tracks_request1.rb', line 28

def insert_before
  @insert_before
end

#range_lengthInteger

The amount of items to be reordered. Defaults to 1 if not set.<br/>The range of items to be reordered begins from the range_start position, and includes the range_length subsequent items.<br/>Example:<br/>To move the items at index 9-10 to the start of the playlist, range_start is set to 9, and range_length is set to 2.

Returns:

  • (Integer)


36
37
38
# File 'lib/spotify_web_api/models/playlists_tracks_request1.rb', line 36

def range_length
  @range_length
end

#range_startInteger

The position of the first item to be reordered.

Returns:

  • (Integer)


18
19
20
# File 'lib/spotify_web_api/models/playlists_tracks_request1.rb', line 18

def range_start
  @range_start
end

#snapshot_idString

The playlist’s snapshot ID against which you want to make the changes.

Returns:

  • (String)


40
41
42
# File 'lib/spotify_web_api/models/playlists_tracks_request1.rb', line 40

def snapshot_id
  @snapshot_id
end

#urisArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


14
15
16
# File 'lib/spotify_web_api/models/playlists_tracks_request1.rb', line 14

def uris
  @uris
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/spotify_web_api/models/playlists_tracks_request1.rb', line 79

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  uris = hash.key?('uris') ? hash['uris'] : SKIP
  range_start = hash.key?('range_start') ? hash['range_start'] : SKIP
  insert_before = hash.key?('insert_before') ? hash['insert_before'] : SKIP
  range_length = hash.key?('range_length') ? hash['range_length'] : SKIP
  snapshot_id = hash.key?('snapshot_id') ? hash['snapshot_id'] : SKIP

  # Create object from extracted values.
  PlaylistsTracksRequest1.new(uris,
                              range_start,
                              insert_before,
                              range_length,
                              snapshot_id)
end

.namesObject

A mapping from model property names to API property names.



43
44
45
46
47
48
49
50
51
# File 'lib/spotify_web_api/models/playlists_tracks_request1.rb', line 43

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['uris'] = 'uris'
  @_hash['range_start'] = 'range_start'
  @_hash['insert_before'] = 'insert_before'
  @_hash['range_length'] = 'range_length'
  @_hash['snapshot_id'] = 'snapshot_id'
  @_hash
end

.nullablesObject

An array for nullable fields



65
66
67
# File 'lib/spotify_web_api/models/playlists_tracks_request1.rb', line 65

def self.nullables
  []
end

.optionalsObject

An array for optional fields



54
55
56
57
58
59
60
61
62
# File 'lib/spotify_web_api/models/playlists_tracks_request1.rb', line 54

def self.optionals
  %w[
    uris
    range_start
    insert_before
    range_length
    snapshot_id
  ]
end