module Reji
Constants
- STRIPE_VERSION
The Stripe API version.
- VERSION
Public Class Methods
configuration()
click to toggle source
# File lib/reji/configuration.rb, line 48 def self.configuration @configuration ||= Configuration.new end
configuration=(config)
click to toggle source
# File lib/reji/configuration.rb, line 52 def self.configuration=(config) @configuration = config end
configure() { |configuration| ... }
click to toggle source
# File lib/reji/configuration.rb, line 56 def self.configure yield(configuration) end
deactivate_past_due()
click to toggle source
# File lib/reji.rb, line 74 def self.deactivate_past_due @deactivate_past_due end
deactivate_past_due=(value)
click to toggle source
# File lib/reji.rb, line 70 def self.deactivate_past_due=(value) @deactivate_past_due = value end
find_billable(stripe_id)
click to toggle source
Get the billable entity instance by Stripe ID.
# File lib/reji.rb, line 36 def self.find_billable(stripe_id) return if stripe_id.nil? model = @configuration.model model.constantize.where(stripe_id: stripe_id).first end
format_amount(amount, currency = nil)
click to toggle source
Format the given amount into a displayable currency.
# File lib/reji.rb, line 52 def self.format_amount(amount, currency = nil) currency = 'usd' if currency.nil? Money.rounding_mode = BigDecimal::ROUND_HALF_EVEN Money.locale_backend = :i18n money = Money.new(amount, Money::Currency.new(currency.upcase)) money.format end
keep_past_due_subscriptions_active()
click to toggle source
Configure to maintain past due subscriptions as active.
# File lib/reji.rb, line 64 def self.keep_past_due_subscriptions_active @deactivate_past_due = false self end
stripe_options(options = {})
click to toggle source
Get the default Stripe API options.
# File lib/reji.rb, line 44 def self.stripe_options(options = {}) { api_key: Reji.configuration.secret, stripe_version: Reji::STRIPE_VERSION, }.merge(options) end