Class: Moip2::PaymentApi

Inherits:
Object
  • Object
show all
Defined in:
lib/moip2/payment_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ PaymentApi

Returns a new instance of PaymentApi.



5
6
7
# File 'lib/moip2/payment_api.rb', line 5

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject (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