appraisermetrics_report_service 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1636e2ee5c97a81021794dc71ac8c49956ecc06e
4
- data.tar.gz: 5bb6f84f088ae66e32edcb84c414d6169309e492
3
+ metadata.gz: 0f325f462ad292bd28e892742d70d0cb058276b1
4
+ data.tar.gz: b0f7034d9400b0a0f936d4362a1ab0d06600f823
5
5
  SHA512:
6
- metadata.gz: 3393a08515e9e51bfb30c9cd0a31c884ec9ab2317f0b78a01e75202aeaccb77016e55936d90da05089986d9cf4ebe6d47a94b8c83866ebd94161290f2bbee59f
7
- data.tar.gz: 3a1c7e7b48d80261efbf458ef4c1b70890c2f077eb69aff4a849dba13c33c3d931513bb409dcb8c1f0ab6f3d20a064b6a16739b25a422a23edf10155d13f7776
6
+ metadata.gz: e8809c24fd56d962c911a9e77ba461e0ba304172ea130316916b8992e36e29c3ac37f8d37c5945592d0f6b91df537c00dc1a4a52089d04aff2a7fb11369e528a
7
+ data.tar.gz: 926930e83d783eee5b79dd7d4f648466c5eca3def232f9c4eee221e8af1aa8231cb2e69f95005aa3d70db4ca58d9c22917fa81cb03433305eb0abd45a845ff74
data/README.md CHANGED
@@ -40,12 +40,12 @@ end
40
40
  ```ruby
41
41
  # generate an eval report
42
42
  r = EvalReport.new do
43
- write_content(subject, comparables, images, logo, docs={})
44
- # images is a hash, subject is a hash, comparables is an array, logo is a filepath
45
- # docs is an options hash that will accept file paths for related pdf and image files
46
- end
43
+ write_content(subject, comparables, logo, docs={})
44
+ # docs is an optional hash. All keys are should be filepaths, with the exception of
45
+ # :subjectphotos which is an Array of filepaths,
47
46
 
48
- # image hash construction: {subject_photos: [], regional_maps: [], topo_maps: [], ag_sales_map: String}
47
+ # subject is a hash, comparables is an array, logo is a filepath
48
+ end
49
49
  ```
50
50
 
51
51
  ## Output
@@ -1,3 +1,3 @@
1
1
  module AppraisermetricsReportService
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
data/lib/eval_report.rb CHANGED
@@ -10,17 +10,19 @@ class EvalReport < Prawn::Document
10
10
  super()
11
11
  end
12
12
 
13
- def write_content(subject, comparables, images, logo, docs={}) # main method to populate pdf
13
+ def write_content(subject, comparables, logo, docs={}) # main method to populate pdf
14
14
  # variables used across instance methods
15
15
  @logo = logo
16
16
  @sub = subject
17
17
  @comps = comparables
18
18
  @comps ||= [] # avoid calling methods on nil
19
- @images = images
19
+ @docs = docs
20
20
  @text_blocks = static_strings # Hash of text blocks loaded from .yml
21
21
  @recon_primary_per_acre = [] # used for reconciliation for comparables
22
22
  @recon_secondary_per_acre = [] # ""
23
- @docs = docs
23
+
24
+ # hash for building table of contents from headers/page numbers
25
+ @toc_hash = {}
24
26
 
25
27
  # font defaults to Helvetica
26
28
  font_size 11
@@ -45,6 +47,8 @@ class EvalReport < Prawn::Document
45
47
  addenda_contents
46
48
  addendum_a
47
49
  addendum_b
50
+ additional_docs
51
+ finish_toc
48
52
  end
49
53
 
50
54
  def office_logo
@@ -147,10 +151,10 @@ class EvalReport < Prawn::Document
147
151
  def subject_images
148
152
  header("SUBJECT PHOTOGRAPHS")
149
153
  move_down 10
150
- if @images && @images[:subject_photos]
151
- if @images[:subject_photos][0]
154
+ if @docs && @docs[:subjectphotos]
155
+ if @docs[:subjectphotos][0]
152
156
  image_cap("")
