Class: Caldera::Model::LoadTracks

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/caldera/model/load_tracks.rb

Overview

Represents the struct returned from Client#load_tracks

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ LoadTracks

Returns a new instance of LoadTracks.



18
19
20
21
22
23
24
# File 'lib/caldera/model/load_tracks.rb', line 18

def initialize(data)
  playlist_info = data['playlistInfo']

  @playlist_info = PlaylistInfo.new(playlist_info) if playlist_info
  @tracks = data['tracks'].collect { |track_data| Model::Track.new(track_data) }
  @load_type = data['loadType'].to_sym
end

Instance Attribute Details

#load_type:TRACK_LOADED, ... (readonly)

Returns:

  • (:TRACK_LOADED, :PLAYLIST_LOADED, :SEARCH_RESULT, :NO_MATCHES, :LOAD_FAILED)


16
17
18
# File 'lib/caldera/model/load_tracks.rb', line 16

def load_type
  @load_type
end

#playlist_infoPlaylistInfo (readonly)

Returns:



10
11
12
# File 'lib/caldera/model/load_tracks.rb', line 10

def playlist_info
  @playlist_info
end

#tracksArray<Track> (readonly)

Returns:



13
14
15
# File 'lib/caldera/model/load_tracks.rb', line 13

def tracks
  @tracks
end

Instance Method Details

#each {|| ... } ⇒ Object

Operate on each track.

Yield Parameters:



28
29
30
# File 'lib/caldera/model/load_tracks.rb', line 28

def each(&block)
  @tracks.each(&block)
end