Class: PayPal::Api
Constant Summary collapse
- SANDBOX_APP_ID =
'APP-80W284485P519543T'- SITE_ENDPOINTS =
{ :sandbox => "https://www.sandbox.paypal.com/webscr", :production => "https://www.paypal.com/webscr" }
Instance Attribute Summary collapse
-
#app_id ⇒ Object
Return application id.
-
#email ⇒ Object
The seller e-mail.
-
#password ⇒ Object
Set PayPal’s API password.
-
#sandbox ⇒ Object
Define if requests should be made to PayPal’s sandbox environment.
-
#seller_id ⇒ Object
Set seller id.
-
#signature ⇒ Object
Set PayPal’s API signature.
-
#username ⇒ Object
Set PayPal’s API username.
Class Method Summary collapse
-
.configure(&block) ⇒ Object
Set PayPal’s API attributes.
- .environment ⇒ Object
- .sandbox=(testing) ⇒ Object
- .site_endpoint ⇒ Object
Instance Method Summary collapse
- #configure {|_self| ... } ⇒ Object
-
#environment ⇒ Object
Return a name for current environment mode (sandbox or production).
-
#sandbox? ⇒ Boolean
Detect if sandbox mode is enabled.
Instance Attribute Details
#app_id ⇒ Object
Return application id
44 45 46 |
# File 'lib/paypal/api.rb', line 44 def app_id @app_id end |
#email ⇒ Object
The seller e-mail. Will be used to verify IPN.
40 41 42 |
# File 'lib/paypal/api.rb', line 40 def email @email end |
#password ⇒ Object
Set PayPal’s API password.
28 29 30 |
# File 'lib/paypal/api.rb', line 28 def password @password end |
#sandbox ⇒ Object
20 21 22 |
# File 'lib/paypal/api.rb', line 20 def sandbox @sandbox end |
#seller_id ⇒ Object
Set seller id. Will be used to verify IPN.
36 37 38 |
# File 'lib/paypal/api.rb', line 36 def seller_id @seller_id end |
#signature ⇒ Object
Set PayPal’s API signature.
32 33 34 |
# File 'lib/paypal/api.rb', line 32 def signature @signature end |
#username ⇒ Object
Set PayPal’s API username.
24 25 26 |
# File 'lib/paypal/api.rb', line 24 def username @username end |
Class Method Details
.configure(&block) ⇒ Object
Set PayPal’s API attributes
PayPal::Api.configure do |config|
config.username = "[email protected]"
config.password = "testing"
config.signature = "AAAAAAA"
config.email = "[email protected]"
end
55 56 57 |
# File 'lib/paypal/api.rb', line 55 def configure(&block) instance.configure(&block) end |
.environment ⇒ Object
63 64 65 |
# File 'lib/paypal/api.rb', line 63 def environment instance.environment end |
.sandbox=(testing) ⇒ Object
59 60 61 |
# File 'lib/paypal/api.rb', line 59 def sandbox=(testing) instance.sandbox = testing end |
.site_endpoint ⇒ Object
67 68 69 |
# File 'lib/paypal/api.rb', line 67 def site_endpoint SITE_ENDPOINTS[environment] end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
72 73 74 |
# File 'lib/paypal/api.rb', line 72 def configure(&block) yield self end |
#environment ⇒ Object
Return a name for current environment mode (sandbox or production).
84 85 86 |
# File 'lib/paypal/api.rb', line 84 def environment sandbox? ? :sandbox : :production end |
#sandbox? ⇒ Boolean
Detect if sandbox mode is enabled.
78 79 80 |
# File 'lib/paypal/api.rb', line 78 def sandbox? sandbox == true end |