class PlatformLib::MediaService
Public: A wrapper around the Media Data Service
Examples:
# the preferred method service = PlatformLib::DataService.new("user", "pass").media_service # direct instantiation service = PlatformLib::MediaService.new("auth_token")
Constants
- END_POINT
Public Class Methods
new(auth_token)
click to toggle source
Public: Creates a new instance
auth_token - the authentication token to be used
# File lib/platform_lib/media_service.rb, line 24 def initialize(auth_token) @auth_token = auth_token end
Public Instance Methods
get_media_items(params = {}, &block)
click to toggle source
Public: Queries the media end point
params - an optional hash of parameters (query string) block - an optional block to be called for each item returned
Examples:
items = media_service.get_media_items(range: "1-10") media_service.get_media_items(byCustomValue: "{test}{val}") do |item| puts item.title end
Returns the items supplied from the service
# File lib/platform_lib/media_service.rb, line 42 def get_media_items(params = {}, &block) if block.nil? get_entries(END_POINT, params) else get_entries(END_POINT, params, &block) end end
update_media_items(items, params)
click to toggle source
Public: Updates the supplied items and their properties using the PUT method
items - an array of items to be updated params - an optional hash of parameters (query string)
Example:
items = [ { id: "id_value", guid: "guid_value" }, .. ] media_service.update_media_items(items)
# File lib/platform_lib/media_service.rb, line 61 def update_media_items(items, params) put_entries("#{END_POINT}/list", params, items) end