Module: Subledger::Store::Api::Post
- Included in:
- Store
- Defined in:
- lib/subledger/store/api/roles/post.rb
Instance Method Summary collapse
Instance Method Details
#post(postable_journal_entry) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/subledger/store/api/roles/post.rb', line 5 def post postable_journal_entry path = Path.for_entity :anchor => postable_journal_entry begin json_body = http.post do |req| req.url path unless postable_journal_entry.post_delay.zero? req.headers['X-Subledger-Post-Slowly'] = 'true' end end.body rescue Exception => e raise PostError, "Cannot post #{postable_journal_entry}: #{e}" end new_or_initialize json_body, postable_journal_entry end |