153
- image "#{@images[:subject_photos][0]}", width: 300, position: :center
157
+ image "#{@docs[:subjectphotos][0]}", width: 300, position: :center
154
158
  move_down 2
155
159
  text "Subject Property - Representative Image", align: :center
156
160
  move_down 25
@@ -159,9 +163,9 @@ class EvalReport < Prawn::Document
159
163
  move_cursor_to 350
160
164
  end
161
165
 
162
- if @images[:subject_photos][1]
166
+ if @docs[:subjectphotos][1]
163
167
  image_cap("")
164
- image "#{@images[:subject_photos][1]}", width: 300, position: :center
168
+ image "#{@docs[:subjectphotos][1]}", width: 300, position: :center
165
169
  move_down 2
166
170
  text "Subject Property - Representative Image", align: :center
167
171
  move_down 25
@@ -174,9 +178,9 @@ class EvalReport < Prawn::Document
174
178
  start_new_page
175
179
  header("SUBJECT PHOTOGRAPHS")
176
180
  move_down 10
177
- if @images[:subject_photos][2]
181
+ if @docs[:subjectphotos][2]
178
182
  image_cap("")
179
- image "#{@images[:subject_photos][2]}", width: 300, position: :center
183
+ image "#{@docs[:subjectphotos][2]}", width: 300, position: :center
180
184
  move_down 2
181
185
  text "Subject Property - Representative Image", align: :center
182
186
  move_down 25
@@ -185,9 +189,9 @@ class EvalReport < Prawn::Document
185
189
  move_cursor_to 350
186
190
  end
187
191
 
188
- if @images[:subject_photos][3]
192
+ if @docs[:subjectphotos][3]
189
193
  image_cap("")
190
- image "#{@images[:subject_photos][3]}", width: 300, position: :center
194
+ image "#{@docs[:subjectphotos][3]}", width: 300, position: :center
191
195
  move_down 2
192
196
  text "Subject Property - Representative Image", align: :center
193
197
  move_down 25
@@ -212,21 +216,23 @@ class EvalReport < Prawn::Document
212
216
 
213
217
  def table_of_contents
214
218
  header("TABLE OF CONTENTS")
215
- move_down 25
216
- text "Table of Contents", size: 14
217
- move_down 25
219
+ start_new_page
220
+ end
218
221
 
219
- contents = ["INTRODUCTION", "PROPERTY IDENTIFICATION", "REGIONAL MAPS", "LOCAL MAPS",
220
- "PROPERTY DESCRIPTION", "VALUATION PROCESS", "DIRECT COMPARISON ANALYSIS", "DISCUSSION OF SALES USED",
221
- "AGRICULTURAL SALES MAP", "FINAL VALUE INDICATION","ASSUMPTIONS AND CONDITIONS", "ADDENDA CONTENTS"
222
- ]
222
+ def finish_toc
223
+ go_to_page(5)
224
+ move_down 30
225
+ @toc_hash.each do |k, v|
226
+ float do
227
+ indent(500) do
228
+ text "#{v}"
229
+ end
230
+ end
223
231
 
224
- contents.each do |c|
225
- text "#{c}"
232
+ text "#{k}"
226
233
  stroke_horizontal_rule
227
234
  move_down 5
228
235
  end
229
- start_new_page
230
236
  end
231
237
 
232
238
  def introduction
@@ -309,19 +315,19 @@ class EvalReport < Prawn::Document
309
315
  header("REGIONAL MAPS")
310
316
  move_down 25
311
317
  text "REGIONAL MAPS", size: 14, align: :center
312
- if @images && @images[:regional_maps]
313
- if @images[:regional_maps][0]
318
+ if @docs && @docs[:statemap]
319
+ if @docs[:statemap]
314
320
  image_cap("STATE MAP")
315
- image "#{@images[:regional_maps][0]}", width: 300, position: :center
321
+ image "#{@docs[:statemap]}", width: 300, position: :center
316
322
  move_down 25
317
323
  else
318
324
  text 'No Image', align: :center
