receipts 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7437916678e9856f57b022945c52fb49c3004bc929e77ec2c2d96b049b9231bc
4
- data.tar.gz: 6a5b02fcf9aba5fc5e1e0060acc1403bfe47674f68e9453b3162064181eeb888
3
+ metadata.gz: dfed87396d5ed2beb0064ead6f0ac9ca457e06a7b67427ec8963b9f6404db0ce
4
+ data.tar.gz: a8a4cbff0f9eadf7552ad5a533522dd6e6746cefa548f3d146a7a3e6bb0f07d3
5
5
  SHA512:
6
- metadata.gz: f1685c620c7b21433644ffc6bd153ad0e3f008751f02fe8b888acbec7da03ebba1f0088804742f2b5d71aa46c713fd523655c15eda7a726ff0fe92111ab4f623
7
- data.tar.gz: efd79f9bd4fb9a8e188dff1b149dc1d267d7eb5ca0c38124c976d9b142428c9998927948b6ed57825b8b1ec2f8f8cd8aa54237f6a226f6d0094f4464bfd566df
6
+ metadata.gz: b6f01ec38f45f6d6e2ed3642ef004185e1b52f7d53a23802014e338d52965099865d5e6c0269ee5528c45c959bec4d4a3fcecf1cbc6774190efa424f01f73c51
7
+ data.tar.gz: 338d4628dd34e5af7d4e7de7a00d3c1758b19a26b7fb5c5f1ea561c0f4ce71150841a5c915b20e2270b16e3f63c25ea6d789fe6641a8818b605935fc3b814d63
@@ -0,0 +1,36 @@
1
+ name: Tests
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - '*'
7
+ push:
8
+ branches:
9
+ - master
10
+ jobs:
11
+ tests:
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ matrix:
15
+ ruby: ['2.7', '3.0']
16
+ env:
17
+ BUNDLE_PATH_RELATIVE_TO_CWD: true
18
+
19
+ steps:
20
+ - uses: actions/checkout@master
21
+
22
+ - name: Set up Ruby
23
+ uses: ruby/setup-ruby@v1
24
+ with:
25
+ ruby-version: ${{ matrix.ruby }}
26
+ bundler: default
27
+ bundler-cache: true
28
+
29
+ - name: StandardRb check
30
+ run: bundle exec standardrb
31
+
32
+ - name: Run tests
33
+ env:
34
+ RAILS_ENV: test
35
+ run: |
36
+ bundle exec rspec
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ### Unreleased
2
2
 
3
+ ### 1.1.1
4
+
5
+ * [FIX] Use `URI.parse().open` instead - @excid3 @reckerswartz
6
+ * Add I18n notes to the readme - @excid3 @reckerswartz
7
+ * Add standardrb formatting - @excid3
8
+ * Add GitHub Actions for standardrb and tests - @excid3
9
+
3
10
  ### 1.1.0
4
11
 
5
12
  * [NEW] Add Statements - @anquinn
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in receipts.gemspec
4
4
  gemspec
data/README.md CHANGED
@@ -129,6 +129,17 @@ To use an image from a URL, we recommend using `open-uri` to open the remote fil
129
129
 
130
130
  If you'd like to use your own custom font, you can pass in the file paths to the `normal` and `bold` variations of your font. The bold font variation is required because it is used in the default message. If you wish to override that, you can pass in your own custom message instead.
131
131
 
132
+ #### Internationalization (I18n)
133
+
134
+ You can use `I18n.t` when rendering your receipts to internationalize them.
135
+
136
+ ```ruby
137
+ line_items: [
138
+ [I18n.t("receipts.date"), created_at.to_s],
139
+ [I18n.t("receipts.product"), "GoRails"],
140
+ [I18n.t("receipts.transaction"), uuid]
141
+ ]
142
+ ```
132
143
 
133
144
  ## Rendering the Receipt PDF in your Controller
134
145
 
