Skip to content

Instantly share code, notes, and snippets.

@joshuapinter
Created June 26, 2014 23:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshuapinter/ae48c7a11f7dd6f5afe8 to your computer and use it in GitHub Desktop.
Save joshuapinter/ae48c7a11f7dd6f5afe8 to your computer and use it in GitHub Desktop.
Check Your Zencoder Balance So You Don't Go Over.
MINUTES_ALLOWED = 1000
PRICE_PER_MINUTE = 0.05
namespace :zencoder do
desc "Check if Zencoder balance is above #{MINUTES_ALLOWED} minutes / $#{MINUTES_ALLOWED * PRICE_PER_MINUTE}."
task :check_balance => :environment do
minutes_used = Zencoder::Account.details.body["minutes_used"]
if minutes_used > MINUTES_ALLOWED
raise "Zencoder overage! #{minutes_used} minutes used, which is $#{minutes_used * PRICE_PER_MINUTE}"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment