Class: Economic::Invoices::BookedRepo

Inherits:
Repo show all
Defined in:
lib/economic/invoices/booked_repo.rb

Constant Summary

Constants inherited from BaseRepo

BaseRepo::URL

Class Method Summary collapse

Methods inherited from Repo

all, filter

Methods inherited from BaseRepo

all, destroy, endpoint_url, filter, find, id_to_url_formatted_id, save, send_request, updated_after

Class Method Details

.send(invoice, book_with_number: nil) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/economic/invoices/booked_repo.rb', line 5

def send(invoice, book_with_number: nil)
  response = send_request(method: :post, url: URI.escape(endpoint_url), payload: payload(invoice, book_with_number: book_with_number))

  entry_hash = JSON.parse(response.body)

  invoice.class.new(entry_hash)
end