Sha256: 4fd4758f36b6995472ffc383ce4502964783d8a6b9d2b523bef184f73db602d6

Contents?: true

Size: 849 Bytes

Versions: 11

Compression:

Stored size: 849 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    = 'tumblr'
      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

11 entries across 11 versions & 1 rubygems

Version Path
datasift-3.7.2 examples/historics_preview_eg.rb
datasift-3.5.2 examples/historics_preview_eg.rb
datasift-3.5.1 examples/historics_preview_eg.rb
datasift-3.7.1 examples/historics_preview_eg.rb
datasift-3.7.0 examples/historics_preview_eg.rb
datasift-3.6.2 examples/historics_preview_eg.rb
datasift-3.6.1 examples/historics_preview_eg.rb
datasift-3.6.0 examples/historics_preview_eg.rb
datasift-3.5.0 examples/historics_preview_eg.rb
datasift-3.4.0 examples/historics_preview_eg.rb
datasift-3.3.0 examples/historics_preview_eg.rb