data/Rakefile CHANGED
@@ -2,11 +2,11 @@ require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
3
  require "open-uri"
4
4
 
5
- RSpec::Core::RakeTask.new('spec')
5
+ RSpec::Core::RakeTask.new("spec")
6
6
 
7
7
  # If you want to make this the default task
8
- task :default => :spec
9
- task :test => :spec
8
+ task default: :spec
9
+ task test: :spec
10
10
 
11
11
  task :console do
12
12
  exec "irb -r receipts -I ./lib"
@@ -26,13 +26,13 @@ task :receipt do
26
26
  logo: URI.open("https://www.ruby-lang.org/images/header-ruby-logo@2x.png")
27
27
  },
28
28
  line_items: [
29
- ["Date", Time.now.to_s],
29
+ ["Date", Time.now.to_s],
30
30
  ["Account Billed", "Example User (user@example.com)"],
31
- ["Product", "GoRails"],
32
- ["Amount", "$19.00"],
33
- ["Charged to", "Visa (**** **** **** 1234)"],
31
+ ["Product", "GoRails"],
32
+ ["Amount", "$19.00"],
33
+ ["Charged to", "Visa (**** **** **** 1234)"],
34
34
  ["Transaction ID", "123456"]
35
- ],
35
+ ]
36
36
  ).render_file "examples/receipt.pdf"
37
37
  end
38
38
 
@@ -49,14 +49,14 @@ task :invoice do
49
49
  "Address",
50
50
  "City, State Zipcode",
51
51
  nil,
52
- "mail@example.com",
52
+ "mail@example.com"
53
53
  ],
54
54
  company: {
55
55
  name: "GoRails, LLC",
56
56
  address: "123 Fake Street\nNew York City, NY 10012",
57
57
  email: "support@example.com",
58
- #logo: Rails.root.join("app/assets/images/gorails.png")
59
- #logo: File.expand_path("./examples/gorails.png")
58
+ # logo: Rails.root.join("app/assets/images/gorails.png")
59
+ # logo: File.expand_path("./examples/gorails.png")
60
60
  logo: File.open("./examples/gorails.png")
61
61
  },
62
62
  line_items: [
@@ -64,8 +64,8 @@ task :invoice do
64
64
  ["GoRails Subscription", "$19.00", "1", "$19.00"],
65
65
  [nil, nil, "Subtotal", "$19.00"],
66
66
  [nil, nil, "Tax Rate", "0%"],
67
- [nil, nil, "Amount Due", "$19.00"],
68
- ],
67
+ [nil, nil, "Amount Due", "$19.00"]
68
+ ]
69
69
  ).render_file "examples/invoice.pdf"
70
70
  end
71
71
 
@@ -82,7 +82,7 @@ task :statement do
82
82
  "123 Fake Street",
83
83
  "New York City, NY 10012",
84
84
  nil,
85
- "mail@example.com",
85
+ "mail@example.com"
86
86
  ],
87
87
  company: {
88
88
  name: "GoRails, LLC",
@@ -95,7 +95,7 @@ task :statement do
95
95
  ["GoRails Subscription", "$19.00", "1", "$19.00"],
96
96
  [nil, nil, "Subtotal", "$19.00"],
97
97
  [nil, nil, "Tax Rate", "0%"],
98
- [nil, nil, "Total", "$19.00"],
99
- ],
98
+ [nil, nil, "Total", "$19.00"]
99
+ ]
100
100
  ).render_file "examples/statement.pdf"
101
101
  end
data/lib/receipts.rb CHANGED
@@ -1,4 +1,8 @@
1
+ require "open-uri"
1
2
  require "receipts/version"
2
- require "receipts/receipt"
3
- require "receipts/invoice"
4
- require "receipts/statement"
3
+
4
+ module Receipts
5
+ autoload :Invoice, "receipts/invoice"
6
+ autoload :Receipt, "receipts/receipt"
7
+ autoload :Statement, "receipts/statement"
8
+ end
@@ -1,22 +1,22 @@
1
- require 'prawn'
2
- require 'prawn/table'
1
+ require "prawn"
2
+ require "prawn/table"
3
3
 
