Class: Reji::Configuration
- Inherits:
-
Object
- Object
- Reji::Configuration
- Defined in:
- lib/reji/configuration.rb
Instance Attribute Summary collapse
-
#currency ⇒ Object
Currency.
-
#key ⇒ Object
Stripe Keys.
-
#model ⇒ Object
Reji Model.
-
#model_id ⇒ Object
Returns the value of attribute model_id.
-
#secret ⇒ Object
Returns the value of attribute secret.
-
#webhook ⇒ Object
Stripe Webhooks.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/reji/configuration.rb', line 35 def initialize @key = ENV['STRIPE_KEY'] @secret = ENV['STRIPE_SECRET'] @webhook = { secret: ENV['STRIPE_WEBHOOK_SECRET'], tolerance: ENV['STRIPE_WEBHOOK_TOLERANCE'] || 300, } @model = ENV['REJI_MODEL'] || 'User' @model_id = ENV['REJI_MODEL_ID'] || 'user_id' @currency = ENV['REJI_CURRENCY'] || 'usd' end |
Instance Attribute Details
#currency ⇒ Object
Currency
This is the default currency that will be used when generating charges from your application. Of course, you are welcome to use any of the various world currencies that are currently supported via Stripe.
33 34 35 |
# File 'lib/reji/configuration.rb', line 33 def currency @currency end |
#key ⇒ Object
Stripe Keys
The Stripe publishable key and secret key give you access to Stripe’s API. The “publishable” key is typically used when interacting with Stripe.js while the “secret” key accesses private API endpoints.
10 11 12 |
# File 'lib/reji/configuration.rb', line 10 def key @key end |
#model ⇒ Object
Reji Model
This is the model in your application that includes the Billable concern provided by Reji. It will serve as the primary model you use while interacting with Reji related methods, subscriptions, and so on.
25 26 27 |
# File 'lib/reji/configuration.rb', line 25 def model @model end |
#model_id ⇒ Object
Returns the value of attribute model_id.
26 27 28 |
# File 'lib/reji/configuration.rb', line 26 def model_id @model_id end |
#secret ⇒ Object
Returns the value of attribute secret.
11 12 13 |
# File 'lib/reji/configuration.rb', line 11 def secret @secret end |
#webhook ⇒ Object
Stripe Webhooks
Your Stripe webhook secret is used to prevent unauthorized requests to your Stripe webhook handling controllers. The tolerance setting will check the drift between the current time and the signed request’s.
18 19 20 |
# File 'lib/reji/configuration.rb', line 18 def webhook @webhook end |