icanhazpdf 0.0.5.0 → 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: 2d8427a72b674a8353bec47f070bd4232d0b1e0d
4
- data.tar.gz: d5dad796723b8afbada146405f1c6e696e69e83b
3
+ metadata.gz: d89c8453bb83ede82e17a77f47b7b4f80a7a78d0
4
+ data.tar.gz: d0e9e158d6077e613da20ac9c1f7611379b407ec
5
5
  SHA512:
6
- metadata.gz: 5adc3f10d2657b07e22fa81d4d0cbc2c7d85dd9c3e203425a98e8b4ded523225fa5810ab45258a1b99960308bfad73486d15399001879c018c94643c2226e369
7
- data.tar.gz: 5da95ba9b12e23f7c7d14b0ad2a23778d2266565d0fb51fbb4f6c6b9205fec4c0a4b73624873218a5f636b12002d086f93e00a3d517b94d928fa188e543b8040
6
+ metadata.gz: 001a9f87d9ad48613250987aa9bde715a135a8e96e27e1fdefa20576db89d0061f8f3645115949f11da38dea397d0164040801cfe066088cb8093e4ddf341da0
7
+ data.tar.gz: 982217bdd61402758ab691763bad9678e1d429bc6280f271dcb07f40ab6d3bd7467c2cdff6b7f4a0b2a56339578e84c9a087ae85cedd715d7b68af84de64721d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- icanhazpdf (0.0.4.1)
4
+ icanhazpdf (0.0.5.1)
5
5
  activesupport (~> 4.0)
6
6
  httparty (~> 0.13)
7
7
 
data/README.md CHANGED
@@ -5,7 +5,7 @@ Makes using the icanhazpdf service in a Rails app simples
5
5
 
6
6
  Add this line to your application's Gemfile:
7
7
 
8
- gem 'icanhazpdf', '~> 0.0.4'
8
+ gem 'icanhazpdf', '~> 0.0.5'
9
9
 
10
10
  ## Rails configuration
11
11
 
@@ -43,14 +43,15 @@ To render a pdf (send the file to the browser) from a url use the renderer modul
43
43
 
44
44
  The method takes a url from which to render the pdf and a filename - which is sent
45
45
  to the browser when it saves the file. You can omit the filename and a default
46
- filename is used.
46
+ filename is used. You can also pass options along with the filename such as margin or landscape so a full featured request might look like
47
+
48
+ render_pdf_from my_resource_url(r), {filename: 'bob.pdf', margin: '0cm', landscape: 'true'}
47
49
 
48
50
  To render a pdf using a previous response from the Client use:
49
51
 
50
52
  class MyController < ApplicationController
51
53
  include Icanhazpdf::Controller::Renderer
52
54
 
53
-
54
55
  def my_action
55
56
  pdf_response = Icanhazpdf::Client.new.pdf_from_url my_resource_url(resource)
56
57
 
@@ -28,8 +28,10 @@ module Icanhazpdf
28
28
  service_url = Icanhazpdf::Client.default_service_url
29
29
  end
30
30
  encoded_url = "#{service_url}?url=#{URI.encode(uri.to_s).gsub(':', '%3A').gsub('/', '%2F').gsub('?', '%3F').gsub('=', '%3D').gsub('&', '%26')}"
31
- encoded_url += "&use_wkhtmltopdf=true" if options.has_key?(:use_wkhtmltopdf)
31
+ encoded_url += "&use_wkhtmltopdf=true" if options.has_key?(:use_wkhtmltopdf) && options[:use_wkhtmltopdf] == true
32
32
  encoded_url += "&margin=#{options[:margin]}" if options.has_key?(:margin)
33
+ encoded_url += "&landscape=true" if options.has_key?(:landscape) && options[:landscape] == true
34
+
33
35
  HTTParty.get(encoded_url, :timeout => 10000)
34
36
  end
35
37
 
@@ -10,7 +10,7 @@ module Icanhazpdf
10
10
 
11
11
  # generate and render a pdf from a url
12
12
  def render_pdf_from(url, options = {})
13
- options.slice!(:filename, :use_wkhtmltopdf, :margin)
13
+ options.slice!(:filename, :use_wkhtmltopdf, :margin, :landscape)
14
14
  render_response_for Icanhazpdf::Client.new.pdf_from_url(url, options), options
15
15
  end
16
16
 
@@ -1,3 +1,3 @@
1
1
  module Icanhazpdf
2
- VERSION = "0.0.5.0"
2
+ VERSION = "0.0.5.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: icanhazpdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5.0
4
+ version: 0.0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nic Pillinger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-03 00:00:00.000000000 Z
11
+ date: 2015-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler