module Subledger::Store::Api::Reports
Public Instance Methods
attach_category_to_report(args)
click to toggle source
# File lib/subledger/store/api/roles/reports.rb, line 5 def attach_category_to_report args report = args[:report] category = args[:category] parent = args[:parent] path = Path.for_entity( :anchor => report ) + '/attach' attach_post_hash = { 'category' => category.id } attach_post_hash['parent'] = parent.id unless parent.nil? begin json_body = http.post do |req| req.url path req.body = attach_post_hash end.body rescue Exception => e raise AttachError, "Cannot attach #{category}: #{e}" end category end
collect_categories_for_report(report, &block)
click to toggle source
# File lib/subledger/store/api/roles/reports.rb, line 67 def collect_categories_for_report report, &block raise ReportError, 'report#categories is not yet implemented' end
detach_category_from_report(args)
click to toggle source
# File lib/subledger/store/api/roles/reports.rb, line 28 def detach_category_from_report args category = args[:category] report = args[:report] path = Path.for_entity( :anchor => report ) + '/detach' detach_post_hash = { 'category' => category.id } begin json_body = http.post do |req| req.url path req.body = detach_post_hash end.body rescue Exception => e raise DetachError, "Cannot detach #{category}: #{e}" end category end
render(args)
click to toggle source
# File lib/subledger/store/api/roles/reports.rb, line 48 def render args at = args[:at].iso8601 building_report_rendering = args[:building_report_rendering] report = building_report_rendering.report path = Path.for_entity( :anchor => report ) + "/render?at=#{at}" begin json_body = http.post do |req| req.url path end.body rescue Exception => e raise ReportError, "Cannot render #{report}: #{e}" end new_or_initialize json_body, building_report_rendering end
report_structure_for(report, &block)
click to toggle source
# File lib/subledger/store/api/roles/reports.rb, line 71 def report_structure_for report, &block raise ReportError, 'report#structure is not yet implemented' end