Class: Subledger::Domain::ActiveReport
- Defined in:
- lib/subledger/domain/report.rb
Defined Under Namespace
Classes: Entity
Instance Attribute Summary
Attributes inherited from Report
Attributes included from Roles::Versionable
Attributes included from Roles::Storable
Attributes included from Roles::Identifiable
Attributes included from Roles::Describable
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Report
active_klass, archived_klass, #initialize, patch_keys, post_keys, root_klass
Methods included from Roles::Restable
#patch_hash, #post_hash, #serializable_hash, #to_json
Methods included from Roles::Archivable
Methods included from Roles::Activatable
Methods included from Roles::Collectable
Methods included from Roles::Updatable
Methods included from Roles::Readable
Methods included from Roles::Creatable
Methods included from Roles::Versionable
Methods included from Roles::Storable
Methods included from Roles::Describable
Methods included from Roles::Attributable
Methods included from Subledger::Domain
#==, #collection_name, #entity_name, included, #to_s
Constructor Details
This class inherits a constructor from Subledger::Domain::Report
Class Method Details
.sub_klasses ⇒ Object
109 110 111 |
# File 'lib/subledger/domain/report.rb', line 109 def self.sub_klasses [ active_klass ] end |
Instance Method Details
#attach(args) ⇒ Object
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/subledger/domain/report.rb', line 121 def attach args validate_attach args category = args[:category] parent = args[:parent] if category.nil? or category.id.nil? raise ReportError, ':category is required and must have an id' end if not parent.nil? and parent.id.nil? raise ReportError, ':parent must have an id' end begin store.attach_category_to_report :report => self, :category => category, :parent => parent rescue Store::AttachError => e raise ReportError, e end category end |
#categories(&block) ⇒ Object
113 114 115 116 117 118 119 |
# File 'lib/subledger/domain/report.rb', line 113 def categories &block begin store.collect_categories_for_report self, &block rescue Store::CollectError => e raise ReportError, e end end |
#detach(args) ⇒ Object
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/subledger/domain/report.rb', line 146 def detach args category = args[:category] if category.nil? or category.id.nil? raise ReportError, ':category is required and must have an id' end begin store.detach_category_from_report :report => self, :category => category rescue Store::DetachError => e raise ReportError, e end category end |
#render(args) ⇒ Object
163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/subledger/domain/report.rb', line 163 def render args at = args[:at] if at.nil? or not at.kind_of? Time raise ReportError, ':at is required and must be a Time' end building_report_rendering = client.building_report_rendering :effective_at => at, :report => self store.render args.merge! :building_report_rendering => building_report_rendering end |