Method: Harvest::API::InvoicePayments#create

Defined in:
lib/harvest/api/invoice_payments.rb

#create(payment) ⇒ Object



17
18
19
20
21
22
# File 'lib/harvest/api/invoice_payments.rb', line 17

def create(payment)
  payment = api_model.wrap(payment)
  response = request(:post, credentials, "/invoices/#{payment.invoice_id}/payments", :body => payment.to_json)
  id = response.headers["location"].match(/\/.*\/(\d+)\/.*\/(\d+)/)[2]
  find(payment.invoice_id, id)
end