br_danfe 0.5.0 → 0.5.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
  SHA1:
3
- metadata.gz: 8a03910608818abb364dc68c53b9095e7aff9dbb
4
- data.tar.gz: 4949df7729a2b0dcb6ab9cdd3136c68691547c7c
3
+ metadata.gz: d2f5317a482b552f18b98288189e62ebb8543ced
4
+ data.tar.gz: 998323f1c9d60ac76a97463116583a075bc195d8
5
5
  SHA512:
6
- metadata.gz: fbec713c6bf4846880b2830f74e99602d684a8079f6504a46c4bc321474fbabd9b8b1a8a351b44207824107f781c9d36b3d3dbe6290c62ca146d2cd5b01521fc
7
- data.tar.gz: a40aa73ba837ea6f58413c50ba8cec0b62443934492c6bdbb0d0d96256f7cc0c281221ca65c0ffafef2947143b72550a6d3d9fb0d7849321b46386aa8ffbe2d6
6
+ metadata.gz: 23fc0c24cabdb273990ad058525c42a79aa9eba5613c42a75f16dd8dc4c9a3256bece7da8cc12c89c454103f34a811eac31529ba53e4c831d842b667c0437f48
7
+ data.tar.gz: 0c4a632de0771b144e63981b8bbd8f3e34498a94d0d51961eb3b9fcbda8b83f498ebabec1ef33756e36961f8589bb9d0c99c1597c06468f85f5070001350a2c3
@@ -58,7 +58,7 @@ module BrDanfe
58
58
 
59
59
  def repeat_on_each_page
60
60
  DanfeLib::Ticket.new(@pdf, @xml).render
61
- DanfeLib::EmitHeader.new(@pdf, @xml, @options.logo_path).render
61
+ DanfeLib::EmitHeader.new(@pdf, @xml, @options.logo).render
62
62
  DanfeLib::Emit.new(@pdf, @xml).render
63
63
  DanfeLib::Dest.new(@pdf, @xml).render
64
64
  DanfeLib::Dup.new(@pdf, @xml).render
@@ -1,10 +1,10 @@
1
1
  module BrDanfe
2
2
  module DanfeLib
3
3
  class EmitHeader
4
- def initialize(pdf, xml, logo_path)
4
+ def initialize(pdf, xml, logo)
5
5
  @pdf = pdf
6
6
  @xml = xml
7
- @logo_path = logo_path
7
+ @logo = logo
8
8
  end
9
9
 
10
10
  def render
@@ -21,13 +21,13 @@ module BrDanfe
21
21
  @pdf.ibox 3.92, 7.46, 0.75, 4.22, "", @xml["emit/xNome"],
22
22
  { size: 12, align: :center, border: 0, style: :bold }
23
23
 
24
- if @logo_path.empty?
24
+ if @logo.blank?
25
25
  @pdf.ibox 3.92, 7.46, 1.25, 5.42, "", address, { align: :left, border: 0 }
26
26
  else
27
27
  @pdf.ibox 3.92, 7.46, 3.25, 5.42, "", address,
28
28
  { size: 8, align: :left, border: 0 }
29
29
 
30
- @pdf.image @logo_path, at: [1.0.cm, Helper.invert(5.42.cm)],
30
+ @pdf.image @logo, at: [1.0.cm, Helper.invert(5.42.cm)],
31
31
  width: 2.cm
32
32
  end
33
33
  end
@@ -2,7 +2,7 @@ module BrDanfe
2
2
  module DanfeLib
3
3
  class Options < OpenStruct
4
4
  DEFAULTOPTIONS = {
5
- logo_path: "",
5
+ logo: "",
6
6
  products_quantity_precision: 2,
7
7
  products_unit_price_precision: 2
8
8
  }
@@ -1,3 +1,3 @@
1
1
  module BrDanfe
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -26,7 +26,7 @@ describe BrDanfe::Danfe do
26
26
  expect(File.exist?(output_pdf)).to be_falsey
27
27
 
28
28
  danfe = BrDanfe::Danfe.new(File.read("#{base_dir}nfe_simples_nacional.xml"))
29
- danfe.options.logo_path = "spec/fixtures/logo.png"
29
+ danfe.options.logo = "spec/fixtures/logo.png"
30
30
  danfe.options.products_unit_price_precision = 4
31
31
  danfe.options.products_quantity_precision = 4
32
32
 
@@ -60,9 +60,9 @@ describe BrDanfe::DanfeLib::EmitHeader do
60
60
  end
61
61
 
62
62
  context "with logo" do
63
- let(:logo_path) { "spec/fixtures/logo.png" }
63
+ let(:logo) { "spec/fixtures/logo.png" }
64
64
 
65
- subject { described_class.new(pdf, xml, logo_path) }
65
+ subject { described_class.new(pdf, xml, logo) }
66
66
 
67
67
  it "renders xml to the pdf" do
68
68
  expect(File.exist?(output_pdf)).to be_falsey
@@ -3,17 +3,17 @@ require "spec_helper"
3
3
  describe BrDanfe::DanfeLib::Options do
4
4
  it "returns the default config set in the code" do
5
5
  options = BrDanfe::DanfeLib::Options.new
6
- expect(options.logo_path).to eq("")
6
+ expect(options.logo).to eq("")
7
7
  expect(options.products_unit_price_precision).to eq(2)
8
8
  expect(options.products_quantity_precision).to eq(2)
9
9
  end
10
10
 
11
11
  it "returns the config set in params" do
12
- custom_options = { logo_path: "/fake/path/file.png",
12
+ custom_options = { logo: "/fake/path/file.png",
13
13
  products_unit_price_precision: 3, products_quantity_precision: 4 }
14
14
 
15
15
  options = BrDanfe::DanfeLib::Options.new(custom_options)
16
- expect(options.logo_path).to eq("/fake/path/file.png")
16
+ expect(options.logo).to eq("/fake/path/file.png")
17
17
  expect(options.products_unit_price_precision).to eq(3)
18
18
  expect(options.products_quantity_precision).to eq(4)
19
19
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: br_danfe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ASSEINFO
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-15 00:00:00.000000000 Z
11
+ date: 2016-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri