check_writer 0.3.0 → 0.3.1
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.
- data/README.rdoc +5 -0
- data/VERSION +1 -1
- data/check_writer.gemspec +5 -1
- data/lib/check_writer/check.rb +8 -2
- data/spec/assets/sample-signature.png +0 -0
- data/spec/assets/test-0.12.0.pdf +0 -0
- data/spec/assets/test-0.6.1.pdf +0 -0
- data/spec/assets/test-0.6.3.pdf +0 -0
- data/spec/assets/two_in_one-0.12.0.pdf +0 -0
- data/spec/assets/two_in_one-0.6.1.pdf +0 -0
- data/spec/assets/two_in_one-0.6.3.pdf +0 -0
- data/spec/assets/with_signature_image-0.12.0.pdf +0 -0
- data/spec/assets/with_signature_image-0.6.1.pdf +0 -0
- data/spec/assets/with_signature_image-0.6.3.pdf +0 -0
- data/spec/assets/with_stubs-0.12.0.pdf +0 -0
- data/spec/assets/with_stubs-0.6.1.pdf +0 -0
- data/spec/assets/with_stubs-0.6.3.pdf +0 -0
- data/spec/check_spec.rb +13 -1
- metadata +7 -3
data/README.rdoc
CHANGED
@@ -66,6 +66,11 @@ include multiple checks on the same PDF:
|
|
66
66
|
pdf = check2.to_prawn(pdf)
|
67
67
|
pdf.render # returns the PDF data for a PDF w/ two checks on two pages
|
68
68
|
|
69
|
+
== Signatures
|
70
|
+
|
71
|
+
Signatures can be included on the checks by setting the +:signature_image_file+ option, which should
|
72
|
+
reference a JPG or PNG image. The recommended dimensions for a signature image are 175px x 40px.
|
73
|
+
|
69
74
|
== Tests
|
70
75
|
|
71
76
|
check_writer uses the appraisal gem to facilitate testing of various versions of prawn. To run the tests using appraisal:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.1
|
data/check_writer.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "check_writer"
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ryan Winograd"]
|
@@ -36,12 +36,16 @@ Gem::Specification.new do |s|
|
|
36
36
|
"lib/check_writer.rb",
|
37
37
|
"lib/check_writer/attribute_formatting.rb",
|
38
38
|
"lib/check_writer/check.rb",
|
39
|
+
"spec/assets/sample-signature.png",
|
39
40
|
"spec/assets/test-0.12.0.pdf",
|
40
41
|
"spec/assets/test-0.6.1.pdf",
|
41
42
|
"spec/assets/test-0.6.3.pdf",
|
42
43
|
"spec/assets/two_in_one-0.12.0.pdf",
|
43
44
|
"spec/assets/two_in_one-0.6.1.pdf",
|
44
45
|
"spec/assets/two_in_one-0.6.3.pdf",
|
46
|
+
"spec/assets/with_signature_image-0.12.0.pdf",
|
47
|
+
"spec/assets/with_signature_image-0.6.1.pdf",
|
48
|
+
"spec/assets/with_signature_image-0.6.3.pdf",
|
45
49
|
"spec/assets/with_stub_table_data-0.12.0.pdf",
|
46
50
|
"spec/assets/with_stub_table_data-0.6.1.pdf",
|
47
51
|
"spec/assets/with_stub_table_data-0.6.3.pdf",
|
data/lib/check_writer/check.rb
CHANGED
@@ -11,7 +11,8 @@ module CheckWriter
|
|
11
11
|
:bank_name, :bank_address, :bank_fraction,
|
12
12
|
:routing_number, :account_number,
|
13
13
|
:amount, :memo,
|
14
|
-
:with_stubs, :stub_table_data, :stub_table_options
|
14
|
+
:with_stubs, :stub_table_data, :stub_table_options,
|
15
|
+
:signature_image_file
|
15
16
|
|
16
17
|
def initialize(attributes={})
|
17
18
|
attributes.reverse_merge!(
|
@@ -162,7 +163,12 @@ module CheckWriter
|
|
162
163
|
end
|
163
164
|
|
164
165
|
def signature
|
165
|
-
|
166
|
+
box_at = [@pdf.bounds.right - inches(2.5), @pdf.bounds.bottom + inches(0.7)]
|
167
|
+
sig_at = [@pdf.bounds.right - inches(2.5), @pdf.bounds.bottom + inches(0.7) + 40]
|
168
|
+
|
169
|
+
@pdf.image @signature_image_file, :at => sig_at if @signature_image_file
|
170
|
+
|
171
|
+
@pdf.bounding_box box_at, :width => inches(2.5) do
|
166
172
|
@pdf.horizontal_rule
|
167
173
|
@pdf.move_down 2
|
168
174
|
# TODO: better currency formatting
|
Binary file
|
data/spec/assets/test-0.12.0.pdf
CHANGED
Binary file
|
data/spec/assets/test-0.6.1.pdf
CHANGED
Binary file
|
data/spec/assets/test-0.6.3.pdf
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/spec/check_spec.rb
CHANGED
@@ -76,7 +76,6 @@ describe "CheckWriter::Check" do
|
|
76
76
|
|
77
77
|
assert_data_matches_file_content('with_stubs', @data)
|
78
78
|
end
|
79
|
-
|
80
79
|
end
|
81
80
|
|
82
81
|
context "with stub table data" do
|
@@ -98,7 +97,20 @@ describe "CheckWriter::Check" do
|
|
98
97
|
|
99
98
|
#assert_data_matches_file_content('with_stub_table_data', @data)
|
100
99
|
end
|
100
|
+
end
|
101
101
|
|
102
|
+
context "with signature image" do
|
103
|
+
before(:each) do
|
104
|
+
@check.signature_image_file = TEST_ASSETS + "/sample-signature.png"
|
105
|
+
@data = @check.to_pdf
|
106
|
+
end
|
107
|
+
|
108
|
+
it "generates a pdf with the signature image on the signature line" do
|
109
|
+
# Use this line to re-write the PDF we test against
|
110
|
+
# write_content_to_file('with_signature_image', @data)
|
111
|
+
|
112
|
+
assert_data_matches_file_content('with_signature_image', @data)
|
113
|
+
end
|
102
114
|
end
|
103
115
|
|
104
116
|
context "#to_prawn" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: check_writer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 1
|
10
|
+
version: 0.3.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Winograd
|
@@ -207,12 +207,16 @@ files:
|
|
207
207
|
- lib/check_writer.rb
|
208
208
|
- lib/check_writer/attribute_formatting.rb
|
209
209
|
- lib/check_writer/check.rb
|
210
|
+
- spec/assets/sample-signature.png
|
210
211
|
- spec/assets/test-0.12.0.pdf
|
211
212
|
- spec/assets/test-0.6.1.pdf
|
212
213
|
- spec/assets/test-0.6.3.pdf
|
213
214
|
- spec/assets/two_in_one-0.12.0.pdf
|
214
215
|
- spec/assets/two_in_one-0.6.1.pdf
|
215
216
|
- spec/assets/two_in_one-0.6.3.pdf
|
217
|
+
- spec/assets/with_signature_image-0.12.0.pdf
|
218
|
+
- spec/assets/with_signature_image-0.6.1.pdf
|
219
|
+
- spec/assets/with_signature_image-0.6.3.pdf
|
216
220
|
- spec/assets/with_stub_table_data-0.12.0.pdf
|
217
221
|
- spec/assets/with_stub_table_data-0.6.1.pdf
|
218
222
|
- spec/assets/with_stub_table_data-0.6.3.pdf
|