Playlist

Class: Playlist

Version 1.6 - Updated on 03/23/2017

Contents

Constructor Details

#initialize(session) ⇒ Playlist

————————————————- Playlist functions —————————————–

def initialize(session)  
  # Instance variables  
  @session = session  
end

Instance Method Details

add_playlist_item

#add_playlist_item(playlistUid, playlistitemdata) ⇒ Object

Adds items to the playlist.

  • Arguments:

    • playlistid: The ID of the playlist to which items are to be added.
    • playlistitemdata: playlist item data in the json format.
  • Returns:

    • A hash object.
def add_playlist_item(playlistUid,playlistitemdata)
  params = playlistitemdata
  headers = {'Content-Type' => 'application/json'}
  response = @session.do_post "playlists/#{playlistUid}/items", params, headers
  Sdk::parse_response(response,raw=true)
end

create_playlist

#create_playlist(playlistdata) ⇒ Object

Creates a playlist.

  • Arguments:

    • playlistdata: Playlist data in the json format.
  • Returns:

    • A Hash object.
def create_playlist(playlistdata)
  params = playlistdata
  headers = {'Content-Type' => 'application/json'}
  response = @session.do_post "playlists", params, headers
  Sdk::parse_response(response)
end

deletePlaylist

#deletePlaylist(playlistUid) ⇒ Object

Deletes a playlist.

  • Arguments:

    • playlistUid: Id of the playlist
  • Returns:

    • A Hash object.
def deletePlaylist(playlistUid)
  response = @session.do_delete_without_params "playlists/#{playlistUid}"
  Sdk::parse_response(response, raw=true)
end

deletePlaylistItem

#deletePlaylistItem(playlistUid, itemUid) ⇒ Object

Deletes an item from a playlist.

  • Arguments:

    • playlistUid: ID of the playlist
    • itemUid: ID of the item to be deleted
  • Returns:

    • A Hash object.
def deletePlaylistItem(playlistUid, itemUid)
  response = @session.do_delete_without_params "playlists/#{playlistUid}/items/#{itemUid}"
  Sdk::parse_response(response, raw=true)
end

playlistContent

#playlistContent(playlistUid, itemUid) ⇒ Object

Retrieves the content of a playlist.

  • Arguments:

    • playlistUid: ID of the playlist.
    • itemUid: ID of the item in the playlist
  • Returns:

    • A Hash object.
def playlistContent(playlistUid,itemUid)
  response = @session.do_get_without_params "playlists/#{playlistUid}/items/#{itemUid}"
  Sdk::parse_response(response, raw=true)
end

playlistDefinition

#playlistDefinition(playlistUid) ⇒ Object

Retrieves playlist definition.

  • Arguments:

    • playlistUid: ID of the playlist.
    • start: start of the playlist.
    • count: count of playlist.
    • sort: sorting of playlist.
  • Returns:

    • A Hash object.
def playlistDefinition(playlistUid)
  response = @session.do_get_without_params "playlists/#{playlistUid}"
  Sdk::parse_response(response)
end

playlistItems

#playlistItems(playlistUid, start = "", count = "", sort = 'name+asc') ⇒ Object

Retrieves items from a playlist.

  • Arguments:

    • playlistUid: ID of the playlist.
    • start: start of the playlist.
    • count: count of the playlist.
    • sort: sorting of playlist.
  • Returns:

    • A Hash object.
def playlistItems(playlistUid, start="", count="", sort='name+asc')
  params = {
 "start" => start,
    "count" => count,
    "sort" => sort.to_s
  }
  response = @session.do_get "playlists/#{playlistUid}/items", params
  Sdk::parse_response(response)
end

playlists

#playlists(type = "", start = "", count = "", sort = 'name+asc') ⇒ Object

Retrieves a playlist.

  • Arguments:

    • type: type of the playlist.
    • start: start of the playlist.
    • count: count of the playlist.
    • sort: sorting of the playlist.
  • Returns:

    • A Hash object.
def playlists(type = "", start="", count="", sort='name+asc')
  params = {
    "type" => type.to_s,
 "start" => start,
    "count" => count,
    "sort" => sort.to_s
  }
  response = @session.do_get "playlists", params
  Sdk::parse_response(response)
end

update_playlist

#update_playlist(playlistUid, playlistupdateData) ⇒ Object

Updates a playlist.

  • Arguments:

    • playlistid: ID of the playlist
    • playlistupdateData: data in json format to be updated.
  • Returns:

    • A hash object.
def update_playlist(playlistUid,playlistupdateData)
  params = playlistupdateData
  headers = {'Content-Type' => 'application/json'}
  response = @session.do_put "playlists/#{playlistUid}", params, headers
  Sdk::parse_response(response,raw=true)
end

update_playlist_items

#update_playlist_items(playlistUid, updateplaylistdata) ⇒ Object

Updates playlist item definition.

  • Arguments:

    • playlistUid: ID of the playlist
    • updateplaylistdata: items data in json format to be updated.
  • Returns:

    • A hash object.
def update_playlist_items(playlistUid,updateplaylistdata)
  params = updateplaylistdata
  headers = {'Content-Type' => 'application/json'}
  response = @session.do_put "playlists/#{playlistUid}/items", params, headers
  Sdk::parse_response(response)
end

Copyright © 2015-2017, Verizon and/or its Licensors. All rights reserved.