receipts 1.1.2 → 2.0.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 +6 -0
- data/Gemfile +5 -0
- data/README.md +187 -183
- data/Rakefile +65 -46
- data/examples/{gorails.png → images/logo.png} +0 -0
- data/examples/images/options.jpg +0 -0
- data/examples/invoice.pdf +0 -0
- data/examples/receipt.pdf +0 -0
- data/examples/statement.pdf +0 -0
- data/lib/receipts/base.rb +102 -0
- data/lib/receipts/invoice.rb +1 -87
- data/lib/receipts/receipt.rb +1 -66
- data/lib/receipts/statement.rb +1 -84
- data/lib/receipts/version.rb +1 -1
- data/lib/receipts.rb +1 -19
- data/receipts.gemspec +18 -13
- metadata +13 -86
- data/.github/FUNDING.yml +0 -12
- data/.github/workflows/ci.yml +0 -36
- data/.gitignore +0 -15
- data/.travis.yml +0 -4
- data/spec/receipts_spec.rb +0 -18
- data/spec/spec_helper.rb +0 -9
File without changes
|
Binary file
|
data/examples/invoice.pdf
CHANGED
Binary file
|
data/examples/receipt.pdf
CHANGED
Binary file
|
data/examples/statement.pdf
CHANGED
Binary file
|
@@ -0,0 +1,102 @@
|
|
1
|
+
module Receipts
|
2
|
+
class Base < Prawn::Document
|
3
|
+
attr_accessor :title, :company
|
4
|
+
|
5
|
+
class << self
|
6
|
+
attr_reader :title
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize(attributes = {})
|
10
|
+
super(page_size: "LETTER")
|
11
|
+
setup_fonts attributes[:font]
|
12
|
+
|
13
|
+
@title = attributes.fetch(:title, self.class.title)
|
14
|
+
|
15
|
+
generate_from(attributes)
|
16
|
+
end
|
17
|
+
|
18
|
+
def generate_from(attributes)
|
19
|
+
return if attributes.empty?
|
20
|
+
|
21
|
+
company = attributes.fetch(:company)
|
22
|
+
header company: company
|
23
|
+
render_details attributes.fetch(:details)
|
24
|
+
render_billing_details company: company, recipient: attributes.fetch(:recipient)
|
25
|
+
render_line_items attributes.fetch(:line_items)
|
26
|
+
render_footer attributes.fetch(:footer, default_message(company: company))
|
27
|
+
end
|
28
|
+
|
29
|
+
def setup_fonts(custom_font = nil)
|
30
|
+
if !!custom_font
|
31
|
+
font_families.update "Primary" => custom_font
|
32
|
+
font "Primary"
|
33
|
+
end
|
34
|
+
|
35
|
+
font_size 8
|
36
|
+
end
|
37
|
+
|
38
|
+
def load_image(logo)
|
39
|
+
if logo.is_a? String
|
40
|
+
logo.start_with?("http") ? URI.parse(logo).open : File.open(logo)
|
41
|
+
else
|
42
|
+
logo
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def header(company: {}, height: 16)
|
47
|
+
logo = company[:logo]
|
48
|
+
|
49
|
+
if logo.nil?
|
50
|
+
text company.fetch(:name), align: :right, style: :bold, size: 16, color: "4b5563"
|
51
|
+
else
|
52
|
+
image load_image(logo), height: height, position: :right
|
53
|
+
end
|
54
|
+
|
55
|
+
move_up height
|
56
|
+
text title, style: :bold, size: 16
|
57
|
+
end
|
58
|
+
|
59
|
+
def render_details(details, margin_top: 16)
|
60
|
+
move_down margin_top
|
61
|
+
table(details, cell_style: {borders: [], inline_format: true, padding: [0, 8, 2, 0]})
|
62
|
+
end
|
63
|
+
|
64
|
+
def render_billing_details(company:, recipient:, margin_top: 16)
|
65
|
+
move_down margin_top
|
66
|
+
|
67
|
+
company_details = [
|
68
|
+
company[:address],
|
69
|
+
company[:phone],
|
70
|
+
company[:email]
|
71
|
+
].compact.join("\n")
|
72
|
+
|
73
|
+
line_items = [
|
74
|
+
[
|
75
|
+
{content: "<b>#{company.fetch(:name)}</b>\n#{company_details}", padding: [0, 12, 0, 0]},
|
76
|
+
{content: Array(recipient).join("\n"), padding: [0, 12, 0, 0]}
|
77
|
+
]
|
78
|
+
]
|
79
|
+
table(line_items, width: bounds.width, cell_style: {borders: [], inline_format: true, overflow: :expand})
|
80
|
+
end
|
81
|
+
|
82
|
+
def render_line_items(line_items, margin_top: 30)
|
83
|
+
move_down margin_top
|
84
|
+
|
85
|
+
borders = line_items.length - 2
|
86
|
+
table(line_items, width: bounds.width, cell_style: {border_color: "eeeeee", inline_format: true}) do
|
87
|
+
cells.padding = 6
|
88
|
+
cells.borders = []
|
89
|
+
row(0..borders).borders = [:bottom]
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def render_footer(message, margin_top: 30)
|
94
|
+
move_down margin_top
|
95
|
+
text message, inline_format: true
|
96
|
+
end
|
97
|
+
|
98
|
+
def default_message(company:)
|
99
|
+
"For questions, contact us anytime at <color rgb='326d92'><link href='mailto:#{company.fetch(:email)}?subject=Question about my receipt'><b>#{company.fetch(:email)}</b></link></color>."
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
data/lib/receipts/invoice.rb
CHANGED
@@ -1,91 +1,5 @@
|
|
1
|
-
require "prawn"
|
2
|
-
require "prawn/table"
|
3
|
-
|
4
1
|
module Receipts
|
5
2
|
class Invoice < Base
|
6
|
-
|
7
|
-
|
8
|
-
def initialize(attributes)
|
9
|
-
@attributes = attributes
|
10
|
-
@id = attributes.fetch(:id)
|
11
|
-
@company = attributes.fetch(:company)
|
12
|
-
@line_items = attributes.fetch(:line_items)
|
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)
|
20
|
-
|
21
|
-
super(page_size: "LETTER")
|
22
|
-
|
23
|
-
setup_fonts if custom_font.any?
|
24
|
-
generate
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
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
|
32
|
-
|
33
|
-
def default_subheading
|
34
|
-
"INVOICE #%{id}"
|
35
|
-
end
|
36
|
-
|
37
|
-
def generate
|
38
|
-
header
|
39
|
-
description
|
40
|
-
invoice_details
|
41
|
-
charge_details
|
42
|
-
footer
|
43
|
-
end
|
44
|
-
|
45
|
-
def header(height: 24)
|
46
|
-
logo = company[:logo]
|
47
|
-
return if logo.nil?
|
48
|
-
image load_image(logo), height: height
|
49
|
-
end
|
50
|
-
|
51
|
-
def description
|
52
|
-
move_down 8
|
53
|
-
text label(subheading % {id: id}), inline_format: true, leading: 4
|
54
|
-
end
|
55
|
-
|
56
|
-
def invoice_details
|
57
|
-
move_down 10
|
58
|
-
font_size 9
|
59
|
-
|
60
|
-
line_items = [
|
61
|
-
[{content: "#{label("BILL TO")}\n#{bill_to}", rowspan: 3, padding: [0, 12, 0, 0]}, "#{label("INVOICE DATE")}\n#{issue_date}"],
|
62
|
-
["#{label("DUE DATE")}\n#{due_date}"],
|
63
|
-
["#{label("STATUS")}\n#{status}"]
|
64
|
-
]
|
65
|
-
table(line_items, width: bounds.width, cell_style: {inline_format: true, overflow: :shrink_to_fit}) do
|
66
|
-
cells.borders = []
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def charge_details
|
71
|
-
move_down 30
|
72
|
-
|
73
|
-
borders = line_items.length - 2
|
74
|
-
|
75
|
-
table(line_items, width: bounds.width, cell_style: {border_color: "cccccc", inline_format: true, overflow: :shrink_to_fit}) do
|
76
|
-
cells.padding = 10
|
77
|
-
cells.borders = []
|
78
|
-
row(0..borders).borders = [:bottom]
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
def footer
|
83
|
-
move_down 30
|
84
|
-
text message, inline_format: true, leading: 4
|
85
|
-
|
86
|
-
move_down 30
|
87
|
-
text company.fetch(:name), inline_format: true
|
88
|
-
text "<color rgb='888888'>#{company.fetch(:address)}</color>", inline_format: true
|
89
|
-
end
|
3
|
+
@title = "Invoice"
|
90
4
|
end
|
91
5
|
end
|
data/lib/receipts/receipt.rb
CHANGED
@@ -1,70 +1,5 @@
|
|
1
1
|
module Receipts
|
2
2
|
class Receipt < Base
|
3
|
-
|
4
|
-
|
5
|
-
def initialize(attributes)
|
6
|
-
@attributes = attributes
|
7
|
-
@id = attributes.fetch(:id)
|
8
|
-
@company = attributes.fetch(:company)
|
9
|
-
@line_items = attributes.fetch(:line_items)
|
10
|
-
@custom_font = attributes.fetch(:font, {})
|
11
|
-
@message = attributes.fetch(:message) { default_message }
|
12
|
-
@subheading = attributes.fetch(:subheading) { default_subheading }
|
13
|
-
|
14
|
-
super(page_size: "LETTER")
|
15
|
-
|
16
|
-
setup_fonts if custom_font.any?
|
17
|
-
generate
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def default_message
|
23
|
-
"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>."
|
24
|
-
end
|
25
|
-
|
26
|
-
def default_subheading
|
27
|
-
"RECEIPT FOR CHARGE #%{id}"
|
28
|
-
end
|
29
|
-
|
30
|
-
def generate
|
31
|
-
header
|
32
|
-
description
|
33
|
-
charge_details
|
34
|
-
footer
|
35
|
-
end
|
36
|
-
|
37
|
-
def header(height: 24)
|
38
|
-
logo = company[:logo]
|
39
|
-
return if logo.nil?
|
40
|
-
image load_image(logo), height: height
|
41
|
-
end
|
42
|
-
|
43
|
-
def description
|
44
|
-
move_down 8
|
45
|
-
text "<color rgb='a6a6a6'>#{subheading % {id: id}}</color>", inline_format: true
|
46
|
-
|
47
|
-
move_down 30
|
48
|
-
text message, inline_format: true, leading: 4
|
49
|
-
end
|
50
|
-
|
51
|
-
def charge_details
|
52
|
-
move_down 30
|
53
|
-
font_size 9
|
54
|
-
|
55
|
-
borders = line_items.length - 2
|
56
|
-
|
57
|
-
table(line_items, width: bounds.width, cell_style: {border_color: "cccccc", inline_format: true}) do
|
58
|
-
cells.padding = 10
|
59
|
-
cells.borders = []
|
60
|
-
row(0..borders).borders = [:bottom]
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def footer
|
65
|
-
move_down 45
|
66
|
-
text company.fetch(:name), inline_format: true
|
67
|
-
text "<color rgb='888888'>#{company.fetch(:address)}</color>", inline_format: true
|
68
|
-
end
|
3
|
+
@title = "Receipt"
|
69
4
|
end
|
70
5
|
end
|
data/lib/receipts/statement.rb
CHANGED
@@ -1,88 +1,5 @@
|
|
1
1
|
module Receipts
|
2
2
|
class Statement < Base
|
3
|
-
|
4
|
-
|
5
|
-
def initialize(attributes)
|
6
|
-
@attributes = attributes
|
7
|
-
@id = attributes.fetch(:id)
|
8
|
-
@company = attributes.fetch(:company)
|
9
|
-
@line_items = attributes.fetch(:line_items)
|
10
|
-
@custom_font = attributes.fetch(:font, {})
|
11
|
-
@message = attributes.fetch(:message) { default_message }
|
12
|
-
@subheading = attributes.fetch(:subheading) { default_subheading }
|
13
|
-
@bill_to = Array(attributes.fetch(:bill_to)).join("\n")
|
14
|
-
@issue_date = attributes.fetch(:issue_date)
|
15
|
-
@start_date = attributes.fetch(:start_date)
|
16
|
-
@end_date = attributes.fetch(:end_date)
|
17
|
-
|
18
|
-
super(page_size: "LETTER")
|
19
|
-
|
20
|
-
setup_fonts if custom_font.any?
|
21
|
-
generate
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
def default_message
|
27
|
-
"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>."
|
28
|
-
end
|
29
|
-
|
30
|
-
def default_subheading
|
31
|
-
"STATEMENT #%{id}"
|
32
|
-
end
|
33
|
-
|
34
|
-
def generate
|
35
|
-
header
|
36
|
-
description
|
37
|
-
statement_details
|
38
|
-
charge_details
|
39
|
-
footer
|
40
|
-
end
|
41
|
-
|
42
|
-
def header(height: 24)
|
43
|
-
logo = company[:logo]
|
44
|
-
return if logo.nil?
|
45
|
-
image load_image(logo), height: height
|
46
|
-
end
|
47
|
-
|
48
|
-
def description
|
49
|
-
move_down 8
|
50
|
-
text label(subheading % {id: id}), inline_format: true, leading: 4
|
51
|
-
end
|
52
|
-
|
53
|
-
def statement_details
|
54
|
-
move_down 10
|
55
|
-
font_size 9
|
56
|
-
|
57
|
-
line_items = [
|
58
|
-
[{content: "#{label("BILL TO")}\n#{bill_to}", rowspan: 3, padding: [0, 12, 0, 0]}, "#{label("INVOICE DATE")}\n#{issue_date}"],
|
59
|
-
["#{label("STATEMENT DATE")}\n#{issue_date}"],
|
60
|
-
["#{label("STATEMENT PERIOD")}\n#{start_date} - #{end_date}"]
|
61
|
-
]
|
62
|
-
table(line_items, width: bounds.width, cell_style: {inline_format: true, overflow: :shrink_to_fit}) do
|
63
|
-
cells.borders = []
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
def charge_details
|
68
|
-
move_down 30
|
69
|
-
|
70
|
-
borders = line_items.length - 2
|
71
|
-
|
72
|
-
table(line_items, width: bounds.width, cell_style: {border_color: "cccccc", inline_format: true}) do
|
73
|
-
cells.padding = 10
|
74
|
-
cells.borders = []
|
75
|
-
row(0..borders).borders = [:bottom]
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
def footer
|
80
|
-
move_down 30
|
81
|
-
text message, inline_format: true, leading: 4
|
82
|
-
|
83
|
-
move_down 30
|
84
|
-
text company.fetch(:name), inline_format: true
|
85
|
-
text "<color rgb='888888'>#{company.fetch(:address)}</color>", inline_format: true
|
86
|
-
end
|
3
|
+
@title = "Statement"
|
87
4
|
end
|
88
5
|
end
|
data/lib/receipts/version.rb
CHANGED
data/lib/receipts.rb
CHANGED
@@ -4,26 +4,8 @@ require "prawn"
|
|
4
4
|
require "prawn/table"
|
5
5
|
|
6
6
|
module Receipts
|
7
|
+
autoload :Base, "receipts/base"
|
7
8
|
autoload :Invoice, "receipts/invoice"
|
8
9
|
autoload :Receipt, "receipts/receipt"
|
9
10
|
autoload :Statement, "receipts/statement"
|
10
|
-
|
11
|
-
class Base < Prawn::Document
|
12
|
-
def setup_fonts
|
13
|
-
font_families.update "Primary" => custom_font
|
14
|
-
font "Primary"
|
15
|
-
end
|
16
|
-
|
17
|
-
def load_image(logo)
|
18
|
-
if logo.is_a? String
|
19
|
-
logo.start_with?("http") ? URI.parse(logo).open : File.open(logo)
|
20
|
-
else
|
21
|
-
logo
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def label(text)
|
26
|
-
"<font size='8'><color rgb='a6a6a6'>#{text}</color></font>"
|
27
|
-
end
|
28
|
-
end
|
29
11
|
end
|
data/receipts.gemspec
CHANGED
@@ -1,27 +1,32 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/receipts/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "receipts"
|
7
7
|
spec.version = Receipts::VERSION
|
8
8
|
spec.authors = ["Chris Oliver"]
|
9
9
|
spec.email = ["excid3@gmail.com"]
|
10
|
+
|
10
11
|
spec.summary = "Receipts for your Rails application that works with any payment provider."
|
11
12
|
spec.description = "Receipts for your Rails application that works with any payment provider."
|
12
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "https://github.com/excid3/receipts"
|
13
14
|
spec.license = "MIT"
|
14
15
|
|
15
|
-
spec.
|
16
|
-
spec.
|
17
|
-
spec.
|
18
|
-
spec.require_paths = ["lib"]
|
16
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
17
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
18
|
+
spec.metadata["changelog_uri"] = "https://github.com/excid3/receipts/blob/master/CHANGELOG.md"
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
spec.
|
23
|
-
|
24
|
-
|
20
|
+
# Specify which files should be added to the gem when it is released.
|
21
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
22
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
23
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
24
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
25
|
+
end
|
26
|
+
end
|
27
|
+
spec.bindir = "exe"
|
28
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
29
|
+
spec.require_paths = ["lib"]
|
25
30
|
|
26
31
|
spec.add_dependency "prawn", ">= 1.3.0", "< 3.0.0"
|
27
32
|
spec.add_dependency "prawn-table", "~> 0.2.1"
|
metadata
CHANGED
@@ -1,85 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: receipts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Oliver
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '10.0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '10.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: pry
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
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'
|
83
13
|
- !ruby/object:Gem::Dependency
|
84
14
|
name: prawn
|
85
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -121,31 +51,30 @@ executables: []
|
|
121
51
|
extensions: []
|
122
52
|
extra_rdoc_files: []
|
123
53
|
files:
|
124
|
-
- ".github/FUNDING.yml"
|
125
|
-
- ".github/workflows/ci.yml"
|
126
|
-
- ".gitignore"
|
127
|
-
- ".travis.yml"
|
128
54
|
- CHANGELOG.md
|
129
55
|
- Gemfile
|
130
56
|
- LICENSE.txt
|
131
57
|
- README.md
|
132
58
|
- Rakefile
|
133
|
-
- examples/
|
59
|
+
- examples/images/logo.png
|
60
|
+
- examples/images/options.jpg
|
134
61
|
- examples/invoice.pdf
|
135
62
|
- examples/receipt.pdf
|
136
63
|
- examples/statement.pdf
|
137
64
|
- lib/receipts.rb
|
65
|
+
- lib/receipts/base.rb
|
138
66
|
- lib/receipts/invoice.rb
|
139
67
|
- lib/receipts/receipt.rb
|
140
68
|
- lib/receipts/statement.rb
|
141
69
|
- lib/receipts/version.rb
|
142
70
|
- receipts.gemspec
|
143
|
-
|
144
|
-
- spec/spec_helper.rb
|
145
|
-
homepage: ''
|
71
|
+
homepage: https://github.com/excid3/receipts
|
146
72
|
licenses:
|
147
73
|
- MIT
|
148
|
-
metadata:
|
74
|
+
metadata:
|
75
|
+
homepage_uri: https://github.com/excid3/receipts
|
76
|
+
source_code_uri: https://github.com/excid3/receipts
|
77
|
+
changelog_uri: https://github.com/excid3/receipts/blob/master/CHANGELOG.md
|
149
78
|
post_install_message:
|
150
79
|
rdoc_options: []
|
151
80
|
require_paths:
|
@@ -161,10 +90,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
161
90
|
- !ruby/object:Gem::Version
|
162
91
|
version: '0'
|
163
92
|
requirements: []
|
164
|
-
rubygems_version: 3.2.
|
93
|
+
rubygems_version: 3.2.32
|
165
94
|
signing_key:
|
166
95
|
specification_version: 4
|
167
96
|
summary: Receipts for your Rails application that works with any payment provider.
|
168
|
-
test_files:
|
169
|
-
- spec/receipts_spec.rb
|
170
|
-
- spec/spec_helper.rb
|
97
|
+
test_files: []
|
data/.github/FUNDING.yml
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
# These are supported funding model platforms
|
2
|
-
|
3
|
-
github: [excid3] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
4
|
-
patreon: # Replace with a single Patreon username
|
5
|
-
open_collective: # Replace with a single Open Collective username
|
6
|
-
ko_fi: # Replace with a single Ko-fi username
|
7
|
-
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
8
|
-
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
9
|
-
liberapay: # Replace with a single Liberapay username
|
10
|
-
issuehunt: # Replace with a single IssueHunt username
|
11
|
-
otechie: # Replace with a single Otechie username
|
12
|
-
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
data/.github/workflows/ci.yml
DELETED
@@ -1,36 +0,0 @@
|
|
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/.gitignore
DELETED
data/.travis.yml
DELETED
data/spec/receipts_spec.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Receipts do
|
4
|
-
it "lets you create a new receipt" do
|
5
|
-
expect(Receipts::Receipt.new(
|
6
|
-
id: 1,
|
7
|
-
product: "GoRails",
|
8
|
-
company: {
|
9
|
-
name: "One Month, Inc.",
|
10
|
-
address: "37 Great Jones\nFloor 2\nNew York City, NY 10012",
|
11
|
-
email: "teachers@onemonth.com"
|
12
|
-
},
|
13
|
-
line_items: [
|
14
|
-
["Product", "GoRails"]
|
15
|
-
]
|
16
|
-
).class.name).to eq("Receipts::Receipt")
|
17
|
-
end
|
18
|
-
end
|