module PagSeguro
Constants
- InvalidEnvironmentError
- VERSION
Public Class Methods
account_credentials()
click to toggle source
Returns an object with the configured account credentials
# File lib/pagseguro.rb, line 163 def self.account_credentials PagSeguro::AccountCredentials.new(PagSeguro.email, PagSeguro.token) end
api_url(path)
click to toggle source
The API endpoint.
# File lib/pagseguro.rb, line 213 def self.api_url(path) File.join(root_uri(:api), path) end
application_credentials()
click to toggle source
Returns an object with the configured application credentials
# File lib/pagseguro.rb, line 168 def self.application_credentials PagSeguro::ApplicationCredentials.new(PagSeguro.app_id, PagSeguro.app_key) end
configuration()
click to toggle source
The configuration instance
# File lib/pagseguro.rb, line 194 def self.configuration @configuration ||= PagSeguro::Config.new end
configure() { |configuration| ... }
click to toggle source
Set the global configuration.
PagSeguro.configure do |config| config.email = "john@example.com" config.token = "abc" config.app_id = "app12345" config.app_key = "adju3cmADc52C" config.environment = :sandbox end
# File lib/pagseguro.rb, line 208 def self.configure(&block) yield configuration end
email=(email)
click to toggle source
# File lib/pagseguro.rb, line 136 def email=(email) warn "[DEPRECATION] `email=` is deprecated and will be removed. Please use configuration block instead." configuration.email = email end
encoding=(encoding)
click to toggle source
# File lib/pagseguro.rb, line 156 def encoding=(encoding) warn "[DEPRECATION] `encoding=` is deprecated and will be removed. Please use configuration block instead." configuration.encoding = encoding end
environment=(environment)
click to toggle source
# File lib/pagseguro.rb, line 151 def environment=(environment) warn "[DEPRECATION] `environment=` is deprecated and will be removed. Please use configuration block instead." configuration.environment = environment end
receiver_email=(receiver_email)
click to toggle source
# File lib/pagseguro.rb, line 141 def receiver_email=(receiver_email) warn "[DEPRECATION] `receiver_email=` is deprecated and will be removed. Please use configuration block instead." configuration.receiver_email = receiver_email end
root_uri(type)
click to toggle source
Return the root uri based on its type. Current types are :api
or :site
# File lib/pagseguro.rb, line 188 def self.root_uri(type) root = uris.fetch(environment.to_sym) { raise InvalidEnvironmentError } root[type.to_sym] end
site_url(path)
click to toggle source
The site url.
# File lib/pagseguro.rb, line 218 def self.site_url(path) File.join(root_uri(:site), path) end
token=(token)
click to toggle source
# File lib/pagseguro.rb, line 146 def token=(token) warn "[DEPRECATION] `token=` is deprecated and will be removed. Please use configuration block instead." configuration.token = token end
uris()
click to toggle source
Register endpoints by environment.
# File lib/pagseguro.rb, line 173 def self.uris @uris ||= { production: { api: "https://ws.pagseguro.uol.com.br/", site: "https://pagseguro.uol.com.br/" }, sandbox: { site: 'https://sandbox.pagseguro.uol.com.br/', api: 'https://ws.sandbox.pagseguro.uol.com.br/' } } end