class DataSift::Historics

Methods for using DataSift Historics

Public Instance Methods

delete(id) click to toggle source

Delete an Historics query

@param id [String] ID of the Historics query you need to delete

# File lib/historics.rb, line 96
def delete(id)
  params = { :id => id }
  requires params
  DataSift.request(:DELETE, 'historics/delete', @config, params)
end
get(max = 20, page = 1, with_estimate = 1) click to toggle source

Get details for a list of Historics within the given page constraints

@param max [Integer] Max number of Historics you wish to return per page @param page [Integer] Which page of results you need returned @param with_estimate [Boolean] 1 or 0 indicating whether you want to see

the estimated completion time of the Historics query
# File lib/historics.rb, line 119
def get(max = 20, page = 1, with_estimate = 1)
  params = { :max => max, :page => page, :with_estimate => with_estimate }
  requires params
  DataSift.request(:GET, 'historics/get', @config, params)
end
get_by_id(id, with_estimate = 1) click to toggle source

Get details for a given Historics query

@param id [String] ID of the Historics query you need to get @param with_estimate [Boolean] 1 or 0 indicating whether you want to see

the estimated completion time of the Historics query
# File lib/historics.rb, line 107
def get_by_id(id, with_estimate = 1)
  params = { :id => id, :with_estimate => with_estimate }
  requires params
  DataSift.request(:GET, 'historics/get', @config, params)
end
pause(id, reason = '') click to toggle source

Pause Historics query

@param id [String] ID of the Historics query you need to pause @param reason [String] You can give a reason for pausing the query

# File lib/historics.rb, line 33
def pause(id, reason = '')
  params = { :id => id }
  requires params
  params[:reason] = reason
  DataSift.request(:PUT, 'historics/pause', @config, params)
end
prepare(hash, start, end_time, name, sources = '', sample = 100) click to toggle source

Prepare a new Historics query

@param hash [String] Hash of compiled CSDL filter @param start [Integer] Start timestamp for your Historics Query. Should be

provided as a Unix timestamp

@param end_time [Integer] End timestamp for your Historics Query. Should

be provided as a Unix timestamp

@param name [String] The name of your Historics query @param sources [String] Comma separated list of data sources you wish to

query

@param sample [Integer] Sample size of your Historics query @return [Object] API reponse object

# File lib/historics.rb, line 16
def prepare(hash, start, end_time, name, sources = '', sample = 100)
  params = {
    :hash => hash,
    :start => start,
    :end => end_time,
    :name => name,
    :sources => sources,
    :sample => sample
  }
  requires params
  DataSift.request(:POST, 'historics/prepare', @config, params)
end
resume(id) click to toggle source

Resume Historics query

@param id [String] ID of the Historics query you need to resume

# File lib/historics.rb, line 43
def resume(id)
  params = { :id => id }
  requires params
  DataSift.request(:PUT, 'historics/resume', @config, params)
end
start(id) click to toggle source

Start Historics query

@param id [String] ID of the Historics query you need to start

# File lib/historics.rb, line 52
def start(id)
  params = { :id => id }
  requires params
  DataSift.request(:POST, 'historics/start', @config, params)
end
status(start, end_time, sources = '') click to toggle source

Check the data coverage in the archive for a specified interval

@param start [Integer] Start timestamp for the period you wish to query.

Should be provided as a Unix timestamp

@param end_time [Integer] End timestamp for the period you wish to query.

Should be provided as a Unix timestamp

@param sources [String] Comma separated list of data sources you wish to

query
# File lib/historics.rb, line 77
def status(start, end_time, sources = '')
  params = { :start => start, :end => end_time, :sources => sources }
  requires params
  DataSift.request(:GET, 'historics/status', @config, params)
end
stop(id, reason = '') click to toggle source

Stop Historics query

@param id [String] ID of the Historics query you need to stop @param reason [String] You can give a reason for stopping the query

# File lib/historics.rb, line 62
def stop(id, reason = '')
  params = { :id => id }
  requires params
  params[:reason] = reason
  DataSift.request(:POST, 'historics/stop', @config, params)
end
update(id, name) click to toggle source

Update the name of an Historics query

@param id [String] ID of the Historics query you need to update @param name [String] New name for the Historics query

# File lib/historics.rb, line 87
def update(id, name)
  params = { :id => id, :name => name }
  requires params
  DataSift.request(:POST, 'historics/update', @config, params)
end