4
4
  module Receipts
5
5
  class Invoice < Prawn::Document
6
6
  attr_reader :attributes, :id, :company, :custom_font, :line_items, :logo, :message, :product, :subheading, :bill_to, :issue_date, :due_date, :status
7
7
 
8
8
  def initialize(attributes)
9
- @attributes = attributes
10
- @id = attributes.fetch(:id)
11
- @company = attributes.fetch(:company)
12
- @line_items = attributes.fetch(:line_items)
9
+ @attributes = attributes
10
+ @id = attributes.fetch(:id)
11
+ @company = attributes.fetch(:company)
12
+ @line_items = attributes.fetch(:line_items)
13
13
  @custom_font = attributes.fetch(:font, {})
14
- @message = attributes.fetch(:message) { default_message }
15
- @subheading = attributes.fetch(:subheading) { default_subheading }
16
- @bill_to = Array(attributes.fetch(:bill_to)).join("\n")
17
- @issue_date = attributes.fetch(:issue_date)
18
- @due_date = attributes.fetch(:due_date)
19
- @status = attributes.fetch(:status)
14
+ @message = attributes.fetch(:message) { default_message }
15
+ @subheading = attributes.fetch(:subheading) { default_subheading }
16
+ @bill_to = Array(attributes.fetch(:bill_to)).join("\n")
17
+ @issue_date = attributes.fetch(:issue_date)
18
+ @due_date = attributes.fetch(:due_date)
19
+ @status = attributes.fetch(:status)
20
20
 
21
21
  super(margin: 0)
22
22
 
@@ -26,100 +26,99 @@ module Receipts
26
26
 
27
27
  private
28
28
 
29
- def default_message
30
- "For questions, contact us anytime at <color rgb='326d92'><link href='mailto:#{company.fetch(:email)}?subject=Charge ##{id}'><b>#{company.fetch(:email)}</b></link></color>."
31
- end
29
+ def default_message
30
+ "For questions, contact us anytime at <color rgb='326d92'><link href='mailto:#{company.fetch(:email)}?subject=Charge ##{id}'><b>#{company.fetch(:email)}</b></link></color>."
31
+ end
32
32
 
33
- def default_subheading
34
- "INVOICE #%{id}"
35
- end
33
+ def default_subheading
34
+ "INVOICE #%{id}"
35
+ end
36
36
 
37
- def setup_fonts
38
- font_families.update "Primary" => custom_font
39
- font "Primary"
40
- end
37
+ def setup_fonts
38
+ font_families.update "Primary" => custom_font
39
+ font "Primary"
40
+ end
41
41
 
42
- def generate
43
- bounding_box [0, 792], width: 612, height: 792 do
44
- bounding_box [85, 792], width: 442, height: 792 do
45
- header
46
- charge_details
47
- footer
48
- end
42
+ def generate
43
+ bounding_box [0, 792], width: 612, height: 792 do
44
+ bounding_box [85, 792], width: 442, height: 792 do
45
+ header
46
+ charge_details
47
+ footer
49
48
  end
50
49
  end
50
+ end
51
51
 
52
- def header
53
- move_down 60
54
-
55
- logo = company[:logo]
52
+ def header
53
+ move_down 60
56
54
 
57
- if logo.nil?
58
- move_down 32
59
- elsif logo.is_a?(String)
60
- image open(logo), height: 32
61
- else
62
- image logo, height: 32
63
- end
55
+ logo = company[:logo]
64
56
 
65
- move_down 8
66
- label (subheading % {id: id})
57
+ if logo.nil?
58
+ move_down 32
59
+ elsif logo.is_a?(String)
60
+ image URI.parse(logo).open, height: 32
61
+ else
62
+ image logo, height: 32
63
+ end
67
64
 
