appraisermetrics-report-service
Report Service app for AM app.
gem dependencies
- prawn - https://github.com/prawnpdf/prawn - license: choice of GPLv2 or GPLv3
- prawn/table - https://github.com/prawnpdf/prawn-table - license: choice of GPLv2 or GPLv3
- money - https://github.com/RubyMoney/money - license: https://github.com/RubyMoney/money/blob/master/LICENSE
- rspec for tests
- pdf-reader (for specs) - https://github.com/yob/pdf-reader - license: MIT
- the Date ruby module, should be included in any standard ruby app
usage
# will need a deploy key
gem 'appraisermetrics_report_service', git: 'https://github.com/StackPointCloud/appraisermetrics-report-service.git'
require 'appraisermetrics_report_service'
ClosedSale
c = ClosedSale.new do
write_content(ruby_hash_object, images, office_logo) # => returns ClosedSaleObject which inherits from Prawn::Document
end
# ruby_hash_object is identical to Comp document, with references to the Mongo Shell removed (ISODate, ObjectID)
# images takes an array of image paths. [0] should be the profile image for the property
# office_logo takes a file path
EvalReport
# generate an eval report
r = EvalReport.new do
write_content(subject, comparables, logo, docs={})
# docs is an optional hash. All keys are should be filepaths, with the exception of
# :subjectphotos which is an Array of filepaths,
# subject is a hash, comparables is an array, logo is a filepath
end
Output
# render it to file
r.render_file("some_name.pdf") => local directory pdf called "some_name" with extension .pdf
# stringIO
StringIO.new(r.render) => <StringIO>
Testing/Dev
- Rspec suite covers table methods invidually, as well as helper methods.
- The
pdf-reader
gem is used in specs to read content into tests - The
Sampler
class is used to generate sample ruby objects to be used in specs.
To generate test pdf reports:
irb
load './spec/test_data/sampler'
# closed sale
Sampler.test_closed_sale
# eval report
Sampler.test_eval_report