Class: Filly::Credential

Inherits:
Object
  • Object
show all
Defined in:
lib/filly/credential.rb

Class Method Summary collapse

Class Method Details

.checkObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/filly/credential.rb', line 3

def self.check
  message = "  Stripe credentials is not set properly or it is incorrect. \n  Define the following Stripe environment variables.\n\n  export STRIPE_PUBLISHABLE_KEY='pk_test your publishable key' \n  export STRIPE_SECRET_KEY='sk_test your secret key'\n  \n  and define:\n  \n  Stripe.api_key = 'sk_test your secret key'\n  \n  in your code.\n" 
  begin
    ::Stripe::.retrieve
    true
  rescue ::Stripe::AuthenticationError => exception
    puts message
    puts "*" * 40
    puts "Stripe publishable key : #{ENV['STRIPE_PUBLISHABLE_KEY']}"
    puts "Stripe secret key : #{ENV['STRIPE_SECRET_KEY']} "
    puts "Stripe.api_key : #{Stripe.api_key}"
    puts "*" * 40
    false
  end      
end