68
- move_down 10
65
+ move_down 8
66
+ label(subheading % {id: id})
69
67
 
70
- # Cache the Y value so we can have both boxes at the same height
71
- top = y
72
- bounding_box([0, y], width: 200) do
73
- label "BILL TO"
68
+ move_down 10
74
69
 
75
- move_down 5
76
- text_box bill_to, at: [0, cursor], width: 200, height: 75, inline_format: true, size: 10, leading: 4, overflow: :shrink_to_fit
70
+ # Cache the Y value so we can have both boxes at the same height
71
+ top = y
72
+ bounding_box([0, y], width: 200) do
73
+ label "BILL TO"
77
74
 
78
- end
75
+ move_down 5
76
+ text_box bill_to, at: [0, cursor], width: 200, height: 75, inline_format: true, size: 10, leading: 4, overflow: :shrink_to_fit
77
+ end
79
78
 
80
- bounding_box([250, top], width: 200) do
81
- label "INVOICE DATE"
79
+ bounding_box([250, top], width: 200) do
80
+ label "INVOICE DATE"
82
81
 
83
- move_down 5
84
- text issue_date.to_s, inline_format: true, size: 12, leading: 4
82
+ move_down 5
83
+ text issue_date.to_s, inline_format: true, size: 12, leading: 4
85
84
 
86
- move_down 10
87
- label "DUE DATE"
85
+ move_down 10
86
+ label "DUE DATE"
88
87
 
89
- move_down 5
90
- text due_date.to_s, inline_format: true, size: 12, leading: 4
88
+ move_down 5
89
+ text due_date.to_s, inline_format: true, size: 12, leading: 4
91
90
 
92
- move_down 10
93
- label "STATUS"
91
+ move_down 10
92
+ label "STATUS"
94
93
 
95
- move_down 5
96
- text status, inline_format: true, size: 12, leading: 4
97
- end
94
+ move_down 5
95
+ text status, inline_format: true, size: 12, leading: 4
98
96
  end
97
+ end
99
98
 
100
- def charge_details
101
- move_down 30
99
+ def charge_details
100
+ move_down 30
102
101
 
103
- borders = line_items.length - 2
102
+ borders = line_items.length - 2
104
103
 
105
- table(line_items, width: bounds.width, cell_style: { border_color: 'cccccc', inline_format: true }) do
106
- cells.padding = 12
107
- cells.borders = []
108
- row(0..borders).borders = [:bottom]
109
- end
104
+ table(line_items, width: bounds.width, cell_style: {border_color: "cccccc", inline_format: true}) do
105
+ cells.padding = 12
106
+ cells.borders = []
107
+ row(0..borders).borders = [:bottom]
110
108
  end
109
+ end
111
110
 
112
- def footer
113
- move_down 30
114
- text message, inline_format: true, size: 12, leading: 4
111
+ def footer
112
+ move_down 30
113
+ text message, inline_format: true, size: 12, leading: 4
115
114
 
116
- move_down 30
117
- text company.fetch(:name), inline_format: true
118
- text "<color rgb='888888'>#{company.fetch(:address)}</color>", inline_format: true
119
- end
115
+ move_down 30
116
+ text company.fetch(:name), inline_format: true
117
+ text "<color rgb='888888'>#{company.fetch(:address)}</color>", inline_format: true
118
+ end
120
119
 
121
- def label(text)
122
- text "<color rgb='a6a6a6'>#{text}</color>", inline_format: true, size: 8
123
- end
120
+ def label(text)
121
+ text "<color rgb='a6a6a6'>#{text}</color>", inline_format: true, size: 8
122
+ end
124
123
  end
125
124
  end
@@ -1,18 +1,18 @@
1
- require 'prawn'
2
- require 'prawn/table'
1
+ require "prawn"
2
+ require "prawn/table"
3
3
 
4
4
  module Receipts
5
5
  class Receipt < Prawn::Document
