Module: PagSeguro
- Extended by:
- Forwardable
- Defined in:
- lib/pagseguro.rb,
lib/pagseguro/bank.rb,
lib/pagseguro/item.rb,
lib/pagseguro/items.rb,
lib/pagseguro/phone.rb,
lib/pagseguro/config.rb,
lib/pagseguro/errors.rb,
lib/pagseguro/holder.rb,
lib/pagseguro/sender.rb,
lib/pagseguro/address.rb,
lib/pagseguro/request.rb,
lib/pagseguro/session.rb,
lib/pagseguro/version.rb,
lib/pagseguro/document.rb,
lib/pagseguro/shipping.rb,
lib/pagseguro/exceptions.rb,
lib/pagseguro/installment.rb,
lib/pagseguro/transaction.rb,
lib/pagseguro/creditor_fee.rb,
lib/pagseguro/notification.rb,
lib/pagseguro/payment_method.rb,
lib/pagseguro/payment_status.rb,
lib/pagseguro/payment_release.rb,
lib/pagseguro/payment_request.rb,
lib/pagseguro/payment_releases.rb,
lib/pagseguro/session/response.rb,
lib/pagseguro/transaction/search.rb,
lib/pagseguro/transaction_request.rb,
lib/pagseguro/installment/response.rb,
lib/pagseguro/transaction/response.rb,
lib/pagseguro/extensions/ensure_type.rb,
lib/pagseguro/installment/collection.rb,
lib/pagseguro/transaction/serializer.rb,
lib/pagseguro/transaction_installment.rb,
lib/pagseguro/payment_request/response.rb,
lib/pagseguro/boleto_transaction_request.rb,
lib/pagseguro/extensions/mass_assignment.rb,
lib/pagseguro/payment_request/serializer.rb,
lib/pagseguro/session/response_serializer.rb,
lib/pagseguro/transaction_request/response.rb,
lib/pagseguro/installment/request_serializer.rb,
lib/pagseguro/credit_card_transaction_request.rb,
lib/pagseguro/installment/response_serializer.rb,
lib/pagseguro/online_debit_transaction_request.rb,
lib/pagseguro/transaction/search/search_by_date.rb,
lib/pagseguro/transaction/search/search_abandoned.rb,
lib/pagseguro/transaction/search/search_by_reference.rb,
lib/pagseguro/transaction_request/request_serializer.rb,
lib/pagseguro/transaction_request/response_serializer.rb
Defined Under Namespace
Modules: Extensions, Request Classes: Address, Bank, BoletoTransactionRequest, Config, CreditCardTransactionRequest, CreditorFee, Document, Errors, Holder, Installment, Item, Items, Notification, OnlineDebitTransactionRequest, PaymentMethod, PaymentRelease, PaymentReleases, PaymentRequest, PaymentStatus, Phone, Search, SearchAbandoned, SearchByDate, SearchByReference, Sender, Session, Shipping, Transaction, TransactionInstallment, TransactionRequest
Constant Summary collapse
- VERSION =
"2.2.0"- InvalidEnvironmentError =
Class.new(StandardError)
Class Attribute Summary collapse
-
.encoding ⇒ Object
The encoding that will be used.
-
.environment ⇒ Object
The PagSeguro environment.
Class Method Summary collapse
-
.api_url(path) ⇒ Object
The API endpoint.
-
.configuration ⇒ Object
The configuration intance for the thread.
-
.configure {|configuration| ... } ⇒ Object
Set the global configuration.
-
.root_uri(type) ⇒ Object
Return the root uri based on its type.
-
.site_url(path) ⇒ Object
The site url.
-
.uris ⇒ Object
Register endpoints by environment.
Class Attribute Details
.encoding ⇒ Object
The encoding that will be used.
71 72 73 |
# File 'lib/pagseguro.rb', line 71 def encoding @encoding end |
.environment ⇒ Object
The PagSeguro environment. production or sandbox.
75 76 77 |
# File 'lib/pagseguro.rb', line 75 def environment @environment end |
Class Method Details
.api_url(path) ⇒ Object
The API endpoint.
119 120 121 |
# File 'lib/pagseguro.rb', line 119 def self.api_url(path) File.join(root_uri(:api), path) end |
.configuration ⇒ Object
The configuration intance for the thread
103 104 105 |
# File 'lib/pagseguro.rb', line 103 def self.configuration Thread.current[:pagseguro_config] ||= PagSeguro::Config.new end |
.configure {|configuration| ... } ⇒ Object
Set the global configuration.
PagSeguro.configure do |config|
config.email = "[email protected]"
config.token = "abc"
end
114 115 116 |
# File 'lib/pagseguro.rb', line 114 def self.configure(&block) yield configuration end |
.root_uri(type) ⇒ Object
Return the root uri based on its type. Current types are :api or :site
97 98 99 100 |
# File 'lib/pagseguro.rb', line 97 def self.root_uri(type) root = uris.fetch(environment.to_sym) { raise InvalidEnvironmentError } root[type.to_sym] end |
.site_url(path) ⇒ Object
The site url.
124 125 126 |
# File 'lib/pagseguro.rb', line 124 def self.site_url(path) File.join(root_uri(:site), path) end |
.uris ⇒ Object
Register endpoints by environment.
82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/pagseguro.rb', line 82 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 |