Sha256: f2b546489ba70f4a2cd19164aa8690c54f0d58ec328972a386b0e57fa46cdf81
Contents?: true
Size: 1.18 KB
Versions: 3
Compression:
Stored size: 1.18 KB
Contents
require './auth' class AccountIdentityEg < DataSiftExample def initialize super @datasift = DataSift::Client.new(@config) run end def run begin puts "Create a new identity" identity = @datasift.account_identity.create( "Ruby Identity", "active", false ) identity_id = identity[:data][:id] puts identity.to_json puts "\nList all existing identities" puts @datasift.account_identity.list.to_json puts "\nGet existing identity" puts @datasift.account_identity.get(identity_id).to_json puts "\nUpdate an identity" puts @datasift.account_identity.update( identity_id, 'Updated Ruby Identity' ).to_json puts "\nDelete an identity" puts @datasift.account_identity.delete(identity_id).to_json rescue DataSiftError => dse puts dse.message # Then match specific error 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 AccountIdentityEg.new
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
datasift-3.4.0 | examples/account_identity_eg.rb |
datasift-3.3.0 | examples/account_identity_eg.rb |
datasift-3.2.0 | examples/account_identity_eg.rb |