319
325
  move_cursor_to 350
320
326
  end
321
327
 
322
- if @images[:regional_maps][1]
328
+ if @docs[:countymap]
323
329
  image_cap("COUNTY MAP")
324
- image "#{@images[:regional_maps][1]}", width: 300, position: :center
330
+ image "#{@docs[:countymap]}", width: 300, position: :center
325
331
  else
326
332
  text 'No Image', align: :center
327
333
  move_cursor_to 350
@@ -340,10 +346,10 @@ class EvalReport < Prawn::Document
340
346
  move_down 25
341
347
  text "MAPS", size: 14, align: :center
342
348
 
343
- if @images && @images[:topo_maps]
344
- if @images[:topo_maps][0]
345
- image_cap("TOPOGRAPHICAL MAPS")
346
- image "#{@images[:topo_maps][0]}", width: 300, position: :center
349
+ if @docs && @docs[:topomap]
350
+ if @docs[:topomap]
351
+ image_cap("TOPOGRAPHICAL MAP")
352
+ image "#{@docs[:topomap]}", width: 300, position: :center
347
353
  move_down 25
348
354
  else
349
355
  text 'No Image', align: :center
@@ -351,9 +357,9 @@ class EvalReport < Prawn::Document
351
357
  end
352
358
 
353
359
 
354
- if @images[:topo_maps][1]
360
+ if @docs[:aerialmap]
355
361
  image_cap("AERIAL FSA MAP")
356
- image "#{@images[:topo_maps][1]}", width: 300, position: :center
362
+ image "#{@docs[:aerialmap]}", width: 300, position: :center
357
363
  else
358
364
  text 'No Image', align: :center
359
365
  end
@@ -823,8 +829,8 @@ class EvalReport < Prawn::Document
823
829
  def ag_sales_map
824
830
  header("AGRICULTURE SALES LOCATION MAP")
825
831
  move_down 50
826
- if @images && @images[:ag_sales_map]
827
- image "#{@images[:ag_sales_map]}", width: 500, position: :center
832
+ if @docs && @docs[:agsalesmap]
833
+ image "#{@docs[:agsalesmap]}", width: 500, position: :center
828
834
  else
829
835
  text 'No Image'
830
836
  end
@@ -947,8 +953,8 @@ class EvalReport < Prawn::Document
947
953
 
948
954
  def addendum_a
949
955
  # if an engagement letter is present, use it as a template for this page
950
- if @docs[:engagement_letter]
951
- start_new_page(template: @docs[:engagement_letter])
956
+ if @docs && @docs[:engagementletter]
957
+ start_new_page(template: @docs[:engagementletter])
952
958
  header("ENGAGEMENT LETTER")
953
959
  else
954
960
  start_new_page
@@ -960,8 +966,8 @@ class EvalReport < Prawn::Document
960
966
 
961
967
  def addendum_b
962
968
 
963
- if @docs[:legal_description]
964
- start_new_page(template: @docs[:legal_description])
969
+ if @docs && @docs[:legaldescription]
970
+ start_new_page(template: @docs[:legaldescription])
965
971
  header("LEGAL DESCRIPTION")
966
972
  else
967
973
  start_new_page
@@ -972,6 +978,36 @@ class EvalReport < Prawn::Document
972
978
  # end of document
973
979
  end
974
980
 
