breezy_pdf 1.0.1 → 1.0.2

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
- SHA1:
3
- metadata.gz: 5b80f459f7d3b8bd7ed153b6cf53d768ea8d24ad
4
- data.tar.gz: 7e572f5716b99ddea161aef08fd6f262527bf64a
2
+ SHA256:
3
+ metadata.gz: f700028cc18da914519c80775e1e011ae74f72a012f067a770552390d138e722
4
+ data.tar.gz: 5098f0b576203a449a360122169976e4392b6105224bd2afe4e77d3c4ba08d36
5
5
  SHA512:
6
- metadata.gz: 51d968658beb6a81279c3a9f51043eed2f618758df08beb9e51120b258aadc35ec9961c7a2b36e197d2bd0fe8e7bb8ba8a7036a3a24f8181838ac85173479204
7
- data.tar.gz: 4df71bbfe3a4867264b7357291080de93906411c4f7ab9c547e2723b3f61727b9753676ef53bf088642a54ccabcd29ca5e0c09dc164452c9142375dad5c0c008
6
+ metadata.gz: e95747c3164e861720d145a02c97e72e61455c204ad201ba8aa8cc07646e21765f38e131d8e1f8988c93722b60bec6733a5b1971c36eb5f2f1855cad2725bddc
7
+ data.tar.gz: ec52d297437ecf776f3c2ff0a46dcc8637509333f1a5fd021b39b93d140a492703502740d2ed107e25b31dd3b1183c49c1937624fe7e3a1cb283ee5daf8ecd8e
data/README.md CHANGED
@@ -277,8 +277,9 @@ def invoice_mailer(user, invoice)
277
277
  asset_host = Rails.env.production? ? Rails.application.config.action_controller.asset_host : "http://localhost:3000"
278
278
 
279
279
  metadata = { width: 8.5, width: 11 }
280
-
281
- html = ActionController::Renderer.render(template "invoices/show", assigns: { invoice: invoice }, locals: { current_user: user })
280
+
281
+ renderer = ApplicationController.renderer.new(https: true)
282
+ html = renderer.render(template: "invoices/show", assigns: { invoice: invoice }, locals: { current_user: user })
282
283
  pdf = BreezyPDF::HTML2PDF.new(asset_host, html, metadata)
283
284
 
284
285
  attachments["invoice-#{invoice.id}.pdf"] = pdf.to_file.read
@@ -35,6 +35,7 @@ module BreezyPDF
35
35
  autoload :HTML2PDF, "breezy_pdf/html_2_pdf"
36
36
 
37
37
  BreezyPDFError = Class.new(StandardError)
38
+ AuthError = Class.new(BreezyPDFError)
38
39
 
39
40
  mattr_accessor :secret_api_key
40
41
  @@secret_api_key = nil
@@ -26,6 +26,8 @@ module BreezyPDF
26
26
  private
27
27
 
28
28
  def headers
29
+ raise BreezyPDF::AuthError, "BreezyPDF.secret_api_key is not set" if BreezyPDF.secret_api_key.nil?
30
+
29
31
  {
30
32
  "Content-Type": "application/json",
31
33
  "Authorization": "Bearer #{BreezyPDF.secret_api_key}"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BreezyPDF
4
- VERSION = "1.0.1"
4
+ VERSION = "1.0.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: breezy_pdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Westendorf
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-03 00:00:00.000000000 Z
11
+ date: 2018-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -187,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
187
  version: '0'
188
188
  requirements: []
189
189
  rubyforge_project:
190
- rubygems_version: 2.6.13
190
+ rubygems_version: 2.7.6
191
191
  signing_key:
192
192
  specification_version: 4
193
193
  summary: Ruby client for BreezyPDF.com