6
6
  attr_reader :attributes, :id, :company, :custom_font, :line_items, :logo, :message, :product, :subheading
7
7
 
8
8
  def initialize(attributes)
9
- @attributes = attributes
10
- @id = attributes.fetch(:id)
11
- @company = attributes.fetch(:company)
12
- @line_items = attributes.fetch(:line_items)
9
+ @attributes = attributes
10
+ @id = attributes.fetch(:id)
11
+ @company = attributes.fetch(:company)
12
+ @line_items = attributes.fetch(:line_items)
13
13
  @custom_font = attributes.fetch(:font, {})
14
- @message = attributes.fetch(:message) { default_message }
15
- @subheading = attributes.fetch(:subheading) { default_subheading }
14
+ @message = attributes.fetch(:message) { default_message }
15
+ @subheading = attributes.fetch(:subheading) { default_subheading }
16
16
 
17
17
  super(margin: 0)
18
18
 
@@ -22,65 +22,65 @@ module Receipts
22
22
 
23
23
  private
24
24
 
25
- def default_message
26
- "We've received your payment for #{attributes.fetch(:product)}. You can keep this receipt for your records. For questions, contact us anytime at <color rgb='326d92'><link href='mailto:#{company.fetch(:email)}?subject=Charge ##{id}'><b>#{company.fetch(:email)}</b></link></color>."
27
- end
25
+ def default_message
26
+ "We've received your payment for #{attributes.fetch(:product)}. You can keep this receipt for your records. For questions, contact us anytime at <color rgb='326d92'><link href='mailto:#{company.fetch(:email)}?subject=Charge ##{id}'><b>#{company.fetch(:email)}</b></link></color>."
27
+ end
28
28
 
29
- def default_subheading
30
- "RECEIPT FOR CHARGE #%{id}"
31
- end
29
+ def default_subheading
30
+ "RECEIPT FOR CHARGE #%{id}"
31
+ end
32
32
 
33
- def setup_fonts
34
- font_families.update "Primary" => custom_font
35
- font "Primary"
36
- end
33
+ def setup_fonts
34
+ font_families.update "Primary" => custom_font
35
+ font "Primary"
36
+ end
37
37
 
38
- def generate
39
- bounding_box [0, 792], width: 612, height: 792 do
40
- bounding_box [85, 792], width: 442, height: 792 do
41
- header
42
- charge_details
43
- footer
44
- end
38
+ def generate
39
+ bounding_box [0, 792], width: 612, height: 792 do
40
+ bounding_box [85, 792], width: 442, height: 792 do
41
+ header
42
+ charge_details
43
+ footer
45
44
  end
46
45
  end
46
+ end
47
47
 
48
- def header
49
- move_down 60
48
+ def header
49
+ move_down 60
50
50
 
51
- logo = company[:logo]
51
+ logo = company[:logo]
52
52
 
53
- if logo.nil?
54
- move_down 32
55
- elsif logo.is_a?(String)
56
- image open(logo), height: 32
57
- else
58
- image logo, height: 32
59
- end
53
+ if logo.nil?
54
+ move_down 32
55
+ elsif logo.is_a?(String)
56
+ image URI.parse(logo).open, height: 32
57
+ else
58
+ image logo, height: 32
59
+ end
60
60
 
61
- move_down 8
62
- text "<color rgb='a6a6a6'>#{subheading % { id: id }}</color>", inline_format: true
61
+ move_down 8
62
+ text "<color rgb='a6a6a6'>#{subheading % {id: id}}</color>", inline_format: true
63
63
 
64
- move_down 30
65
- text message, inline_format: true, size: 12.5, leading: 4
66
- end
64
+ move_down 30
65
+ text message, inline_format: true, size: 12.5, leading: 4
66
+ end
67
67
 
68
- def charge_details
69
- move_down 30
68
+ def charge_details
69
+ move_down 30
70
70
 