981
+ def additional_docs
982
+ pdf_doc_proc = Proc.new do |doc_key, title|
983
+ if @docs[doc_key]
984
+ start_new_page(template: @docs[doc_key])
985
+ header(title)
986
+ end
987
+ end
988
+
989
+ pdf_doc_proc.call(:warrantydeed, "WARRANTY DEED/TRANSFER DEED")
990
+ pdf_doc_proc.call(:titleinsurancepolicy, "TITLE INSURANCE POLICY")
991
+ pdf_doc_proc.call(:lease, "LEASE")
992
+ pdf_doc_proc.call(:purchaseandsaleagreement, "PURCHASE AND SALE AGREEMENT")
993
+ pdf_doc_proc.call(:fsamap, "FSA MAP")
994
+ pdf_doc_proc.call(:fsa156, "FSA 156")
995
+ pdf_doc_proc.call(:addendum, "ADDENDUM")
996
+ pdf_doc_proc.call(:crpcontracts, "CRP CONTRACTS")
997
+ pdf_doc_proc.call(:floodmap, "FLOOD MAP")
998
+ pdf_doc_proc.call(:platmap, "PLAT MAP")
999
+ pdf_doc_proc.call(:surveymap, "SURVEY MAP")
1000
+ pdf_doc_proc.call(:othermap, "OTHER MAP")
1001
+ pdf_doc_proc.call(:buildingschematics, "BUILDING SCHEMATICS")
1002
+ pdf_doc_proc.call(:irrigationschematics, "IRRIGATION SCHEMATICS")
1003
+ pdf_doc_proc.call(:irrigationequipment, "IRRIGATION/PUMPING EQUIPMENT INVENTORY")
1004
+ pdf_doc_proc.call(:cropcontracts, "CROP CONTRACTS")
1005
+ pdf_doc_proc.call(:cropinsurancehistory, "CROP INSURANCE HISTORY")
1006
+ pdf_doc_proc.call(:timbercruise, "TIMBER CRUISE")
1007
+ pdf_doc_proc.call(:notes, "NOTES")
1008
+ pdf_doc_proc.call(:photos, "PHOTOS")
1009
+ end
1010
+
975
1011
  def prepare_comps_for_calc
976
1012
  @comps.each do |p|
977
1013
  if p[:landclassifications] && p[:landclassifications].any?
@@ -988,6 +1024,13 @@ class EvalReport < Prawn::Document
988
1024
 
989
1025
  def header(page_title)
990
1026
  text "#{page_title} " << "#{page_count - 1}", align: :right
1027
+
1028
+ # build up the hash for table of contents
1029
+ @toc_hash ||= {}
1030
+ if @toc_hash[page_title] == nil
1031
+ @toc_hash[page_title] = page_count - 1
1032
+ end
1033
+
991
1034
  stroke_horizontal_rule
992
1035
  end
993
1036
 
@@ -158,7 +158,7 @@ describe 'eval report class' do
158
158
  it 'renders static content' do
159
159
  @pdf = EvalReport.new do
160
160
  @sub = Sampler.get_eval1
161
- @images = Sampler.sample_eval_images
161
+ @docs = Sampler.sample_eval_docs
162
162
  regional_maps
163
163
  end
164
164
 
@@ -171,7 +171,7 @@ describe 'eval report class' do
171
171
  it 'renders static content' do
172
172
  @pdf = EvalReport.new do
173
173
  @sub = {}
174
- @images = {}
174
+ @docs = {}
175
175
  regional_maps
176
176
  end
177
177
 
@@ -186,7 +186,7 @@ describe 'eval report class' do
186
186
  it 'renders image headers' do
187
187
  @pdf = EvalReport.new do
188
188
  @sub = {}
189
- @images = Sampler.sample_eval_images
189
+ @docs = Sampler.sample_eval_docs
190
190
  topo_maps
191
191
  end
192
192
 
@@ -199,7 +199,7 @@ describe 'eval report class' do
199
199
  it 'renders static content' do
200
200
  @pdf = EvalReport.new do
201
201
  @sub = {}
202
- @images = {}
202
+ @docs = {}
203
203
  topo_maps
204
204
  end
205
205
 
@@ -488,7 +488,7 @@ describe 'eval report class' do
488
488
  it 'renders static content' do
489
489
  @pdf = EvalReport.new do
490
490
  @sub = Sampler.get_eval1
491
- @docs = {engagement_letter: './spec/test_data/pdfs/engagement_letter.pdf'}
491
+ @docs = {engagementletter: './spec/test_data/pdfs/engagement_letter.pdf'}
492
492
  addendum_a
493
493
  end
494
494
 
@@ -499,7 +499,7 @@ describe 'eval report class' do
499
499
  it 'renders dynamic content from keys' do
