Created
June 26, 2014 23:18
-
-
Save joshuapinter/ae48c7a11f7dd6f5afe8 to your computer and use it in GitHub Desktop.
Check Your Zencoder Balance So You Don't Go Over.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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