71
- borders = line_items.length - 2
71
+ borders = line_items.length - 2
72
72
 
73
- table(line_items, width: bounds.width, cell_style: { border_color: 'cccccc', inline_format: true }) do
74
- cells.padding = 12
75
- cells.borders = []
76
- row(0..borders).borders = [:bottom]
77
- end
73
+ table(line_items, width: bounds.width, cell_style: {border_color: "cccccc", inline_format: true}) do
74
+ cells.padding = 12
75
+ cells.borders = []
76
+ row(0..borders).borders = [:bottom]
78
77
  end
78
+ end
79
79
 
80
- def footer
81
- move_down 45
82
- text company.fetch(:name), inline_format: true
83
- text "<color rgb='888888'>#{company.fetch(:address)}</color>", inline_format: true
84
- end
80
+ def footer
81
+ move_down 45
82
+ text company.fetch(:name), inline_format: true
83
+ text "<color rgb='888888'>#{company.fetch(:address)}</color>", inline_format: true
84
+ end
85
85
  end
86
86
  end
@@ -1,22 +1,22 @@
1
- require 'prawn'
2
- require 'prawn/table'
1
+ require "prawn"
2
+ require "prawn/table"
3
3
 
4
4
  module Receipts
5
5
  class Statement < Prawn::Document
6
6
  attr_reader :attributes, :id, :company, :custom_font, :line_items, :logo, :message, :product, :subheading, :bill_to, :issue_date, :start_date, :end_date
7
7
 
8
8
  def initialize(attributes)
9
- @attributes = attributes
10
- @id = attributes.fetch(:id)
11
- @company = attributes.fetch(:company)
12
- @line_items = attributes.fetch(:line_items)
9
+ @attributes = attributes
10
+ @id = attributes.fetch(:id)
11
+ @company = attributes.fetch(:company)
12
+ @line_items = attributes.fetch(:line_items)
13
13
  @custom_font = attributes.fetch(:font, {})
14
- @message = attributes.fetch(:message) { default_message }
15
- @subheading = attributes.fetch(:subheading) { default_subheading }
16
- @bill_to = Array(attributes.fetch(:bill_to)).join("\n")
17
- @issue_date = attributes.fetch(:issue_date)
18
- @start_date = attributes.fetch(:start_date)
19
- @end_date = attributes.fetch(:end_date)
14
+ @message = attributes.fetch(:message) { default_message }
15
+ @subheading = attributes.fetch(:subheading) { default_subheading }
16
+ @bill_to = Array(attributes.fetch(:bill_to)).join("\n")
17
+ @issue_date = attributes.fetch(:issue_date)
18
+ @start_date = attributes.fetch(:start_date)
19
+ @end_date = attributes.fetch(:end_date)
20
20
 
21
21
  super(margin: 0)
22
22
 
@@ -26,92 +26,91 @@ module Receipts
26
26
 
27
27
  private
28
28
 
29
- def default_message
30
- "For questions, contact us anytime at <color rgb='326d92'><link href='mailto:#{company.fetch(:email)}?subject=Charge ##{id}'><b>#{company.fetch(:email)}</b></link></color>."
31
- end
29
+ def default_message
30
+ "For questions, contact us anytime at <color rgb='326d92'><link href='mailto:#{company.fetch(:email)}?subject=Charge ##{id}'><b>#{company.fetch(:email)}</b></link></color>."
31
+ end
32
32
 
33
- def default_subheading
34
- "STATEMENT #%{id}"
35
- end
33
+ def default_subheading
34
+ "STATEMENT #%{id}"
35
+ end
36
36
 
37
- def setup_fonts
38
- font_families.update "Primary" => custom_font
39
- font "Primary"
40
- end
37
+ def setup_fonts
38
+ font_families.update "Primary" => custom_font
39
+ font "Primary"
40
+ end
41
41
 
