Class: Moip2::PaymentApi
- Inherits:
-
Object
- Object
- Moip2::PaymentApi
- Defined in:
- lib/moip2/payment_api.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #capture(payment_id) ⇒ Object
- #create(order_id, payment) ⇒ Object
-
#initialize(client) ⇒ PaymentApi
constructor
A new instance of PaymentApi.
- #show(payment_id) ⇒ Object
- #void(payment_id) ⇒ Object
Constructor Details
#initialize(client) ⇒ PaymentApi
5 6 7 |
# File 'lib/moip2/payment_api.rb', line 5 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
3 4 5 |
# File 'lib/moip2/payment_api.rb', line 3 def client @client end |
Instance Method Details
#capture(payment_id) ⇒ Object
17 18 19 |
# File 'lib/moip2/payment_api.rb', line 17 def capture(payment_id) Resource::Payment.new client.post("/v2/payments/#{payment_id}/capture", nil) end |
#create(order_id, payment) ⇒ Object
9 10 11 |
# File 'lib/moip2/payment_api.rb', line 9 def create(order_id, payment) Resource::Payment.new client.post("/v2/orders/#{order_id}/payments", payment) end |
#show(payment_id) ⇒ Object
13 14 15 |
# File 'lib/moip2/payment_api.rb', line 13 def show(payment_id) Resource::Payment.new client.get("/v2/payments/#{payment_id}") end |
#void(payment_id) ⇒ Object
21 22 23 |
# File 'lib/moip2/payment_api.rb', line 21 def void(payment_id) Resource::Payment.new client.post("/v2/payments/#{payment_id}/void", nil) end |