module Subledger::Store::Api::CreateAndPost
Public Instance Methods
create_and_post(args)
click to toggle source
# File lib/subledger/store/api/roles/create_and_post.rb, line 5 def create_and_post args dje = args[:active_journal_entry] dje_lines = args[:active_lines] pje = args[:posting_journal_entry] path = Path.for_collection( :anchor => dje ) + '/create_and_post' json_body = http.post do |req| req.url path unless dje.post_delay.zero? req.headers['X-Subledger-Post-Slowly'] = 'true' end req.body = create_and_post_hash( dje, dje_lines ) end.body new_or_initialize json_body, pje end
Private Instance Methods
create_and_post_hash(dje, dje_lines)
click to toggle source
# File lib/subledger/store/api/roles/create_and_post.rb, line 27 def create_and_post_hash dje, dje_lines lines = dje_lines.collect { |line| line.post_hash } dje.post_hash.merge :lines => lines end