Module: PagseguroClient
- Extended by:
- PagseguroClient
- Included in:
- PagseguroClient
- Defined in:
- lib/pagseguro_client/base.rb,
lib/pagseguro_client/order.rb,
lib/pagseguro_client/railtie.rb,
lib/pagseguro_client/version.rb,
lib/pagseguro_client/generator.rb,
lib/pagseguro_client/transaction.rb,
lib/pagseguro_client/notification.rb
Defined Under Namespace
Classes: InstallGenerator, MissingConfigurationError, MissingEnvironmentError, Notification, Order, PagseguroError, Railtie, Transaction
Constant Summary
collapse
- VERSION =
"0.4.2"
- @@config =
nil
Instance Method Summary
collapse
Instance Method Details
#checkout_url ⇒ Object
50
51
52
|
# File 'lib/pagseguro_client/base.rb', line 50
def checkout_url
"#{ws_url}/v2/checkout"
end
|
#config ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/pagseguro_client/base.rb', line 14
def config
raise MissingConfigurationError, "file not found on #{config_file.inspect}" unless config?
@@config ||= YAML.load_file(config_file)
if @@config == false || !@@config[Rails.env]
raise MissingEnvironmentError, ":#{Rails.env} environment not set on #{config_file.inspect}"
end
@@config[Rails.env]
end
|
#config? ⇒ Boolean
10
11
12
|
# File 'lib/pagseguro_client/base.rb', line 10
def config?
File.exist?(config_file)
end
|
#config_file ⇒ Object
6
7
8
|
# File 'lib/pagseguro_client/base.rb', line 6
def config_file
Rails.root.join("config/pagseguro.yml")
end
|
#email ⇒ Object
42
43
44
|
# File 'lib/pagseguro_client/base.rb', line 42
def email
config["email"]
end
|
#notification_url(code) ⇒ Object
58
59
60
|
# File 'lib/pagseguro_client/base.rb', line 58
def notification_url(code)
"#{ws_url}/v2/transactions/notifications/#{code}"
end
|
#payment_url(code) ⇒ Object
54
55
56
|
# File 'lib/pagseguro_client/base.rb', line 54
def payment_url(code)
"#{ps_url}/v2/checkout/payment.html?code=#{code}"
end
|
#ps_url ⇒ Object
34
35
36
|
# File 'lib/pagseguro_client/base.rb', line 34
def ps_url
config["ps_url"]
end
|
#redirect? ⇒ Boolean
26
27
28
|
# File 'lib/pagseguro_client/base.rb', line 26
def redirect?
config.has_key?("return_to")
end
|
#redirect_url ⇒ Object
46
47
48
|
# File 'lib/pagseguro_client/base.rb', line 46
def redirect_url
config["return_to"]
end
|
#token ⇒ Object
38
39
40
|
# File 'lib/pagseguro_client/base.rb', line 38
def token
config["token"]
end
|
#transaction_url(code) ⇒ Object
62
63
64
|
# File 'lib/pagseguro_client/base.rb', line 62
def transaction_url(code)
"#{ws_url}/v2/transactions/#{code}"
end
|
#ws_url ⇒ Object
30
31
32
|
# File 'lib/pagseguro_client/base.rb', line 30
def ws_url
config["ws_url"]
end
|