docraptor 1.1.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/swagger-config.json CHANGED
@@ -1,5 +1,13 @@
1
1
  {
2
- "gemName": "docraptor",
3
- "moduleName": "DocRaptor",
4
- "gemVersion": "1.1.0"
2
+ "gemName": "docraptor",
3
+ "moduleName": "DocRaptor",
4
+ "gemVersion": "2.0.0",
5
+ "gemAuthor": "Expected Behavior",
6
+ "gemAuthorEmail": "support@docraptor.com",
7
+ "gemHomepage": "https://github.com/docraptor/docraptor-ruby",
8
+ "gemSummary": "A wrapper for the DocRaptor HTML to PDF/XLS service.",
9
+ "gemDescription": "A native client library for the DocRaptor HTML to PDF/XLS service.",
10
+ "gemLicense": "MIT",
11
+ "hideGenerationTimestamp": true,
12
+ "httpUserAgent": "ruby-swagger-#{VERSION}"
5
13
  }
data/test/async.rb CHANGED
@@ -8,10 +8,12 @@ end
8
8
 
9
9
  $docraptor = DocRaptor::DocApi.new
10
10
 
11
+ output_file = "ruby-async.pdf"
12
+
11
13
  create_response = $docraptor.create_async_doc(
12
14
  test: true,
13
15
  document_content: "<html><body>Hello from Ruby</body></html>",
14
- name: "ruby-async.pdf",
16
+ name: output_file,
15
17
  document_type: "pdf",
16
18
  )
17
19
 
@@ -22,4 +24,11 @@ status_response = nil
22
24
  sleep 1
23
25
  end
24
26
 
25
- $docraptor.get_async_doc(status_response.download_id)
27
+ output_payload = $docraptor.get_async_doc(status_response.download_id)
28
+
29
+ File.write(output_file, output_payload)
30
+ output_type = `file -b #{output_file}`
31
+ File.delete output_file
32
+
33
+ raise "Output was not a PDF" unless output_type.start_with?("PDF")
34
+
@@ -0,0 +1,45 @@
1
+ require "bundler/setup"
2
+ Bundler.require
3
+ require 'open-uri'
4
+
5
+ DocRaptor.configure do |dr|
6
+ dr.username = "YOUR_API_KEY_HERE"
7
+ # dr.debugging = true
8
+ end
9
+
10
+ $docraptor = DocRaptor::DocApi.new
11
+
12
+ output_file = "expire-hosted-ruby-sync.pdf"
13
+
14
+ output_payload = $docraptor.create_hosted_async_doc(
15
+ test: true,
16
+ document_content: "<html><body>Hello from Ruby</body></html>",
17
+ name: output_file,
18
+ document_type: "pdf",
19
+ hosted_expires_at: (Time.now + 86400).strftime('%FT%T%:z'), # 1 day from now
20
+ )
21
+
22
+ status_response = nil
23
+ 30.times do
24
+ status_response = $docraptor.get_async_doc_status(output_payload.status_id)
25
+ break if status_response.status == "completed"
26
+ sleep 1
27
+ end
28
+
29
+ actual_document = URI.parse(status_response.download_url).open
30
+ IO.copy_stream(actual_document, output_file)
31
+
32
+ output_type = `file -b #{output_file}`
33
+ File.delete output_file
34
+
35
+ raise "Output was not a PDF" unless output_type.start_with?("PDF")
36
+
37
+ $docraptor.expire(status_response.download_id)
38
+
39
+ begin
40
+ actual_document = URI.parse(status_response.download_url).open
41
+ rescue OpenURI::HTTPError => http_error
42
+ exit 0
43
+ end
44
+
45
+ exit 1
@@ -0,0 +1,29 @@
1
+ require "bundler/setup"
2
+ Bundler.require
3
+ require "open-uri"
4
+
5
+ DocRaptor.configure do |dr|
6
+ dr.username = "YOUR_API_KEY_HERE"
7
+ # dr.debugging = true
8
+ end
9
+
10
+ $docraptor = DocRaptor::DocApi.new
11
+
12
+ output_file = "hosted-ruby-sync.pdf"
13
+
14
+ output_payload = $docraptor.create_hosted_async_doc(
15
+ test: true,
16
+ document_content: "<html><body>Hello from Ruby</body></html>",
17
+ name: output_file,
18
+ document_type: "pdf",
19
+ hosted_expires_at: (Time.now + 86400).strftime('%FT%T%:z'), # 1 day from now
20
+ )
21
+
22
+ status_response = nil
23
+ 30.times do
24
+ status_response = $docraptor.get_async_doc_status(output_payload.status_id)
25
+ break if status_response.status == "completed"
26
+ sleep 1
27
+ end
28
+
29
+
@@ -0,0 +1,28 @@
1
+ require "bundler/setup"
2
+ Bundler.require
3
+ require "open-uri"
4
+
5
+ DocRaptor.configure do |dr|
6
+ dr.username = "YOUR_API_KEY_HERE"
7
+ # dr.debugging = true
8
+ end
9
+
10
+ $docraptor = DocRaptor::DocApi.new
11
+
12
+ output_file = "hosted-ruby-sync.pdf"
13
+
14
+ output_payload = $docraptor.create_hosted_doc(
15
+ test: true,
16
+ document_content: "<html><body>Hello from Ruby</body></html>",
17
+ name: output_file,
18
+ document_type: "pdf",
19
+ hosted_expires_at: (Time.now + 86400).strftime('%FT%T%:z'), # 1 day from now
20
+ )
21
+
22
+ actual_document = URI.parse(output_payload.download_url).open
23
+ IO.copy_stream(actual_document, output_file)
24
+
25
+ output_type = `file -b #{output_file}`
26
+ File.delete output_file
27
+
28
+ raise "Output was not a PDF" unless output_type.start_with?("PDF")
data/test/sync.rb CHANGED
@@ -8,9 +8,17 @@ end
8
8
 
