Sha256: c71d92af5cf7613a02400bda53f2abc697973bbdecfd85c19a6defa61d279282

Contents?: true

Size: 859 Bytes

Versions: 9

Compression:

Stored size: 859 Bytes

Contents

require './auth'
class HistoricsPreviewApi < DataSiftExample
  def initialize
    super
    run
  end

  def run
    begin
      puts 'Creating hash'
      stream = @datasift.compile 'interaction.content contains "datasift"'
      hash   = stream[:data][:hash]

      puts "\nCreating a preview"
      # see http://dev.datasift.com/docs/rest-api/previewcreate for docs
      sources    = 'facebook,twitter'
      parameters = 'interaction.author.link,targetVol,hour;interaction.type,freqDist,10'
      start      = Time.now.to_i - (3600 * 48) # 48hrs ago
      source     = @datasift.historics_preview.create(hash, sources, parameters, start)
      puts source

      puts "\nGetting preview data"
      puts @datasift.historics_preview.get source[:data][:id]

    rescue DataSiftError => dse
      puts dse.message
    end
  end
end

HistoricsPreviewApi.new

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
datasift-3.2.0 examples/historics_preview_eg.rb
datasift-3.1.5 examples/historics_preview_eg.rb
datasift-3.1.4 examples/historics_preview_eg.rb
datasift-3.1.3 examples/historics_preview_eg.rb
datasift-3.1.2 examples/historics_preview_eg.rb
datasift-3.1.1 examples/historics_preview_eg.rb
datasift-3.1.0 examples/historics_preview_eg.rb
datasift-3.0.1 examples/historics_preview_eg.rb
datasift-3.0.0 examples/historics_preview_eg.rb