Module: PagSeguro
- Extended by:
- Forwardable
- Defined in:
- lib/pagseguro.rb,
lib/pagseguro/item.rb,
lib/pagseguro/items.rb,
lib/pagseguro/phone.rb,
lib/pagseguro/config.rb,
lib/pagseguro/errors.rb,
lib/pagseguro/sender.rb,
lib/pagseguro/address.rb,
lib/pagseguro/request.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/transaction/search.rb,
lib/pagseguro/installment/response.rb,
lib/pagseguro/transaction/response.rb,
lib/pagseguro/extensions/ensure_type.rb,
lib/pagseguro/installment/serializer.rb,
lib/pagseguro/transaction/serializer.rb,
lib/pagseguro/payment_request/response.rb,
lib/pagseguro/extensions/mass_assignment.rb,
lib/pagseguro/payment_request/serializer.rb,
lib/pagseguro/transaction/search/search_by_date.rb,
lib/pagseguro/transaction/search/search_abandoned.rb,
lib/pagseguro/transaction/search/search_by_reference.rb
Defined Under Namespace
Modules: Extensions, Request Classes: Address, Config, CreditorFee, Document, Errors, Installment, Item, Items, Notification, PaymentMethod, PaymentRelease, PaymentReleases, PaymentRequest, PaymentStatus, Phone, Search, SearchAbandoned, SearchByDate, SearchByReference, Sender, Shipping, Transaction
Constant Summary collapse
- VERSION =
"2.1.1"
- 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.
55 56 57 |
# File 'lib/pagseguro.rb', line 55 def encoding @encoding end |
.environment ⇒ Object
The PagSeguro environment. production
or sandbox
.
59 60 61 |
# File 'lib/pagseguro.rb', line 59 def environment @environment end |
Class Method Details
.api_url(path) ⇒ Object
The API endpoint.
103 104 105 |
# File 'lib/pagseguro.rb', line 103 def self.api_url(path) File.join(root_uri(:api), path) end |
.configuration ⇒ Object
The configuration intance for the thread
87 88 89 |
# File 'lib/pagseguro.rb', line 87 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
98 99 100 |
# File 'lib/pagseguro.rb', line 98 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
81 82 83 84 |
# File 'lib/pagseguro.rb', line 81 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.
108 109 110 |
# File 'lib/pagseguro.rb', line 108 def self.site_url(path) File.join(root_uri(:site), path) end |
.uris ⇒ Object
Register endpoints by environment.
66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/pagseguro.rb', line 66 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 |