module Subledger::Store::Api::CreateLine

Public Instance Methods

create_line(args) click to toggle source
# File lib/subledger/store/api/roles/create_line.rb, line 5
def create_line args
  begin
    line = args[:line]

    path = Path.for_entity( :anchor => line.journal_entry ) + '/create_line'

    json_body = http.post do |req|
                  req.url    path
                  req.body = line.post_hash
                end.body
  rescue Exception => e
    raise CreateLineError, "Cannot create #{line}: #{e}"
  end

  new_or_initialize json_body, line
end