Class: Kaltura::Service::DataService

Inherits:
BaseService show all
Defined in:
lib/kaltura/service/data_service.rb

Overview

The Data Service allows you to add and manage texual content.

Examples:

Creating a new DataEntry:

new_data_entry = Kaltura::DataEntry.new
new_data_entry.name = "pancake"
new_data_entry.data_content = "We all know  that waffles are better.  But the documentation author is tired."
client.data_entry_service.add(new_data_entry)

Retrieve a DataEntry:

client.data_entry_service.get('1_ad342xk')

Update a DataEntry:

update_entry = Kaltura::DataEntry.new
update_entry.data_content = 'Ninjas <3 waffles.  Pirates love the pancakes.'
client.data_entry_service.update('1_ad342xk',update_entry)

Delete a DataEntry:

client.data_entry_service.delete('1_ad342xk')

Filter DataEntries by group ID 2:

filter = Kaltura::Filter::DataEntryFilter.new
filter.group_id_equal = '2'
client.data_entry_service.list(filter)

Instance Attribute Summary

Attributes inherited from BaseService

#client

Instance Method Summary collapse

Methods inherited from BaseService

#initialize, #perform_request

Constructor Details

This class inherits a constructor from Kaltura::Service::BaseService

Instance Method Details

#add(data_entry) ⇒ Kaltura::DataEntry

Adds a new data entry.

Parameters:

  • data_entry (Kaltura::DataEntry)

    This is essentially a BaseEntry except there is a field called data_content. Presumably you shove text into this field.

Returns:

Raises:



40
41
42
43
44
# File 'lib/kaltura/service/data_service.rb', line 40

def add(data_entry)
	kparams = {}
	client.add_param(kparams, 'dataEntry', data_entry)
	perform_request('data','add',kparams,false)
end

#delete(entry_id) ⇒ nil

Removes a DataEntry object.

Parameters:

  • entry_id (String)

    the DataEntry to delete.

Returns:

  • (nil)

    Returns nothing.

Raises:

  • (Kaltura::APIError)

    Raises the default Kaltura errors in addition to ‘ENTRY_ID_NOT_FOUND’.



92
93
94
95
96
# File 'lib/kaltura/service/data_service.rb', line 92

def delete(entry_id)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id)
	perform_request('data','delete',kparams,false)
end

#get(entry_id, version = -1)) ⇒ Kaltura::DataEntry

Gets a data entry by ID.

Parameters:

  • entry_id (String)

    the DataEntry id.

  • version (Integer) (defaults to: -1))

    Version of the DataEntry.

Returns:

Raises:

  • (Kaltura::APIError)

    Raises the default Kaltura errors in addition to ‘ENTRY_ID_NOT_FOUND’.



56
57
58
59
60
61
# File 'lib/kaltura/service/data_service.rb', line 56

def get(entry_id, version=-1)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id)
	client.add_param(kparams, 'version', version)
	perform_request('data','get',kparams,false)
end

#list(filter = nil, pager = nil) ⇒ Kaltura::Response::DataListResponse

Lists DataEntry objects with the given filter and paging support for larger sets of data.

Parameters:

Returns:

Raises:



108
109
110
111
112
113
# File 'lib/kaltura/service/data_service.rb', line 108

def list(filter=nil, pager=nil)
	kparams = {}
	client.add_param(kparams, 'filter', filter)
	client.add_param(kparams, 'pager', pager)
	perform_request('data','list',kparams,false)
end

#update(entry_id, document_entry) ⇒ Kaltura::DataEntry

Updates a data entry. As with other update actions, the best practice is to instantiate a new Kaltura::DataEntry object and set the fields of that object that you wish to change.

Parameters:

  • entry_id (String)

    The DataEntry you wish to update.

  • document_entry (Kaltura::DataEntry)

    A newly instantiated DataEntry object with only the fields that you wish to update filled in.

Returns:

  • (Kaltura::DataEntry)

    Returns the updated DataEntry object complete with a version bump.

Raises:

  • (Kaltura::APIError)

    Raises the default Kaltura errors in addition to ‘ENTRY_ID_NOT_FOUND’.



76
77
78
79
80
81
# File 'lib/kaltura/service/data_service.rb', line 76

def update(entry_id, document_entry)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id)
	client.add_param(kparams, 'documentEntry', document_entry)
	perform_request('data','update',kparams,false)
end