Sha256: 2e56d4c8e082997491897e2b6016e4eb754de4beee3d9c38f0cbda833d490d48
Contents?: true
Size: 1.7 KB
Versions: 3
Compression:
Stored size: 1.7 KB
Contents
require './auth' class AccountIdentityLimitEg < DataSiftExample def initialize super @datasift = DataSift::Client.new(@config) run end def run begin puts "Create a new identity to apply Limits to" identity = @datasift.account_identity.create( "Ruby Identity for Token Limits", "active", false ) identity_id = identity[:data][:id] puts identity.to_json puts "\nCreate a Limit for our Identity" puts @datasift.account_identity_limit.create( identity_id, 'facebook', 100_000 ) puts "\nList all existing Limits for this Service" puts @datasift.account_identity_limit.list( 'facebook' ).to_json puts "\nGet existing Limit by Identity and Service" puts @datasift.account_identity_limit.get( identity_id, 'facebook' ).to_json puts "\nUpdate a Limit for a given Identity" puts @datasift.account_identity_limit.update( identity_id, 'facebook', 250_000 ).to_json puts "\nRemove the Limit from a given Identity and Service" puts @datasift.account_identity_limit.delete( identity_id, 'facebook' ).to_json puts "\nCleanup and remove the Identity" @datasift.account_identity.delete(identity_id) 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 AccountIdentityLimitEg.new
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
datasift-3.4.0 | examples/account_identity_limit_eg.rb |
datasift-3.3.0 | examples/account_identity_limit_eg.rb |
datasift-3.2.0 | examples/account_identity_limit_eg.rb |