Class: Economic::Repos::Invoices::Drafts::Line
- Inherits:
-
Economic::Repo
- Object
- Economic::Repo
- Economic::Repos::Invoices::Drafts::Line
- Defined in:
- lib/economic/repos/invoices/drafts/line.rb
Constant Summary
Constants inherited from Economic::Repo
Economic::Repo::DEFAULT_QUERY_PARAMS, Economic::Repo::ROOT
Instance Attribute Summary
Attributes inherited from Economic::Repo
Instance Method Summary collapse
Methods inherited from Economic::Repo
#all, #destroy, #find, #initialize, #update
Constructor Details
This class inherits a constructor from Economic::Repo
Instance Method Details
#create(draft_invoice_model_or_id, lines) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/economic/repos/invoices/drafts/line.rb', line 6 def create(draft_invoice_model_or_id, lines) draft_invoice_id = draft_invoice_model_or_id.try(:id) || draft_invoice_model_or_id draft_invoice = Economic::Models::Invoices::Draft.new(lines: lines) uri = URI("#{Economic::Repo::ROOT}/invoices/drafts/#{draft_invoice_id}/lines") make_request(uri: uri, method: :post, data: draft_invoice) end |