hypdf 1.0.7 → 1.0.8

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: 896d8408643f45ae249bf24538105fd80bcbdca6
4
- data.tar.gz: 7573ab07680be8b9bb1d77271d07b61db9726f5d
3
+ metadata.gz: 13ddafb093b03a2ac278b12ae29ad7de13417ac8
4
+ data.tar.gz: adb8a18dec7ad7dd3c7c5c43de86d241ece18cf4
5
5
  SHA512:
6
- metadata.gz: 04a1f540528650c3c0a4f312803365eb5cad6c449e8bcaf9520a2dc8b271931d9d1cde2721c30cfb4801cd9ce20cecc296086c3cc50a77e03e97ea6d2ee0cdbf
7
- data.tar.gz: 1e1858bece68ce73244c1b509dd2f8c4f41430e7a0fc0ccdd10b300f10b941120eced98e4463efb349278fdbbddd348b69985709e3171b285ca846193dd232aa
6
+ metadata.gz: d86ef5cd53e3a4f1a3612dca1e763f4c59345e3e03ea7c600e47e1b23cf0bd1fce86158658e10a4b05830ede02f668e91919ec098edac16c95b191c7e7c2bed8
7
+ data.tar.gz: 434e4eac562c54e29308b5f3f722e4f96ad94b3361067af792242e05531cab420fd73d89298cfeab338ec5ca2b09a885ad2253d17d195bd2440527e7070f1160
data/hypdf.gemspec CHANGED
@@ -17,5 +17,6 @@ Gem::Specification.new do |gem|
17
17
  gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
19
  gem.require_paths = ["lib"]
20
+ gem.add_dependency "httparty", "0.13.1"
20
21
  gem.add_dependency "httmultiparty", "0.3.10"
21
22
  end
data/lib/hypdf/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class HyPDF
2
- VERSION = "1.0.7"
2
+ VERSION = "1.0.8"
3
3
  end
data/lib/hypdf.rb CHANGED
@@ -101,68 +101,4 @@ class HyPDF
101
101
 
102
102
  end
103
103
 
104
- # Initializes new HyPDF object
105
- #
106
- # @param content [String] HTML document or URL
107
- # @param options [Hash] Authorization and PDF options
108
- # @option options [String] :user If provided, sets user name (by default uses ENV['HYPDF_USER'] variable)
109
- # @option options [String] :password If provided, sets user password (by default uses ENV['HYPDF_PASSWORD'] variable)
110
- #
111
- # Full list of PDF options see on {http://docs.heroku.com HyPDF page}
112
- def initialize(content, options = {})
113
- puts "Warning! This syntax is deprecated and will be removed in the future version, please visit https://devcenter.heroku.com/articles/hypdf for details."
114
- raise HyPDF::ContentRequired if content.nil? || content.empty?
115
- @content = content
116
-
117
- @options = options
118
- @user = @options.delete(:user) || ENV["HYPDF_USER"]
119
- @password = @options.delete(:password) || ENV["HYPDF_PASSWORD"]
120
-
121
- @request_body = { user: @user, password: @password, content: @content, options: @options }
122
- end
123
-
124
- # Generates PDF
125
- #
126
- # @return [String] Binary string containing the generated document or id of asynchronous job
127
- def get
128
- make_request.body
129
- end
130
-
131
- # Generates PDF and uploads it to AWS S3
132
- #
133
- # @param bucket [String] Your S3 bucket name
134
- # @param key [String] Name for generated file
135
- # @param public [Boolean] Sets public read access
136
- # @return [String] Url to generated document or id of asynchronous job
137
- def upload_to_s3(bucket, key, public = false)
138
- @request_body.merge!(bucket: bucket, key: key, public: public)
139
- resp = JSON.parse make_request.body
140
- resp["url"] || resp["id"]
141
- end
142
-
143
- # Returns PDF meta information
144
- # @return [Hash] PDF meta information (nubmer of pages, page size and PDF version)
145
- def meta
146
- {
147
- pages: @last_headers['hypdf-pages'].to_i,
148
- page_size: @last_headers['hypdf-page-size'],
149
- pdf_version: @last_headers['hypdf-pdf-version'].to_f
150
- }
151
- end
152
-
153
- private
154
-
155
- def make_request(options={})
156
- resp = HTTParty.post('https://www.hypdf.com/pdf', options.merge(body: @request_body))
157
- @last_headers = resp.headers
158
- case resp.code
159
- when 200 then resp
160
- when 400 then raise HyPDF::ContentRequired
161
- when 401 then raise HyPDF::AuthorizationRequired
162
- when 402 then raise HyPDF::PaymentRequired
163
- when 404 then raise HyPDF::NoSuchBucket
164
- when 500 then raise HyPDF::InternalServerError
165
- end
166
- end
167
-
168
104
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hypdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - redfield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-08 00:00:00.000000000 Z
11
+ date: 2015-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.13.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.13.1
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: httmultiparty
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -31,8 +45,8 @@ executables: []
31
45
  extensions: []
32
46
  extra_rdoc_files: []
33
47
  files:
34
- - .gitignore
35
- - .rspec
48
+ - ".gitignore"
49
+ - ".rspec"
36
50
  - Gemfile
37
51
  - LICENSE.txt
38
52
  - README.md
@@ -53,17 +67,17 @@ require_paths:
53
67
  - lib
54
68
  required_ruby_version: !ruby/object:Gem::Requirement
55
69
  requirements:
56
- - - '>='
70
+ - - ">="
57
71
  - !ruby/object:Gem::Version
58
72
  version: '0'
59
73
  required_rubygems_version: !ruby/object:Gem::Requirement
60
74
  requirements:
61
- - - '>='
75
+ - - ">="
62
76
  - !ruby/object:Gem::Version
63
77
  version: '0'
64
78
  requirements: []
65
79
  rubyforge_project:
66
- rubygems_version: 2.0.3
80
+ rubygems_version: 2.2.2
67
81
  signing_key:
68
82
  specification_version: 4
69
83
  summary: Ruby wrapper around the HyPDF API