Exception: Html2img::InsufficientCreditsError

Inherits:
Error
  • Object
show all
Defined in:
lib/html2img/errors.rb

Overview

Raised on a 402: authenticated, but out of credits for the period. The API code is insufficient_credits.

Instance Attribute Summary

Attributes inherited from Error

#error_code, #payload, #status_code

Instance Method Summary collapse

Methods inherited from Error

#initialize, #to_s

Constructor Details

This class inherits a constructor from Html2img::Error

Instance Method Details

#credits_remainingInteger?

Returns credits left on the account. Zero on a 402.

Returns:

  • (Integer, nil)

    credits left on the account. Zero on a 402.



41
42
43
44
45
# File 'lib/html2img/errors.rb', line 41

def credits_remaining
  value = payload["credits_remaining"]

  value.is_a?(Integer) ? value : nil
end