class PromisePay::Generators::InitGenerator

Public Instance Methods

copy_initializer() click to toggle source
# File lib/generators/promise_pay/init_generator.rb, line 39
def copy_initializer
  template \
    "promise_pay_initializer.rb",
    "config/initializers/promise_pay.rb"
end
env() click to toggle source
# File lib/generators/promise_pay/init_generator.rb, line 16
def env
  @env ||= options.test? ? :test : :production
end
marketplace() click to toggle source
# File lib/generators/promise_pay/init_generator.rb, line 20
def marketplace
  @marketplace ||= (
    PromisePay.env = env
    PromisePay::Marketplace.new(user: email, password: password)
  )
end
token() click to toggle source
# File lib/generators/promise_pay/init_generator.rb, line 27
def token
  @token ||= (
    begin
      marketplace.request_token
    rescue Exception => e
      puts e
      puts "WARNING: token generation failed (Check your credentials)"
      "token"
    end
  )
end