easy_invoices 0.1.0 → 0.1.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.
- checksums.yaml +4 -4
- data/lib/easy_invoices.rb +18 -0
- data/lib/easy_invoices/configuration.rb +10 -0
- data/lib/easy_invoices/generator.rb +5 -1
- data/lib/easy_invoices/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a6f355cd2ba71f396a7ad7a5a6d7da2267f2b0048bdbaf625b4a7d964ab0285
|
4
|
+
data.tar.gz: 6bfc88a05d28f2842725a4d9b47dd93a208dd56192168b9060b2cf5a10ce5106
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f8e1003f1248d8ec1d6f44e933d4d36ee432643d2ba8a5cc778eb65c907f1e21e4170ea8b55285bec3654c147938b0c2058160df3914e81e97df1f9acf580c9
|
7
|
+
data.tar.gz: cb07c66bb2a2f7c7e1a999400fab9581a95a57ea640584c174e00defdc382b907e11d04079710647c583e216164ad49b9f4214fbe4560d9d54f679bb88e4411d
|
data/lib/easy_invoices.rb
CHANGED
@@ -3,8 +3,10 @@ require "easy_invoices/version"
|
|
3
3
|
require "easy_invoices/includer"
|
4
4
|
require "easy_invoices/act"
|
5
5
|
require "easy_invoices/invoice"
|
6
|
+
require "easy_invoices/configuration"
|
6
7
|
|
7
8
|
module EasyInvoices
|
9
|
+
|
8
10
|
class Error < StandardError; end
|
9
11
|
|
10
12
|
BASE_SIGN_SIZE = 200
|
@@ -12,4 +14,20 @@ module EasyInvoices
|
|
12
14
|
ActiveSupport.on_load(:active_record) do
|
13
15
|
extend EasyInvoices::Includer
|
14
16
|
end
|
17
|
+
|
18
|
+
class << self
|
19
|
+
attr_accessor :configuration
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.configuration
|
23
|
+
@configuration ||= Configuration.new
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.reset
|
27
|
+
@configuration = Configuration.new
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.configure
|
31
|
+
yield(configuration)
|
32
|
+
end
|
15
33
|
end
|
@@ -7,6 +7,10 @@ class EasyInvoices::Generator
|
|
7
7
|
self.new(invoice_params, file_name).process
|
8
8
|
end
|
9
9
|
|
10
|
+
def self.storage_dir
|
11
|
+
EasyInvoices.configuration.send(:"#{self.name.demodulize.downcase}_dir") || self::DIR
|
12
|
+
end
|
13
|
+
|
10
14
|
def initialize(invoice_params, file_name)
|
11
15
|
@invoice_params = invoice_params
|
12
16
|
@file_name = file_name.nil? ? "#{SecureRandom.hex}.pdf" : "#{file_name}.pdf"
|
@@ -29,7 +33,7 @@ class EasyInvoices::Generator
|
|
29
33
|
end
|
30
34
|
|
31
35
|
def target_dir
|
32
|
-
Rails.root.join(*self.class
|
36
|
+
Rails.root.join(*self.class.storage_dir)
|
33
37
|
end
|
34
38
|
|
35
39
|
def target_file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy_invoices
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kairat Zhumaniyazov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: wicked_pdf
|
@@ -115,6 +115,7 @@ files:
|
|
115
115
|
- lib/easy_invoices.rb
|
116
116
|
- lib/easy_invoices/act.rb
|
117
117
|
- lib/easy_invoices/base.rb
|
118
|
+
- lib/easy_invoices/configuration.rb
|
118
119
|
- lib/easy_invoices/generator.rb
|
119
120
|
- lib/easy_invoices/includer.rb
|
120
121
|
- lib/easy_invoices/invoice.rb
|