PHP Class DataSift_Historic

This software is the intellectual property of MediaSift Ltd., and is covered by retained intellectual property rights, including copyright. Distribution of this software is strictly forbidden under the terms of this license. The DataSift_Historic class represents a historic query.
Author: Stuart Dallas ([email protected])
Mostra file Open project: datasift/datasift-php Class Usage Examples

Protected Properties

Property Type Description
$_availability Data availablility information.
$_created_at Historics query creation time
$_deleted Set to true if the Historics query has been deleted.
$_dpus Number of DPUs consumed
$_end End date and time
$_estimated_completion The estimated completion timestamp
$_hash The stream hash.
$_name Historics query name.
$_playback_id Playback ID
$_progress Progress counter
$_sample Sample size
$_sources Data sources.
$_start Start date and time
$_status Historics query status
$_user The user object.

Public Methods

Method Description
__construct ( DataSift_User $user, string $hash, integer $start = false, integer $end = false, array $sources = false, string $name = false, integer $sample = 100 ) Constructor. Pass all fields to create a new historic, or provide a User object and a playback_id as the $hash parameter to load an existing query from the API.
delete ( ) : void Delete this historic query.
getAvailability ( ) : array Returns the data availability information for this historic. If the historic has not yet been prepared that will be done automagically to obtain the cost.
getCreatedAt ( ) : integer Returns the created at date. To refresh this from the server call reloadData().
getDPUs ( ) : integer Returns the DPU cost of running this historic. If the historic has not yet been prepared that will be done automagically to obtain the cost.
getEndDate ( ) : integer Returns the end date.
getEstimatedCompletion ( ) : integer Returns the estimated completion in UTC timestamp
getHash ( ) : string Returns the playback ID for this historic. If the historic has not yet been prepared that will be done automagically to obtain the ID.
getName ( ) : string Returns the name.
getProgress ( ) : double Returns the current progress.
getPushSubscriptions ( DataSift_User $user, integer $page = 1, integer $per_page = 20, String $order_by = self::ORDERBY_CREATED_AT, String $order_dir = self::ORDERDIR_ASC, boolean $include_finished = false ) Get a page of push subscriptions for this historic query, where each page contains up to $per_page items. Results will be returned in the order requested.
getSample ( ) : double Returns the sample.
getSources ( ) : integer Returns the sources.
getStartDate ( ) : integer Returns the start date.
getStatus ( ) : string Returns the status. To refresh this from the server call reloadData().
getStreamHash ( ) : string Returns the stream hash.
listHistorics ( DataSift_User $user, integer $page = 1, integer $per_page = 20 ) List Historics queries.
pause ( string $reason = false ) : void Pause this historic query.
prepare ( ) : void Call the DataSift API to prepare this historic query.
reloadData ( ) Reload the data for this object from the API.
resume ( ) : void Resumes this historic query.
setName ( string $name ) : void Sets the name.
start ( ) : void Start this historic query.
stop ( ) : void Stop this historic query.

Protected Methods

Method Description
generateName ( ) : string Generate a name based on the current date/time.
initFromArray ( array $data ) Initialise this object from the data in the given array.

Method Details

__construct() public method

Constructor. Pass all fields to create a new historic, or provide a User object and a playback_id as the $hash parameter to load an existing query from the API.
public __construct ( DataSift_User $user, string $hash, integer $start = false, integer $end = false, array $sources = false, string $name = false, integer $sample = 100 )
$user DataSift_User The user object.
$hash string The stream hash for the query.
$start integer The start timestamp.
$end integer The end timestamp.
$sources array The interaction types to match.
$name string A name for this query.
$sample integer An optional sample rate for this query.

delete() public method

Delete this historic query.
public delete ( ) : void
return void

generateName() protected method

Generate a name based on the current date/time.
protected generateName ( ) : string
return string The generated name.

getAvailability() public method

Returns the data availability information for this historic. If the historic has not yet been prepared that will be done automagically to obtain the cost.
public getAvailability ( ) : array
return array The data availability.

getCreatedAt() public method

Returns the created at date. To refresh this from the server call reloadData().
public getCreatedAt ( ) : integer
return integer The created at date.

getDPUs() public method

Returns the DPU cost of running this historic. If the historic has not yet been prepared that will be done automagically to obtain the cost.
public getDPUs ( ) : integer
return integer The DPU cost.

getEndDate() public method

Returns the end date.
public getEndDate ( ) : integer
return integer The end date.

getEstimatedCompletion() public method

Returns the estimated completion in UTC timestamp
public getEstimatedCompletion ( ) : integer
return integer

getHash() public method

Returns the playback ID for this historic. If the historic has not yet been prepared that will be done automagically to obtain the ID.
public getHash ( ) : string
return string The playback ID.

getName() public method

Returns the name.
public getName ( ) : string
return string The name.

getProgress() public method

Returns the current progress.
public getProgress ( ) : double
return double The percent progress.

getPushSubscriptions() public method

Get a page of push subscriptions for this historic query, where each page contains up to $per_page items. Results will be returned in the order requested.
public getPushSubscriptions ( DataSift_User $user, integer $page = 1, integer $per_page = 20, String $order_by = self::ORDERBY_CREATED_AT, String $order_dir = self::ORDERDIR_ASC, boolean $include_finished = false )
$user DataSift_User The user object.
$page integer The page number to get.
$per_page integer The number of items per page.
$order_by String Which field to sort by.
$order_dir String In asc[ending] or desc[ending] order.
$include_finished boolean Set to true when you want to include finished subscription in the results.

getSample() public method

Returns the sample.
public getSample ( ) : double
return double The sample.

getSources() public method

Returns the sources.
public getSources ( ) : integer
return integer The start date.

getStartDate() public method

Returns the start date.
public getStartDate ( ) : integer
return integer The start date.

getStatus() public method

Returns the status. To refresh this from the server call reloadData().
public getStatus ( ) : string
return string The status.

getStreamHash() public method

Returns the stream hash.
public getStreamHash ( ) : string
return string The hash.

initFromArray() protected method

Initialise this object from the data in the given array.
protected initFromArray ( array $data )
$data array The array of data.

listHistorics() public static method

List Historics queries.
public static listHistorics ( DataSift_User $user, integer $page = 1, integer $per_page = 20 )
$user DataSift_User The user object.
$page integer The start page.
$per_page integer The start page.

pause() public method

Pause this historic query.
public pause ( string $reason = false ) : void
$reason string Your reason for pausing the Historics query.
return void

prepare() public method

Call the DataSift API to prepare this historic query.
public prepare ( ) : void
return void

reloadData() public method

Reload the data for this object from the API.
public reloadData ( )

resume() public method

Resumes this historic query.
public resume ( ) : void
return void

setName() public method

Sets the name.
public setName ( string $name ) : void
$name string The new name.
return void

start() public method

Start this historic query.
public start ( ) : void
return void

stop() public method

Stop this historic query.
public stop ( ) : void
return void

Property Details

$_availability protected_oe property

Data availablility information.
protected $_availability

$_created_at protected_oe property

Historics query creation time
protected $_created_at

$_deleted protected_oe property

Set to true if the Historics query has been deleted.
protected $_deleted

$_dpus protected_oe property

Number of DPUs consumed
protected $_dpus

$_end protected_oe property

End date and time
protected $_end

$_estimated_completion protected_oe property

The estimated completion timestamp
protected $_estimated_completion

$_hash protected_oe property

The stream hash.
protected $_hash

$_name protected_oe property

Historics query name.
protected $_name

$_playback_id protected_oe property

Playback ID
protected $_playback_id

$_progress protected_oe property

Progress counter
protected $_progress

$_sample protected_oe property

Sample size
protected $_sample

$_sources protected_oe property

Data sources.
protected $_sources

$_start protected_oe property

Start date and time
protected $_start

$_status protected_oe property

Historics query status
protected $_status

$_user protected_oe property

The user object.
protected $_user