42
- def generate
43
- bounding_box [0, 792], width: 612, height: 792 do
44
- bounding_box [85, 792], width: 442, height: 792 do
45
- header
46
- charge_details
47
- footer
48
- end
42
+ def generate
43
+ bounding_box [0, 792], width: 612, height: 792 do
44
+ bounding_box [85, 792], width: 442, height: 792 do
45
+ header
46
+ charge_details
47
+ footer
49
48
  end
50
49
  end
50
+ end
51
51
 
52
- def header
53
- move_down 60
54
-
55
- logo = company[:logo]
52
+ def header
53
+ move_down 60
56
54
 
57
- if logo.nil?
58
- move_down 32
59
- elsif logo.is_a?(String)
60
- image open(logo), height: 32
61
- else
62
- image logo, height: 32
63
- end
55
+ logo = company[:logo]
64
56
 
65
- move_down 8
66
- label (subheading % {id: id})
57
+ if logo.nil?
58
+ move_down 32
59
+ elsif logo.is_a?(String)
60
+ image URI.parse(logo).open, height: 32
61
+ else
62
+ image logo, height: 32
63
+ end
67
64
 
68
- move_down 10
65
+ move_down 8
66
+ label(subheading % {id: id})
69
67
 
70
- # Cache the Y value so we can have both boxes at the same height
71
- top = y
72
- bounding_box([0, y], width: 200) do
73
- move_down 5
74
- text_box bill_to, at: [0, cursor], width: 200, height: 75, inline_format: true, size: 10, leading: 4, overflow: :shrink_to_fit
68
+ move_down 10
75
69
 
76
- end
70
+ # Cache the Y value so we can have both boxes at the same height
71
+ top = y
72
+ bounding_box([0, y], width: 200) do
73
+ move_down 5
74
+ text_box bill_to, at: [0, cursor], width: 200, height: 75, inline_format: true, size: 10, leading: 4, overflow: :shrink_to_fit
75
+ end
77
76
 
78
- bounding_box([250, top], width: 200) do
79
- label "STATEMENT DATE"
77
+ bounding_box([250, top], width: 200) do
78
+ label "STATEMENT DATE"
80
79
 
81
- move_down 5
82
- text issue_date.to_s, inline_format: true, size: 12, leading: 4
80
+ move_down 5
81
+ text issue_date.to_s, inline_format: true, size: 12, leading: 4
83
82
 
84
- move_down 10
85
- label "STATEMENT PERIOD"
83
+ move_down 10
84
+ label "STATEMENT PERIOD"
86
85
 
87
- move_down 5
88
- text "#{start_date.to_s} - #{end_date.to_s}", inline_format: true, size: 12, leading: 4
89
- end
86
+ move_down 5
87
+ text "#{start_date} - #{end_date}", inline_format: true, size: 12, leading: 4
90
88
  end
89
+ end
91
90
 
92
- def charge_details
93
- move_down 30
91
+ def charge_details
92
+ move_down 30
94
93
 
95
- borders = line_items.length - 2
94
+ borders = line_items.length - 2
96
95
 
97
- table(line_items, width: bounds.width, cell_style: { border_color: 'cccccc', inline_format: true }) do
98
- cells.padding = 12
99
- cells.borders = []
100
- row(0..borders).borders = [:bottom]
101
- end
96
+ table(line_items, width: bounds.width, cell_style: {border_color: "cccccc", inline_format: true}) do
97
+ cells.padding = 12
98
+ cells.borders = []
99
+ row(0..borders).borders = [:bottom]
102
100
  end
101
+ end
103
102
 
104
- def footer
105
- move_down 30
106
- text message, inline_format: true, size: 12, leading: 4
103
+ def footer
104
+ move_down 30
105
+ text message, inline_format: true, size: 12, leading: 4
107
106
 
108
- move_down 30
109
- text company.fetch(:name), inline_format: true
110
- text "<color rgb='888888'>#{company.fetch(:address)}</color>", inline_format: true
111
- end
107
+ move_down 30
108
+ text company.fetch(:name), inline_format: true
109
+ text "<color rgb='888888'>#{company.fetch(:address)}</color>", inline_format: true
110
+ end
112
111
 