500
500
  @pdf = EvalReport.new do
501
501
  @sub = Sampler.get_eval1
502
- @docs = {engagement_letter: './spec/test_data/pdfs/engagement_letter.pdf'}
502
+ @docs = {engagementletter: './spec/test_data/pdfs/engagement_letter.pdf'}
503
503
  addendum_a
504
504
  end
505
505
 
@@ -527,7 +527,7 @@ describe 'eval report class' do
527
527
  it 'renders static content' do
528
528
  @pdf = EvalReport.new do
529
529
  @sub = {}
530
- @docs = {legal_description: './spec/test_data/pdfs/legal_description.pdf'}
530
+ @docs = {legaldescription: './spec/test_data/pdfs/legal_description.pdf'}
531
531
  addendum_b
532
532
  end
533
533
 
@@ -538,7 +538,7 @@ describe 'eval report class' do
538
538
  it 'renders inserts dynamic content from pdf' do
539
539
  @pdf = EvalReport.new do
540
540
  @sub = Sampler.get_eval1
541
- @docs = {legal_description: './spec/test_data/pdfs/legal_description.pdf'}
541
+ @docs = {legaldescription: './spec/test_data/pdfs/legal_description.pdf'}
542
542
  addendum_b
543
543
  end
544
544
 
@@ -0,0 +1,69 @@
1
+ %PDF-1.3
2
+ %����
3
+ 1 0 obj
4
+ << /Creator <feff0050007200610077006e>
5
+ /Producer <feff0050007200610077006e>
6
+ >>
7
+ endobj
8
+ 2 0 obj
9
+ << /Type /Catalog
10
+ /Pages 3 0 R
11
+ >>
12
+ endobj
13
+ 3 0 obj
14
+ << /Type /Pages
15
+ /Count 1
16
+ /Kids [5 0 R]
17
+ >>
18
+ endobj
19
+ 4 0 obj
20
+ << /Length 79
21
+ >>
22
+ stream
23
+ q
24
+
25
+ BT
26
+ 36 688.05 Td
27
+ /F1.0 25 Tf
28
+ [<6f7074696f6e616c207465737420646f63>] TJ
29
+ ET
30
+
31
+ Q
32
+
33
+ endstream
34
+ endobj
35
+ 5 0 obj
36
+ << /Type /Page
37
+ /Parent 3 0 R
38
+ /MediaBox [0 0 612.0 792.0]
39
+ /Contents 4 0 R
40
+ /Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
41
+ /Font << /F1.0 6 0 R
42
+ >>
43
+ >>
44
+ >>
45
+ endobj
46
+ 6 0 obj
47
+ << /Type /Font
48
+ /Subtype /Type1
49
+ /BaseFont /Helvetica
50
+ /Encoding /WinAnsiEncoding
51
+ >>
52
+ endobj
53
+ xref
54
+ 0 7
55
+ 0000000000 65535 f
56
+ 0000000015 00000 n
57
+ 0000000109 00000 n
58
+ 0000000158 00000 n
59
+ 0000000215 00000 n
60
+ 0000000344 00000 n
61
+ 0000000522 00000 n
62
+ trailer
63
+ << /Size 7
64
+ /Root 2 0 R
65
+ /Info 1 0 R
66
+ >>
67
+ startxref
68
+ 619
69
+ %%EOF
@@ -17,7 +17,7 @@ class Sampler
17
17
  r = EvalReport.new do
18
18
  comps = []
19
19
  8.times {|c| comps << Sampler.get_comp2}
20
- write_content(Sampler.get_eval1, comps, Sampler.sample_eval_images, Sampler.sample_logo, {engagement_letter: './spec/test_data/pdfs/engagement_letter.pdf'})
20
+ write_content(Sampler.get_eval1, comps, Sampler.sample_logo, Sampler.sample_eval_docs)
21
21
  render_file("eval.pdf")
22
22
  end
23
23
 
@@ -38,23 +38,41 @@ class Sampler
38
38
  ]
39
39
  end
40
40
 
