receipts 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/README.md +3 -1
- data/Rakefile +3 -1
- data/examples/invoice.pdf +0 -0
- data/examples/receipt.pdf +0 -0
- data/examples/statement.pdf +0 -0
- data/lib/receipts/base.rb +3 -6
- data/lib/receipts/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a074319e14c0aaf9a5e4776d854c90810273092e58d7672046f7a6ef4d01a6d5
|
4
|
+
data.tar.gz: e4d3bf9feb0a135357a6666ca46a8c9298d0d623223101c0649c7c9b2b45248f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e22ececba2faf58b41ed4b677bbf351b6dadb51eb0c2e54b9930949eceb7bbc68d29aba7a642e44c47d76d9486669d324cd642befb920576398a13d392e8e303
|
7
|
+
data.tar.gz: 179cbdbf4fbaa3de6de2d1e76a0c9087bc91b9fa36c639f3d5824f112a32a1199662fd0ae87efa3d18f69be6744d3762e495e85cb111e67106a7bde81b90c7e3
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
### Unreleased
|
2
2
|
|
3
|
+
* Add `display: []` for configuring company details that are rendered
|
4
|
+
|
5
|
+
```ruby
|
6
|
+
r = Receipts::Receipt.new(
|
7
|
+
company: {
|
8
|
+
name: "Example, LLC",
|
9
|
+
address: "123 Fake Street\nNew York City, NY 10012",
|
10
|
+
phone: "(555) 867-5309",
|
11
|
+
email: "support@example.com",
|
12
|
+
iban: "123456789",
|
13
|
+
logo: File.expand_path("./examples/images/logo.png"),
|
14
|
+
display: [:address, :phone, :email, :iban]
|
15
|
+
},
|
16
|
+
# ...
|
17
|
+
)
|
18
|
+
```
|
19
|
+
|
3
20
|
### 2.3.0
|
4
21
|
|
5
22
|
* Add `column_widths:` option to specify line item column widths #35
|
data/README.md
CHANGED
@@ -107,6 +107,8 @@ You can pass the following options to generate a PDF:
|
|
107
107
|
logo: "https://www.ruby-lang.org/images/header-ruby-logo@2x.png" # Downloaded with OpenURI
|
108
108
|
```
|
109
109
|
|
110
|
+
* `display: []` - Customize the company details rendered. By default, renders `[:address, :phone, :email]` under the company name. Items in the array should be Symbols matching keys in the `company` hash to be displayed.
|
111
|
+
|
110
112
|
* `details` - Array of details about the Receipt, Invoice, Statement. Typically, this is receipt numbers, issue date, due date, status, etc.
|
111
113
|
|
112
114
|
* `line_items` - Array of line items to be displayed in table format.
|
@@ -151,7 +153,7 @@ If not set, it will fall back to Prawn's default behavior.
|
|
151
153
|
|
152
154
|
`details` and `line_items` allow inline formatting with Prawn. This allows you to use HTML tags to format text: `<b>` `<i>` `<u>` `<strikethrough>` `<sub>` `<sup>` `<font>` `<color>` `<link>`
|
153
155
|
|
154
|
-
See [the Prawn docs](https://prawnpdf.org/
|
156
|
+
See [the Prawn docs](https://prawnpdf.org/) for more information.
|
155
157
|
|
156
158
|
#### Page Size
|
157
159
|
|
data/Rakefile
CHANGED
@@ -36,7 +36,9 @@ task :receipt do
|
|
36
36
|
address: "123 Fake Street\nNew York City, NY 10012",
|
37
37
|
phone: "(555) 867-5309",
|
38
38
|
email: "support@example.com",
|
39
|
-
|
39
|
+
iban: "123456789",
|
40
|
+
logo: File.expand_path("./examples/images/logo.png"),
|
41
|
+
display: [:address, :phone, :email, nil, :iban]
|
40
42
|
},
|
41
43
|
details: [
|
42
44
|
["Receipt Number", "123"],
|
data/examples/invoice.pdf
CHANGED
Binary file
|
data/examples/receipt.pdf
CHANGED
Binary file
|
data/examples/statement.pdf
CHANGED
Binary file
|
data/lib/receipts/base.rb
CHANGED
@@ -64,14 +64,11 @@ module Receipts
|
|
64
64
|
table(details, cell_style: {borders: [], inline_format: true, padding: [0, 8, 2, 0]})
|
65
65
|
end
|
66
66
|
|
67
|
-
def render_billing_details(company:, recipient:, margin_top: 16)
|
67
|
+
def render_billing_details(company:, recipient:, margin_top: 16, display_values: nil)
|
68
68
|
move_down margin_top
|
69
69
|
|
70
|
-
|
71
|
-
|
72
|
-
company[:phone],
|
73
|
-
company[:email]
|
74
|
-
].compact.join("\n")
|
70
|
+
display_values ||= company.fetch(:display, [:address, :phone, :email])
|
71
|
+
company_details = company.values_at(*display_values).compact.join("\n")
|
75
72
|
|
76
73
|
line_items = [
|
77
74
|
[
|
data/lib/receipts/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: receipts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Oliver
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-03-
|
11
|
+
date: 2024-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: prawn
|