9
9
  $docraptor = DocRaptor::DocApi.new
10
10
 
11
- $docraptor.create_doc(
11
+ output_file = "ruby-sync.pdf"
12
+
13
+ output_payload = $docraptor.create_doc(
12
14
  test: true,
13
15
  document_content: "<html><body>Hello from Ruby</body></html>",
14
- name: "ruby-sync.pdf",
16
+ name: output_file,
15
17
  document_type: "pdf",
16
18
  )
19
+
20
+ File.write(output_file, output_payload)
21
+ output_type = `file -b #{output_file}`
22
+ File.delete output_file
23
+
24
+ raise "Output was not a PDF" unless output_type.start_with?("PDF")
data/test/xlsx.rb CHANGED
@@ -8,9 +8,17 @@ end
8
8
 
9
9
  $docraptor = DocRaptor::DocApi.new
10
10
 
11
- $docraptor.create_doc(
11
+ output_file = "ruby-xlsx.xlsx"
12
+
13
+ output_payload = $docraptor.create_doc(
12
14
  test: true,
13
15
  document_content: "<html><body><table><tr><td>Hello from Ruby</td></tr></table></body></html>",
14
- name: "ruby-xlsx.xlsx",
16
+ name: output_file,
15
17
  document_type: "xlsx",
16
18
  )
19
+
20
+ File.write(output_file, output_payload)
21
+ output_type = `file -b #{output_file}`
22
+ File.delete output_file
23
+
24
+ raise "Output was not an XLSX (zip)" unless output_type.start_with?("Zip")
metadata CHANGED
@@ -1,246 +1,268 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docraptor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
- - Elijah Miller
8
- - Matthew Gordon
9
- autorequire:
7
+ - Expected Behavior
8
+ autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2016-11-03 00:00:00.000000000 Z
11
+ date: 2021-06-01 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: typhoeus
16
15
  requirement: !ruby/object:Gem::Requirement
17
16
  requirements:
18
- - - ~>
17
+ - - "~>"
19
18
  - !ruby/object:Gem::Version
20
- version: '0.2'
21
- - - ! '>='
19
+ version: '1.0'
20
+ - - ">="
22
21
  - !ruby/object:Gem::Version
23
- version: 0.2.1
22
+ version: 1.0.1
24
23
  type: :runtime
25
24
  prerelease: false
26
25
  version_requirements: !ruby/object:Gem::Requirement
27
26
  requirements:
28
- - - ~>
27
+ - - "~>"
29
28
  - !ruby/object:Gem::Version
30
- version: '0.2'
31
- - - ! '>='
29
+ version: '1.0'
30
+ - - ">="
32
31
  - !ruby/object:Gem::Version
33
- version: 0.2.1
32
+ version: 1.0.1
34
33
  - !ruby/object:Gem::Dependency
35
34
  name: json
36
35
  requirement: !ruby/object:Gem::Requirement
37
36
  requirements:
38
- - - ~>
37
+ - - "~>"
39
38
  - !ruby/object:Gem::Version
40
- version: '1.4'
41
- - - ! '>='
39
+ version: '2.1'
40
+ - - ">="
42
41
  - !ruby/object:Gem::Version
43
- version: 1.4.6
42
+ version: 2.1.0
44
43
  type: :runtime
45
44
  prerelease: false
46
45
  version_requirements: !ruby/object:Gem::Requirement
47
46
  requirements:
48
- - - ~>
49
- - !ruby/object:Gem::Version
50
- version: '1.4'
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: 1.4.6
54
- - !ruby/object:Gem::Dependency
55
- name: pry
56
- requirement: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - ~>
59
- - !ruby/object:Gem::Version
60
- version: '0.10'
61
- - - ! '>='
62
- - !ruby/object:Gem::Version
63
- version: 0.10.3
64
- type: :development
65
- prerelease: false
66
- version_requirements: !ruby/object:Gem::Requirement
67
- requirements:
68
- - - ~>
47
+ - - "~>"
69
48
  - !ruby/object:Gem::Version
70
- version: '0.10'
71
- - - ! '>='
49
+ version: '2.1'
50
+ - - ">="
72
51
  - !ruby/object:Gem::Version
73
- version: 0.10.3
52
+ version: 2.1.0
74
53
  - !ruby/object:Gem::Dependency
75
- name: rake
54
+ name: addressable
76
55
  requirement: !ruby/object:Gem::Requirement
77
56
  requirements:
78
- - - ~>
57
+ - - "~>"
79
58
  - !ruby/object:Gem::Version
80
- version: '10.4'
81
- - - ! '>='
59
+ version: '2.3'
60
+ - - ">="
82
61
  - !ruby/object:Gem::Version
83
- version: 10.4.2
84
- type: :development
62
+ version: 2.3.0
63
+ type: :runtime
85
64
  prerelease: false
86
65
  version_requirements: !ruby/object:Gem::Requirement
87
66
  requirements:
88
- - - ~>
67
+ - - "~>"
89
68
  - !ruby/object:Gem::Version
90
- version: '10.4'
91
- - - ! '>='
69
+ version: '2.3'
70
+ - - ">="
92
71
  - !ruby/object:Gem::Version
93
- version: 10.4.2
72
+ version: 2.3.0
94
73
  - !ruby/object:Gem::Dependency
95
74
  name: rspec
96
75
  requirement: !ruby/object:Gem::Requirement
97
76
  requirements:
98
- - - ~>
77
+ - - "~>"
99
78
  - !ruby/object:Gem::Version
100
- version: '3.2'
101
- - - ! '>='
79
+ version: '3.6'
80
+ - - ">="
102
81
  - !ruby/object:Gem::Version
103
- version: 3.2.0
82
+ version: 3.6.0
104
83
  type: :development
105
84
  prerelease: false
106
85
  version_requirements: !ruby/object:Gem::Requirement
107
86
  requirements:
108
- - - ~>
87
+ - - "~>"
109
88
  - !ruby/object:Gem::Version
110
- version: '3.2'
111
- - - ! '>='
89
+ version: '3.6'
90
+ - - ">="
112
91
  - !ruby/object:Gem::Version
113
- version: 3.2.0
92
+ version: 3.6.0
114
93
  - !ruby/object:Gem::Dependency
115
94
  name: vcr
116
95
  requirement: !ruby/object:Gem::Requirement
117
96
  requirements:
118
- - - ~>
97
+ - - "~>"
119
98
  - !ruby/object:Gem::Version
120
- version: '2.9'
121
- - - ! '>='
99
+ version: '3.0'
100
+ - - ">="
122
101
  - !ruby/object:Gem::Version
123
- version: 2.9.3
102
+ version: 3.0.1
124
103
  type: :development
125
104
  prerelease: false
126
105
  version_requirements: !ruby/object:Gem::Requirement
127
106
  requirements:
128
- - - ~>
107
+ - - "~>"
129
108
  - !ruby/object:Gem::Version
130
- version: '2.9'
131
- - - ! '>='
109
+ version: '3.0'
110
+ - - ">="
132
111
  - !ruby/object:Gem::Version
133
- version: 2.9.3
112
+ version: 3.0.1
134
113
  - !ruby/object:Gem::Dependency
135
114
  name: webmock
136
115
  requirement: !ruby/object:Gem::Requirement
137
116
  requirements:
138
- - - ~>
117
+ - - "~>"
139
118
  - !ruby/object:Gem::Version
140
- version: '1.6'
141
- - - ! '>='
119
+ version: '1.24'
120
+ - - ">="
142
121
  - !ruby/object:Gem::Version
143
- version: 1.6.2
122
+ version: 1.24.3
144
123
  type: :development
145
124
  prerelease: false
146
125
  version_requirements: !ruby/object:Gem::Requirement
147
126
  requirements:
148
- - - ~>
127
+ - - "~>"
149
128
  - !ruby/object:Gem::Version
150
- version: '1.6'
151
- - - ! '>='
129
+ version: '1.24'
130
+ - - ">="
152
131
  - !ruby/object:Gem::Version
153
- version: 1.6.2
132
+ version: 1.24.3
154
133
  - !ruby/object:Gem::Dependency
155
134
  name: autotest
156
135
  requirement: !ruby/object:Gem::Requirement
157
136
  requirements:
158
- - - ~>
137
+ - - "~>"
159
138
  - !ruby/object:Gem::Version
160
139
  version: '4.4'
161
- - - ! '>='
140
+ - - ">="
162
141
  - !ruby/object:Gem::Version
163
142
  version: 4.4.6
164
143
  type: :development
165
144
  prerelease: false
166
145
  version_requirements: !ruby/object:Gem::Requirement
167
146
  requirements:
168
- - - ~>
147
+ - - "~>"
169
148
  - !ruby/object:Gem::Version
170
149
  version: '4.4'
171
- - - ! '>='
150
+ - - ">="
172
151
  - !ruby/object:Gem::Version
173
152
  version: 4.4.6
174
153
  - !ruby/object:Gem::Dependency
175
154
  name: autotest-rails-pure
176
155
  requirement: !ruby/object:Gem::Requirement
177
156
  requirements:
178
- - - ~>
157
+ - - "~>"
179
158
  - !ruby/object:Gem::Version
180
159
  version: '4.1'
181
- - - ! '>='
160
+ - - ">="
182
161
  - !ruby/object:Gem::Version
183
162
  version: 4.1.2
184
163
  type: :development
185
164
  prerelease: false
186
165
  version_requirements: !ruby/object:Gem::Requirement
187
166
  requirements:
188
- - - ~>
167
+ - - "~>"
189
168
  - !ruby/object:Gem::Version
190
169
  version: '4.1'
191
- - - ! '>='
170
+ - - ">="
192
171
  - !ruby/object:Gem::Version
193
172
  version: 4.1.2
194
173
  - !ruby/object:Gem::Dependency
195
174
  name: autotest-growl
196
175
  requirement: !ruby/object:Gem::Requirement
197
176
  requirements:
198
- - - ~>
177
+ - - "~>"
199
178
  - !ruby/object:Gem::Version
200
179
  version: '0.2'
201
- - - ! '>='
180
+ - - ">="
202
181
  - !ruby/object:Gem::Version
203
182
  version: 0.2.16
204
183
  type: :development
205
184
  prerelease: false
206
185
  version_requirements: !ruby/object:Gem::Requirement
207
186
  requirements:
208
- - - ~>
187
+ - - "~>"
209
188
  - !ruby/object:Gem::Version
210
189
  version: '0.2'
211
- - - ! '>='
190
+ - - ">="
212
191
  - !ruby/object:Gem::Version
213
192
  version: 0.2.16
214
193
  - !ruby/object:Gem::Dependency
215
194
  name: autotest-fsevent
216
195
  requirement: !ruby/object:Gem::Requirement
217
196
  requirements:
218
- - - ~>
197
+ - - "~>"
219
198
  - !ruby/object:Gem::Version
220
199
  version: '0.2'
221
- - - ! '>='
200
+ - - ">="
222
201
  - !ruby/object:Gem::Version
223
- version: 0.2.11
202
+ version: 0.2.12
224
203
  type: :development
225
204
  prerelease: false
226
205
  version_requirements: !ruby/object:Gem::Requirement
227
206
  requirements:
228
- - - ~>
207
+ - - "~>"
229
208
  - !ruby/object:Gem::Version
230
209
  version: '0.2'
231
- - - ! '>='
210
+ - - ">="
232
211
  - !ruby/object:Gem::Version
233
- version: 0.2.11
212
+ version: 0.2.12
213
+ - !ruby/object:Gem::Dependency
214
+ name: rake
215
+ requirement: !ruby/object:Gem::Requirement
216
+ requirements:
217
+ - - "~>"
218
+ - !ruby/object:Gem::Version
219
+ version: '11.2'
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: 11.2.2
223
+ type: :development
224
+ prerelease: false
225
+ version_requirements: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - "~>"
228
+ - !ruby/object:Gem::Version
229
+ version: '11.2'
230
+ - - ">="
231
+ - !ruby/object:Gem::Version
232
+ version: 11.2.2
233
+ - !ruby/object:Gem::Dependency
234
+ name: pry
235
+ requirement: !ruby/object:Gem::Requirement
236
+ requirements:
237
+ - - "~>"
238
+ - !ruby/object:Gem::Version
239
+ version: '0.10'
240
+ - - ">="
241
+ - !ruby/object:Gem::Version
242
+ version: 0.10.4
243
+ type: :development
244
+ prerelease: false
245
+ version_requirements: !ruby/object:Gem::Requirement
246
+ requirements:
247
+ - - "~>"
248
+ - !ruby/object:Gem::Version
249
+ version: '0.10'
250
+ - - ">="
251
+ - !ruby/object:Gem::Version
252
+ version: 0.10.4
234
253
  description: A native client library for the DocRaptor HTML to PDF/XLS service.
235
254
  email:
236
- - elijah@expectedbehavior.com
237
- - matt@expectedbehavior.com
255
+ - support@docraptor.com
238
256
  executables: []
239
257
  extensions: []
240
258
  extra_rdoc_files: []
241
259
  files:
242
- - .gitignore
243
- - .swagger-revision
260
+ - ".gitignore"
261
+ - ".rspec"
262
+ - ".swagger-codegen-ignore"
263
+ - ".swagger-codegen/VERSION"
264
+ - ".swagger-revision"
265
+ - ".travis.yml"
244
266
  - CHANGELOG.md
245
267
  - Gemfile
246
268
  - LICENSE
@@ -249,6 +271,8 @@ files:
249
271
  - docraptor.gemspec
250
272
  - docraptor.yaml
251
273
  - examples/async.rb
274
+ - examples/hosted_async.rb
275
+ - examples/hosted_sync.rb
252
276
  - examples/sync.rb
253
277
  - lib/docraptor.rb
254
278
  - lib/docraptor/api/doc_api.rb
@@ -256,44 +280,62 @@ files:
256
280
  - lib/docraptor/api_error.rb
257
281
  - lib/docraptor/configuration.rb
258
282
  - lib/docraptor/models/async_doc.rb
259
- - lib/docraptor/models/async_doc_status.rb
260
283
  - lib/docraptor/models/doc.rb
284
+ - lib/docraptor/models/doc_status.rb
261
285
  - lib/docraptor/models/prince_options.rb
262
286
  - lib/docraptor/version.rb
263
287
  - script/clean
288
+ - script/fix_gemspec.rb
264
289
  - script/generate_language
265
290
  - script/post_generate_language
291
+ - script/setup
266
292
  - script/swagger
267
293
  - script/test
268
294
  - script/update_from_upstream
295
+ - spec/api_client_spec.rb
296
+ - spec/configuration_spec.rb
297
+ - spec/spec_helper.rb
269
298
  - swagger-config.json
270
299
  - test/async.rb
300
+ - test/expire_hosted.rb
301
+ - test/hosted_async.rb
302
+ - test/hosted_sync.rb
271
303
  - test/invalid_async.rb
272
304
  - test/invalid_sync.rb
273
305
  - test/sync.rb
274
306
  - test/xlsx.rb
275
307
  homepage: https://github.com/docraptor/docraptor-ruby
276
308
  licenses:
277
- - Apache-2.0
309
+ - MIT
278
310
  metadata: {}
279
- post_install_message:
311
+ post_install_message:
280
312
  rdoc_options: []
281
313
  require_paths:
282
314
  - lib
283
315
  required_ruby_version: !ruby/object:Gem::Requirement
284
316
  requirements:
285
- - - ! '>='
317
+ - - ">="
286
318
  - !ruby/object:Gem::Version
287
- version: '0'
319
+ version: '2.3'
288
320
  required_rubygems_version: !ruby/object:Gem::Requirement
289
321
  requirements:
290
- - - ! '>='
322
+ - - ">="
291
323
  - !ruby/object:Gem::Version
292
324
  version: '0'
293
325
  requirements: []
294
- rubyforge_project:
295
- rubygems_version: 2.6.1
296
- signing_key:
326
+ rubygems_version: 3.2.15
327
+ signing_key:
297
328
  specification_version: 4
298
329
  summary: A wrapper for the DocRaptor HTML to PDF/XLS service.
299
- test_files: []
330
+ test_files:
331
+ - spec/api_client_spec.rb
332
+ - spec/configuration_spec.rb
333
+ - spec/spec_helper.rb
334
+ - test/async.rb
335
+ - test/expire_hosted.rb
336
+ - test/hosted_async.rb
337
+ - test/hosted_sync.rb
338
+ - test/invalid_async.rb
339
+ - test/invalid_sync.rb
340
+ - test/sync.rb
341
+ - test/xlsx.rb