41
- def self.sample_eval_images
42
- images = {
43
- subject_photos: [
41
+ def self.sample_eval_docs
42
+ docs = {
43
+ subjectphotos: [
44
44
  './spec/test_data/images/subject1.jpg',
45
45
  './spec/test_data/images/subject2.jpg',
46
46
  './spec/test_data/images/subject3.jpg',
47
47
  './spec/test_data/images/subject4.jpg'
48
48
  ],
49
- regional_maps: [
50
- './spec/test_data/images/regional1.jpg',
51
- './spec/test_data/images/regional2.jpg'
52
- ],
53
- topo_maps: [
54
- './spec/test_data/images/topo1.jpg',
55
- './spec/test_data/images/topo2.jpg'
56
- ],
57
- ag_sales_map: './spec/test_data/images/ag_sales.jpg'
49
+ engagementletter: './spec/test_data/pdfs/engagement_letter.pdf',
50
+ legaldescription: './spec/test_data/pdfs/legal_description.pdf',
51
+ statemap: './spec/test_data/images/regional1.jpg',
52
+ countymap: './spec/test_data/images/regional2.jpg',
53
+ topomap: './spec/test_data/images/topo1.jpg',
54
+ aerialmap: './spec/test_data/images/topo2.jpg',
55
+ agsalesmap: './spec/test_data/images/ag_sales.jpg',
56
+ warrantydeed: './spec/test_data/pdfs/optional_doc.pdf',
57
+ titleinsurancepolicy: './spec/test_data/pdfs/optional_doc.pdf',
58
+ lease: './spec/test_data/pdfs/optional_doc.pdf',
59
+ purchaseandsaleagreement: './spec/test_data/pdfs/optional_doc.pdf',
60
+ fsamap: './spec/test_data/pdfs/optional_doc.pdf',
61
+ fsa156: './spec/test_data/pdfs/optional_doc.pdf',
62
+ addendum: './spec/test_data/pdfs/optional_doc.pdf',
63
+ crpcontracts: './spec/test_data/pdfs/optional_doc.pdf',
64
+ floodmap: './spec/test_data/pdfs/optional_doc.pdf',
65
+ platmap: './spec/test_data/pdfs/optional_doc.pdf',
66
+ surveymap: './spec/test_data/pdfs/optional_doc.pdf',
67
+ othermap: './spec/test_data/pdfs/optional_doc.pdf',
68
+ buildingschematics: './spec/test_data/pdfs/optional_doc.pdf',
69
+ irrigationschematics: './spec/test_data/pdfs/optional_doc.pdf',
70
+ irrigationequipment: './spec/test_data/pdfs/optional_doc.pdf',
71
+ cropcontracts: './spec/test_data/pdfs/optional_doc.pdf',
72
+ cropinsurancehistory: './spec/test_data/pdfs/optional_doc.pdf',
73
+ timbercruise: './spec/test_data/pdfs/optional_doc.pdf',
74
+ notes: './spec/test_data/pdfs/optional_doc.pdf',
75
+ photos: './spec/test_data/pdfs/optional_doc.pdf'
58
76
  }
59
77
  end
60
78
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appraisermetrics_report_service
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - StackPoint
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-10 00:00:00.000000000 Z
11
+ date: 2015-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ttfunk
@@ -189,6 +189,7 @@ files:
189
189
  - spec/test_data/images/topo2.jpg
190
190
  - spec/test_data/pdfs/engagement_letter.pdf
191
191
  - spec/test_data/pdfs/legal_description.pdf
192
+ - spec/test_data/pdfs/optional_doc.pdf
192
193
  - spec/test_data/sampler.rb
193
194
  homepage: ''
194
195
  licenses: []
@@ -235,4 +236,5 @@ test_files:
235
236
  - spec/test_data/images/topo2.jpg
236
237
  - spec/test_data/pdfs/engagement_letter.pdf
237
238
  - spec/test_data/pdfs/legal_description.pdf
239
+ - spec/test_data/pdfs/optional_doc.pdf
238
240
  - spec/test_data/sampler.rb