Class: Paypal::REST
- Inherits:
-
Object
show all
- Defined in:
- lib/paypal/rest.rb,
lib/paypal/rest/version.rb,
lib/paypal/rest/connection.rb,
lib/paypal/rest/bearer_token.rb
Defined Under Namespace
Classes: BearerToken, ClientError, Connection
Constant Summary
collapse
- VERSION =
"1.1.1".freeze
Class Method Summary
collapse
Class Method Details
.capture_payment_for_order(order_id, full_response: false) ⇒ Object
32
33
34
35
36
37
38
39
40
|
# File 'lib/paypal/rest.rb', line 32
def capture_payment_for_order(order_id, full_response: false)
if full_response
post("/v2/checkout/orders/#{order_id}/capture", headers: {
Prefer: "return=representation",
}) else
post("/v2/checkout/orders/#{order_id}/capture")
end
end
|
.clear_configuration ⇒ Object
18
19
20
|
# File 'lib/paypal/rest.rb', line 18
def clear_configuration
@configuration = nil
end
|
.configuration ⇒ Object
14
15
16
|
# File 'lib/paypal/rest.rb', line 14
def configuration
@configuration ||= RESTConfiguration.new
end
|
10
11
12
|
# File 'lib/paypal/rest.rb', line 10
def configure(&block)
block.call(configuration)
end
|
.create_order(full_response: false, **params) ⇒ Object
22
23
24
25
26
27
28
29
30
|
# File 'lib/paypal/rest.rb', line 22
def create_order(full_response: false, **params)
if full_response
post("/v2/checkout/orders", params:, headers: {
Prefer: "return=representation",
}) else
post("/v2/checkout/orders", params:)[:id]
end
end
|
.reset_connection ⇒ Object
42
43
44
45
|
# File 'lib/paypal/rest.rb', line 42
def reset_connection
@connection = nil
@bearer_token = nil
end
|