class KsStripe::Client
Set the Stripe API key
Public Class Methods
configure(&block)
click to toggle source
Set the Stripe API key to a class variable
Parameter: A block of code having Stripe API Key¶ ↑
Returns: None¶ ↑
# File lib/koduc_stripe.rb, line 26 def configure(&block) config = OpenStruct.new block.call config # if config[:stripe_api_key].blank? # raise "No Stripe API key provided." # elsif KsStripe::Empty.empty?(config[:stripe_api_key]) if KsStripe::Empty.empty?(config[:stripe_api_key]) raise "No Stripe API key provided. Please initialize the App with valid stripe API key." end @@stripe_token = config[:stripe_api_key] end
get_key_header()
click to toggle source
Gives Stripe Authorization Header for Stripe API request
Parameter: None¶ ↑
Returns: If stripe key is provided then return Stripe Authorization Header¶ ↑
otherwise Raise exception.
# File lib/koduc_stripe.rb, line 53 def get_key_header if KsStripe::Empty.empty?(self.stripe_key) raise "No Stripe API key provided. Please initialize the App with valid stripe API key." end @@stripe_auth_key = "Bearer #{self.stripe_key}" end