icanhazpdf 0.0.4.1 → 0.0.4.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
2
  SHA1:
3
- metadata.gz: 1d55a40bcefdecf4596c1f85eae4f36e3f649d3d
4
- data.tar.gz: 5bdbcccf09813d2fc47e8abfcb7fede9b1170695
3
+ metadata.gz: 29d92c7f6514403cf7f58a68e1a41f6782da51a5
4
+ data.tar.gz: 644f4818c62cf2cbd40b74f2f06bcd03ea68a5d2
5
5
  SHA512:
6
- metadata.gz: 656a9f9e8f9271bcb20be75c1ad7700d0db9963329716b543a6344dbfa47558b5cb68e323adf32caed751c5694e9480f6ba37ea85e6b313bfc2f8ce5ef45684c
7
- data.tar.gz: 2b064d01fd2a1d2c7fd2cb0a9edf53ab77fa975cfe38027dcddafc419a9867886c9a2d689b2de32846b3c6f8851d668dfdf3eb76a0cfa06c8ec02aa042db22d2
6
+ metadata.gz: 2fb4be6777b2a15d9bbedc61142e316fa3bb361b10e31438bf7fa825da838c16c15d0547468ed06ef07dc835bffced5b00115d624cb92b07a98f5ca3d6bc6441
7
+ data.tar.gz: b8c7b365ef97751200cf79b36d21e086b88c17adb700ca4eaa627630a4db9b8f7fc9259c5f9e65cbef0ea6c089c9d4db00f98c8cbdf80a3defe2214569ce4592
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- icanhazpdf (0.0.4)
4
+ icanhazpdf (0.0.4.1)
5
5
  activesupport (~> 4.0)
6
6
  httparty (~> 0.13)
7
7
 
data/README.md CHANGED
@@ -5,7 +5,17 @@ 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.3'
8
+ gem 'icanhazpdf', '~> 0.0.4'
9
+
10
+ ## Rails configuration
11
+
12
+ You can configure some aspects of the client in your rails environment config
13
+
14
+ config.icanhazpdf_api_key = 'this needs to be configured to your api key'
15
+ config.icanhazpdf_url = 'http://use.this.to.override.the.service/endpoint'
16
+
17
+ if you dont override the service (and why would you?) it will hit the default
18
+ icanhazpdf service
9
19
 
10
20
  ## Client
11
21
 
@@ -40,6 +50,7 @@ To render a pdf using a previous response from the Client use:
40
50
  class MyController < ApplicationController
41
51
  include Icanhazpdf::Controller::Renderer
42
52
 
53
+
43
54
  def my_action
44
55
  pdf_response = Icanhazpdf::Client.new.pdf_from_url my_resource_url(resource)
45
56
 
@@ -49,6 +60,14 @@ To render a pdf using a previous response from the Client use:
49
60
  end
50
61
  end
51
62
 
63
+ ## PDF Engine
64
+
65
+ By default ICanHazPdf uses phantomjs to generate pdfs. You can also now choose to
66
+ use wkhtmltopdf. To enable this you need to pass this option into the client or controller
67
+ request. e.g.
68
+
69
+ pdf_response = Icanhazpdf::Client.new.pdf_from_url my_resource_url(resource), true
70
+
52
71
  ## Authentication
53
72
 
54
73
  Checks the current request being made is coming from the icanhazpdf service and
@@ -27,7 +27,7 @@ module Icanhazpdf
27
27
  rescue
28
28
  service_url = Icanhazpdf::Client.default_service_url
29
29
  end
30
- encoded_url = "#{service_url}?url=#{URI.encode(uri.to_s).gsub(':', '%3A').gsub('/', '%2F').gsub('?', '%3F').gsub('=', '%3D')}"
30
+ encoded_url = "#{service_url}?url=#{URI.encode(uri.to_s).gsub(':', '%3A').gsub('/', '%2F').gsub('?', '%3F').gsub('=', '%3D').gsub('&', '%26')}"
31
31
  encoded_url += "&use_wkhtmltopdf=true" if use_wkhtmltopdf
32
32
  HTTParty.get(encoded_url, :timeout => 10000)
33
33
  end
@@ -1,3 +1,3 @@
1
1
  module Icanhazpdf
2
- VERSION = "0.0.4.1"
2
+ VERSION = "0.0.4.2"
3
3
  end
@@ -3,7 +3,7 @@ require 'httparty'
3
3
 
4
4
  describe 'Icanhazpdf::Client' do
5
5
 
6
- let(:a_url) { "http://a.url.to/generate_a_pdf_from?with=querystring" }
6
+ let(:a_url) { "http://a.url.to/generate_a_pdf_from?with=querystring&language=english" }
7
7
  subject { Icanhazpdf::Client.new }
8
8
 
9
9
  describe 'generating a pdf from' do
@@ -33,7 +33,7 @@ describe 'Icanhazpdf::Client' do
33
33
  end
34
34
 
35
35
  it 'url encodes the address of the page to create a pdf from' do
36
- expect(HTTParty).to receive(:get).with(include("http%3A%2F%2Fa.url.to%2Fgenerate_a_pdf_from%3Fwith%3Dquerystring"), be_an(Hash))
36
+ expect(HTTParty).to receive(:get).with(include("http%3A%2F%2Fa.url.to%2Fgenerate_a_pdf_from%3Fwith%3Dquerystring%26language%3Denglish"), be_an(Hash))
37
37
  @result = subject.pdf_from_url a_url
38
38
  end
39
39
 
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.4.1
4
+ version: 0.0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nic Pillinger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-07 00:00:00.000000000 Z
11
+ date: 2014-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler