Sha256: 3baa8b5d6b29e9481095cc6767ac97025ae9c6df1b787f158fc0d4cb96f0f3bd
Contents?: true
Size: 1.16 KB
Versions: 3
Compression:
Stored size: 1.16 KB
Contents
require './auth' class CoreApiEg < DataSiftExample def initialize super @datasift = DataSift::Client.new(@config) run end def run begin csdl = 'interaction.content contains "test"' # see docs at http://dev.datasift.com/docs/rest-api/validate puts @datasift.valid? csdl # http://dev.datasift.com/docs/rest-api/compile stream = @datasift.compile csdl puts stream[:data][:hash] # http://dev.datasift.com/docs/rest-api/dpu dpu = @datasift.dpu stream[:data][:hash] puts dpu[:data][:dpu] # http://dev.datasift.com/docs/rest-api/balance balance = @datasift.balance puts balance[:data] #http://dev.datasift.com/docs/rest-api/usage usage = @datasift.usage puts usage[:data] #rescue DataSiftError rescue DataSiftError => dse puts dse.message # Then match specific one to take action - All errors thrown by the client extend DataSiftError case dse when ConnectionError # some connection error when AuthError when BadRequestError else # do something else... end end end end CoreApiEg.new
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
datasift-3.0.0.beta4 | examples/core_api_eg.rb |
datasift-3.0.0.beta2 | examples/core_api_eg.rb |
datasift-3.0.0.beta | examples/core_api_eg.rb |