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 = <<ERROR 
  Stripe credentials is not set properly or it is incorrect. 
  Define the following Stripe environment variables.

  export STRIPE_PUBLISHABLE_KEY='pk_test your publishable key' 
  export STRIPE_SECRET_KEY='sk_test your secret key'
  
  and define:
  
  Stripe.api_key = 'sk_test your secret key'
  
  in your code.
ERROR
  begin
    ::Stripe::Account.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