Class: Reji::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/reji/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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

#currencyObject

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

#keyObject

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

#modelObject

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_idObject

Returns the value of attribute model_id.



26
27
28
# File 'lib/reji/configuration.rb', line 26

def model_id
  @model_id
end

#secretObject

Returns the value of attribute secret.



11
12
13
# File 'lib/reji/configuration.rb', line 11

def secret
  @secret
end

#webhookObject

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