Class: Subledger::Domain::CompletedReportRendering

Inherits:
ReportRendering show all
Defined in:
lib/subledger/domain/report_rendering.rb

Defined Under Namespace

Classes: Entity

Instance Attribute Summary collapse

Attributes inherited from ReportRendering

#balanced_accounts, #book, #effective_at, #rendered_at, #report, #total_accounts

Attributes included from Roles::Storable

#client, #store

Attributes included from Roles::Identifiable

#id

Attributes included from Roles::DescribableReportRendering

#description, #reference

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ReportRendering

active_klass, building_klass, completed_klass, #initialize, post_keys, root_klass

Methods included from Roles::Restable

#patch_hash, #post_hash, #serializable_hash

Methods included from Roles::Collectable

included

Methods included from Roles::Readable

included, #read

Methods included from Roles::Creatable

#create, included

Methods included from Roles::Storable

raise_unless_creatable

Methods included from Roles::DescribableReportRendering

raise_unless_creatable

Methods included from Roles::Attributable

#attributes

Methods included from Subledger::Domain

#==, #collection_name, #entity_name, included, #to_s

Constructor Details

This class inherits a constructor from Subledger::Domain::ReportRendering

Instance Attribute Details

#balanceObject (readonly)

Returns the value of attribute balance.



164
165
166
# File 'lib/subledger/domain/report_rendering.rb', line 164

def balance
  @balance
end

#categoriesObject (readonly)

Returns the value of attribute categories.



164
165
166
# File 'lib/subledger/domain/report_rendering.rb', line 164

def categories
  @categories
end

#completed_atObject (readonly)

Returns the value of attribute completed_at.



164
165
166
# File 'lib/subledger/domain/report_rendering.rb', line 164

def completed_at
  @completed_at
end

#warningsObject (readonly)

Returns the value of attribute warnings.



164
165
166
# File 'lib/subledger/domain/report_rendering.rb', line 164

def warnings
  @warnings
end

Class Method Details

.sub_klassesObject



166
167
168
# File 'lib/subledger/domain/report_rendering.rb', line 166

def self.sub_klasses
  [ completed_klass ]
end

Instance Method Details

#progressObject



170
171
172
# File 'lib/subledger/domain/report_rendering.rb', line 170

def progress
  100
end

#to_jsonObject



174
175
176
177
178
179
180
181
182
183
184
# File 'lib/subledger/domain/report_rendering.rb', line 174

def to_json
  @json ||= if location[0..4] == 's3://'
              ExceptionHandler.new( :name => 'completed_report_rendering to_json' ).with_retry do
                s3_bucket.objects[id].read
              end
            elsif location[0..6] == 'file://'
              File.open( location[7..-1], 'r' ).read
            else
              raise ReportRenderingError, "unknown URL scheme: #{location}"
            end
end