Sha256: 29a98a358ff658312bca35c512ea8769f9d01292ff55a88430ebdd303ff575a5

Contents?: true

Size: 1.02 KB

Versions: 8

Compression:

Stored size: 1.02 KB

Contents

# This script resumes Push subscriptions in your account.
#
# NB: Most of the error handling (exception catching) has been removed for
# the sake of simplicity. Nearly everything in this library may throw
# exceptions, and production code should catch them. See the documentation
# for full details.
#

# Include the shared Env class
require File.dirname(__FILE__) + '/env'

# Create the env object. This reads the command line arguments, creates the
# user object, and provides access to both along with helper functions.
env = Env.new()

# Make sure we have something to do
abort('Please specify one or more subscription IDs') unless env.args.size() > 0

for sub_id in env.args
	begin
		sub = env.user.getPushSubscription(sub_id)
		print 'Resuming ' + sub_id + ', "' + sub.name + '"...'
		sub.resume()
	rescue DataSift::DataSiftError => err
		puts 'ERR: [' + err.class.name + '] ' + err.message
	else
		puts 'done'
	end
end

if env.user.rate_limit_remaining != -1
	puts 'Rate limit remainining: ' + String(env.user.rate_limit_remaining)
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
datasift-2.1.1 examples/push/resume.rb
datasift-2.1.0 examples/push/resume.rb
datasift-2.1.0.beta examples/push/resume.rb
datasift-2.0.4 examples/push/resume.rb
datasift-2.0.3 examples/push/resume.rb
datasift-2.0.2 examples/push/resume.rb
datasift-2.0.1 examples/push/resume.rb
datasift-2.0.0 examples/push/resume.rb