113
- def label(text)
114
- text "<color rgb='a6a6a6'>#{text}</color>", inline_format: true, size: 8
115
- end
112
+ def label(text)
113
+ text "<color rgb='a6a6a6'>#{text}</color>", inline_format: true, size: 8
114
+ end
116
115
  end
117
116
  end
@@ -1,3 +1,3 @@
1
1
  module Receipts
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
data/receipts.gemspec CHANGED
@@ -1,28 +1,28 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path("../lib", __FILE__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'receipts/version'
3
+ require "receipts/version"
5
4
 
6
5
  Gem::Specification.new do |spec|
7
- spec.name = "receipts"
8
- spec.version = Receipts::VERSION
9
- spec.authors = ["Chris Oliver"]
10
- spec.email = ["excid3@gmail.com"]
11
- spec.summary = %q{Receipts for your Rails application that works with any payment provider.}
12
- spec.description = %q{Receipts for your Rails application that works with any payment provider.}
13
- spec.homepage = ""
14
- spec.license = "MIT"
6
+ spec.name = "receipts"
7
+ spec.version = Receipts::VERSION
8
+ spec.authors = ["Chris Oliver"]
9
+ spec.email = ["excid3@gmail.com"]
10
+ spec.summary = "Receipts for your Rails application that works with any payment provider."
11
+ spec.description = "Receipts for your Rails application that works with any payment provider."
12
+ spec.homepage = ""
13
+ spec.license = "MIT"
15
14
 
16
- spec.files = `git ls-files -z`.split("\x0")
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
18
  spec.require_paths = ["lib"]
20
19
 
21
20
  spec.add_development_dependency "bundler"
22
21
  spec.add_development_dependency "rake", "~> 10.0"
23
22
  spec.add_development_dependency "rspec"
24
23
  spec.add_development_dependency "pry"
24
+ spec.add_development_dependency "standard"
25
25
 
26
- spec.add_dependency 'prawn', '>= 1.3.0', '< 3.0.0'
27
- spec.add_dependency 'prawn-table', '~> 0.2.1'
26
+ spec.add_dependency "prawn", ">= 1.3.0", "< 3.0.0"
27
+ spec.add_dependency "prawn-table", "~> 0.2.1"
28
28
  end
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe Receipts do
4
4
  it "lets you create a new receipt" do
@@ -11,8 +11,8 @@ describe Receipts do
11
11
  email: "teachers@onemonth.com"
12
12
  },
13
13
  line_items: [
14
- ["Product", "GoRails"],
15
- ],
14
+ ["Product", "GoRails"]
15
+ ]
16
16
  ).class.name).to eq("Receipts::Receipt")
17
17
  end
18
18
  end
data/spec/spec_helper.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  begin
2
- require 'pry'
2
+ require "pry"
3
3
  rescue LoadError
4
4
  end
5
5
 
6
- require 'receipts'
6
+ require "receipts"
7
7
 
8
8
  RSpec.configure do |config|
9
9
  end
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: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Oliver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-25 00:00:00.000000000 Z
11
+ date: 2021-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: standard
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: prawn
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +122,7 @@ extensions: []
108
122
  extra_rdoc_files: []
109
123
  files:
110
124
  - ".github/FUNDING.yml"
125
+ - ".github/workflows/ci.yml"
111
126
  - ".gitignore"
112
127
  - ".travis.yml"
113
128
  - CHANGELOG.md
@@ -146,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
161
  - !ruby/object:Gem::Version
147
162
  version: '0'
148
163
  requirements: []
149
- rubygems_version: 3.2.3
164
+ rubygems_version: 3.2.15
150
165
  signing_key:
151
166
  specification_version: 4
152
167
  summary: Receipts for your Rails application that works with any payment provider.