Sha256: 98d2c5e8383a9b67ebf190000d739f846c542f69f37068bcb4f0c46a49a1b459

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

require 'digest/sha1'
require 'pagarme/object'
require 'pagarme/util'
require 'pagarme/model'
require 'pagarme/transaction_common'
require 'pagarme/customer'
require 'pagarme/phone'
require 'pagarme/address'
require 'pagarme/subscription'
require 'pagarme/transaction'
require 'pagarme/plan'
require 'pagarme/request'
require 'pagarme/errors'

module PagarMe
  @@api_key = nil
  @@api_endpoint = 'https://api.pagar.me/1'
  @@live = true
  @@api_card_encryption_public_key = File.join(File.dirname(__FILE__), '..', 'certs/public_key.pem')

  def self.api_endpoint=(api_endpoint)
    @@api_endpoint = api_endpoint
  end

  def self.api_endpoint
    @@api_endpoint
  end

  def self.api_key=(api_key)
    @@api_key = api_key
  end

  def self.api_key
    @@api_key
  end

  def self.api_card_encryption_public_key
    @@api_card_encryption_public_key
  end

  def self.full_api_url(relative_path)
    "#{@@api_endpoint}#{relative_path}"
  end

  def self.validate_fingerprint(id, fingerprint)
    Digest::SHA1.hexdigest(id.to_s + "#" + @@api_key) == fingerprint	
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pagarme-1.9.6 lib/pagarme.rb
pagarme-1.9.5 lib/pagarme.rb
pagarme-1.9.4 lib/pagarme.rb
pagarme-1.9.3 lib/pagarme.rb