grabzit 3.3.5 → 3.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/grabzit/client.rb +23 -25
- data/lib/grabzit/docxoptions.rb +33 -3
- data/lib/grabzit/exception.rb +4 -0
- data/lib/grabzit/imageoptions.rb +16 -1
- data/lib/grabzit/pdfoptions.rb +50 -4
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5f7ced35b7951e75dd8c2271cb91d283c7fc3a95fc624f0fd49e80d9a02f585
|
4
|
+
data.tar.gz: 0ecb0c1587c531f8cf310b0aff0ea30532c38dbe5142a917751a924465aaa961
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ae78f89fd639c61c6fe503be859524ae60308e9f04beb8464ac7084f73dd825682d0b88a7f70cc326bc584a19ee131aab89ee900e05721f62bf7f12355dd40d
|
7
|
+
data.tar.gz: bad3a3f53ac5782be49cbcb080d1d959f1a6fe817997dae6aa02bd2bcaa0ccbfddab85d60c62eadf037eaa021948452ee59c9c3fde39d011231d7f93b5e03282
|
data/lib/grabzit/client.rb
CHANGED
@@ -35,10 +35,8 @@ module GrabzIt
|
|
35
35
|
# @see http://grabz.it/api/ruby/ GrabzIt Ruby API
|
36
36
|
class Client
|
37
37
|
|
38
|
-
|
39
|
-
private_constant :
|
40
|
-
WebServicesBaseURLPost = "://grabz.it/services/"
|
41
|
-
private_constant :WebServicesBaseURLPost
|
38
|
+
WebServicesBaseURL = "://api.grabz.it/services/"
|
39
|
+
private_constant :WebServicesBaseURL
|
42
40
|
TakePicture = "takepicture.ashx"
|
43
41
|
private_constant :TakePicture
|
44
42
|
TakeTable = "taketable.ashx"
|
@@ -75,7 +73,7 @@ module GrabzIt
|
|
75
73
|
options = AnimationOptions.new()
|
76
74
|
end
|
77
75
|
|
78
|
-
@request = Request.new(@protocol +
|
76
|
+
@request = Request.new(@protocol + WebServicesBaseURL + "takeanimation.ashx", false, options, url)
|
79
77
|
return nil
|
80
78
|
end
|
81
79
|
|
@@ -90,7 +88,7 @@ module GrabzIt
|
|
90
88
|
options = ImageOptions.new()
|
91
89
|
end
|
92
90
|
|
93
|
-
@request = Request.new(@protocol +
|
91
|
+
@request = Request.new(@protocol + WebServicesBaseURL + TakePicture, false, options, url)
|
94
92
|
return nil
|
95
93
|
end
|
96
94
|
|
@@ -105,7 +103,7 @@ module GrabzIt
|
|
105
103
|
options = ImageOptions.new()
|
106
104
|
end
|
107
105
|
|
108
|
-
@request = Request.new(@protocol +
|
106
|
+
@request = Request.new(@protocol + WebServicesBaseURL + TakePicture, true, options, html)
|
109
107
|
return nil
|
110
108
|
end
|
111
109
|
|
@@ -129,7 +127,7 @@ module GrabzIt
|
|
129
127
|
options = HTMLOptions.new()
|
130
128
|
end
|
131
129
|
|
132
|
-
@request = Request.new(@protocol +
|
130
|
+
@request = Request.new(@protocol + WebServicesBaseURL + TakeHTML, false, options, url)
|
133
131
|
return nil
|
134
132
|
end
|
135
133
|
|
@@ -144,7 +142,7 @@ module GrabzIt
|
|
144
142
|
options = HTMLOptions.new()
|
145
143
|
end
|
146
144
|
|
147
|
-
@request = Request.new(@protocol +
|
145
|
+
@request = Request.new(@protocol + WebServicesBaseURL + TakeHTML, true, options, html)
|
148
146
|
return nil
|
149
147
|
end
|
150
148
|
|
@@ -168,7 +166,7 @@ module GrabzIt
|
|
168
166
|
options = TableOptions.new()
|
169
167
|
end
|
170
168
|
|
171
|
-
@request = Request.new(@protocol +
|
169
|
+
@request = Request.new(@protocol + WebServicesBaseURL + TakeTable, false, options, url)
|
172
170
|
return nil
|
173
171
|
end
|
174
172
|
|
@@ -183,7 +181,7 @@ module GrabzIt
|
|
183
181
|
options = TableOptions.new()
|
184
182
|
end
|
185
183
|
|
186
|
-
@request = Request.new(@protocol +
|
184
|
+
@request = Request.new(@protocol + WebServicesBaseURL + TakeTable, true, options, html)
|
187
185
|
return nil
|
188
186
|
end
|
189
187
|
|
@@ -207,7 +205,7 @@ module GrabzIt
|
|
207
205
|
options = PDFOptions.new()
|
208
206
|
end
|
209
207
|
|
210
|
-
@request = Request.new(@protocol +
|
208
|
+
@request = Request.new(@protocol + WebServicesBaseURL + TakePDF, false, options, url)
|
211
209
|
return nil
|
212
210
|
end
|
213
211
|
|
@@ -222,7 +220,7 @@ module GrabzIt
|
|
222
220
|
options = PDFOptions.new()
|
223
221
|
end
|
224
222
|
|
225
|
-
@request = Request.new(@protocol +
|
223
|
+
@request = Request.new(@protocol + WebServicesBaseURL + TakePDF, true, options, html)
|
226
224
|
return nil
|
227
225
|
end
|
228
226
|
|
@@ -246,7 +244,7 @@ module GrabzIt
|
|
246
244
|
options = DOCXOptions.new()
|
247
245
|
end
|
248
246
|
|
249
|
-
@request = Request.new(@protocol +
|
247
|
+
@request = Request.new(@protocol + WebServicesBaseURL + TakeDOCX, false, options, url)
|
250
248
|
return nil
|
251
249
|
end
|
252
250
|
|
@@ -261,7 +259,7 @@ module GrabzIt
|
|
261
259
|
options = DOCXOptions.new()
|
262
260
|
end
|
263
261
|
|
264
|
-
@request = Request.new(@protocol +
|
262
|
+
@request = Request.new(@protocol + WebServicesBaseURL + TakeDOCX, true, options, html)
|
265
263
|
return nil
|
266
264
|
end
|
267
265
|
|
@@ -366,7 +364,7 @@ module GrabzIt
|
|
366
364
|
return nil
|
367
365
|
end
|
368
366
|
|
369
|
-
result = get(@protocol +
|
367
|
+
result = get(@protocol + WebServicesBaseURL + "getstatus.ashx?id=" + GrabzIt::Utility.nil_check(id))
|
370
368
|
|
371
369
|
doc = REXML::Document.new(result)
|
372
370
|
|
@@ -388,7 +386,7 @@ module GrabzIt
|
|
388
386
|
return nil
|
389
387
|
end
|
390
388
|
|
391
|
-
return get(@protocol +
|
389
|
+
return get(@protocol + WebServicesBaseURL + "getfile.ashx?id=" + GrabzIt::Utility.nil_check(id))
|
392
390
|
end
|
393
391
|
|
394
392
|
# Get all the cookies that GrabzIt is using for a particular domain. This may include your user set cookies as well
|
@@ -406,7 +404,7 @@ module GrabzIt
|
|
406
404
|
qs.concat("&sig=")
|
407
405
|
qs.concat(sig)
|
408
406
|
|
409
|
-
result = get(@protocol +
|
407
|
+
result = get(@protocol + WebServicesBaseURL + "getcookies.ashx?" + qs)
|
410
408
|
|
411
409
|
doc = REXML::Document.new(result)
|
412
410
|
|
@@ -461,7 +459,7 @@ module GrabzIt
|
|
461
459
|
qs.concat("&sig=")
|
462
460
|
qs.concat(sig)
|
463
461
|
|
464
|
-
return (get_result_value(get(@protocol +
|
462
|
+
return (get_result_value(get(@protocol + WebServicesBaseURL + "setcookie.ashx?" + qs), "Result") == TrueString)
|
465
463
|
end
|
466
464
|
|
467
465
|
# Delete a custom cookie or block a global cookie from being used
|
@@ -483,7 +481,7 @@ module GrabzIt
|
|
483
481
|
qs.concat("&delete=1&sig=")
|
484
482
|
qs.concat(sig)
|
485
483
|
|
486
|
-
return (get_result_value(get(@protocol +
|
484
|
+
return (get_result_value(get(@protocol + WebServicesBaseURL + "setcookie.ashx?" + qs), "Result") == TrueString)
|
487
485
|
end
|
488
486
|
|
489
487
|
# Get your uploaded custom watermark
|
@@ -523,7 +521,7 @@ module GrabzIt
|
|
523
521
|
|
524
522
|
boundary = '--------------------------'+Time.now.to_f.to_s
|
525
523
|
|
526
|
-
url = @protocol + "://grabz.it/services/addwatermark.ashx"
|
524
|
+
url = @protocol + "://api.grabz.it/services/addwatermark.ashx"
|
527
525
|
uri = URI.parse(url)
|
528
526
|
|
529
527
|
file = File.open(path, "rb")
|
@@ -583,7 +581,7 @@ module GrabzIt
|
|
583
581
|
qs.concat("&sig=")
|
584
582
|
qs.concat(sig)
|
585
583
|
|
586
|
-
return (get_result_value(get(@protocol +
|
584
|
+
return (get_result_value(get(@protocol + WebServicesBaseURL + "deletewatermark.ashx?" + qs), "Result") == TrueString)
|
587
585
|
end
|
588
586
|
|
589
587
|
# This method sets if requests to GrabzIt's API should use SSL or not
|
@@ -667,7 +665,7 @@ module GrabzIt
|
|
667
665
|
qs.concat("&sig=")
|
668
666
|
qs.concat(sig)
|
669
667
|
|
670
|
-
result = get(@protocol +
|
668
|
+
result = get(@protocol + WebServicesBaseURL + "getwatermarks.ashx?" + qs)
|
671
669
|
|
672
670
|
doc = REXML::Document.new(result)
|
673
671
|
|
@@ -707,7 +705,7 @@ module GrabzIt
|
|
707
705
|
if statusCode == 403
|
708
706
|
raise GrabzItException.new(response.body, GrabzItException::NETWORK_DDOS_ATTACK)
|
709
707
|
elsif statusCode >= 400
|
710
|
-
raise GrabzItException.new("A network error
|
708
|
+
raise GrabzItException.new("A network error occurred when connecting to GrabzIt.", GrabzItException::NETWORK_GENERAL_ERROR)
|
711
709
|
end
|
712
710
|
end
|
713
711
|
|
@@ -727,7 +725,7 @@ module GrabzIt
|
|
727
725
|
|
728
726
|
private
|
729
727
|
def encode(text)
|
730
|
-
return Digest::MD5.hexdigest(text.encode('ascii', {:invalid => :replace, :undef => :replace, :replace => '?'}))
|
728
|
+
return Digest::MD5.hexdigest(text.encode('ascii', **{:invalid => :replace, :undef => :replace, :replace => '?'}))
|
731
729
|
end
|
732
730
|
|
733
731
|
private
|
data/lib/grabzit/docxoptions.rb
CHANGED
@@ -30,7 +30,9 @@ module GrabzIt
|
|
30
30
|
@targetElement = nil
|
31
31
|
@mergeId = nil
|
32
32
|
@noCookieNotifications = false
|
33
|
-
@address = nil
|
33
|
+
@address = nil
|
34
|
+
@password = nil
|
35
|
+
@clickElement = nil
|
34
36
|
end
|
35
37
|
|
36
38
|
# @return [Boolean] true if the background images of the web page should be included in the DOCX
|
@@ -295,6 +297,19 @@ module GrabzIt
|
|
295
297
|
@waitForElement = value
|
296
298
|
end
|
297
299
|
|
300
|
+
# @return [String] get the CSS selector of the HTML element in the web page that must clicked before the capture is performed
|
301
|
+
def clickElement
|
302
|
+
@clickElement
|
303
|
+
end
|
304
|
+
|
305
|
+
# Set the CSS selector of the HTML element in the web page that must clicked before the capture is performed
|
306
|
+
#
|
307
|
+
# @param value [String] the element to click
|
308
|
+
# @return [void]
|
309
|
+
def clickElement=(value)
|
310
|
+
@clickElement = value
|
311
|
+
end
|
312
|
+
|
298
313
|
# @return [String] get the ID of a capture that should be merged at the beginning of the new DOCX document
|
299
314
|
def mergeId
|
300
315
|
@mergeId
|
@@ -346,7 +361,20 @@ module GrabzIt
|
|
346
361
|
# @return [void]
|
347
362
|
def address=(value)
|
348
363
|
@address = value
|
349
|
-
end
|
364
|
+
end
|
365
|
+
|
366
|
+
# @return [String] get the password that protects the DOCX document
|
367
|
+
def password
|
368
|
+
@password
|
369
|
+
end
|
370
|
+
|
371
|
+
# Set the password that protects the DOCX document
|
372
|
+
#
|
373
|
+
# @param value [String] the password
|
374
|
+
# @return [void]
|
375
|
+
def password=(value)
|
376
|
+
@password = value
|
377
|
+
end
|
350
378
|
|
351
379
|
# Define a HTTP Post parameter and optionally value, this method can be called multiple times to add multiple parameters. Using this method will force
|
352
380
|
# GrabzIt to perform a HTTP post.
|
@@ -373,7 +401,7 @@ module GrabzIt
|
|
373
401
|
items.push(GrabzIt::Utility.nil_check(url))
|
374
402
|
end
|
375
403
|
|
376
|
-
items.push(GrabzIt::Utility.nil_check(callBackURL),GrabzIt::Utility.nil_check(@customId),GrabzIt::Utility.b_to_str(@includeBackground),@pagesize ,@orientation,GrabzIt::Utility.b_to_str(@includeImages),GrabzIt::Utility.b_to_str(@includeLinks),GrabzIt::Utility.nil_check(@title),GrabzIt::Utility.nil_int_check(@marginTop),GrabzIt::Utility.nil_int_check(@marginLeft),GrabzIt::Utility.nil_int_check(@marginBottom),GrabzIt::Utility.nil_int_check(@marginRight),GrabzIt::Utility.nil_int_check(@delay),GrabzIt::Utility.nil_int_check(@requestAs),GrabzIt::Utility.nil_check(@country),GrabzIt::Utility.nil_int_check(@quality),GrabzIt::Utility.nil_check(@hideElement),GrabzIt::Utility.nil_check(@exportURL),GrabzIt::Utility.nil_check(@waitForElement),GrabzIt::Utility.nil_check(@encryptionKey),GrabzIt::Utility.b_to_str(@noAds),GrabzIt::Utility.nil_check(@post),GrabzIt::Utility.nil_check(@targetElement),GrabzIt::Utility.nil_check(@templateId),GrabzIt::Utility.nil_check(@templateVariables),GrabzIt::Utility.nil_int_check(@height),GrabzIt::Utility.nil_int_check(@width),GrabzIt::Utility.nil_int_check(@browserWidth),GrabzIt::Utility.nil_check(@proxy),GrabzIt::Utility.nil_check(@mergeId),GrabzIt::Utility.nil_check(@address),GrabzIt::Utility.b_to_str(@noCookieNotifications))
|
404
|
+
items.push(GrabzIt::Utility.nil_check(callBackURL),GrabzIt::Utility.nil_check(@customId),GrabzIt::Utility.b_to_str(@includeBackground),@pagesize ,@orientation,GrabzIt::Utility.b_to_str(@includeImages),GrabzIt::Utility.b_to_str(@includeLinks),GrabzIt::Utility.nil_check(@title),GrabzIt::Utility.nil_int_check(@marginTop),GrabzIt::Utility.nil_int_check(@marginLeft),GrabzIt::Utility.nil_int_check(@marginBottom),GrabzIt::Utility.nil_int_check(@marginRight),GrabzIt::Utility.nil_int_check(@delay),GrabzIt::Utility.nil_int_check(@requestAs),GrabzIt::Utility.nil_check(@country),GrabzIt::Utility.nil_int_check(@quality),GrabzIt::Utility.nil_check(@hideElement),GrabzIt::Utility.nil_check(@exportURL),GrabzIt::Utility.nil_check(@waitForElement),GrabzIt::Utility.nil_check(@encryptionKey),GrabzIt::Utility.b_to_str(@noAds),GrabzIt::Utility.nil_check(@post),GrabzIt::Utility.nil_check(@targetElement),GrabzIt::Utility.nil_check(@templateId),GrabzIt::Utility.nil_check(@templateVariables),GrabzIt::Utility.nil_int_check(@height),GrabzIt::Utility.nil_int_check(@width),GrabzIt::Utility.nil_int_check(@browserWidth),GrabzIt::Utility.nil_check(@proxy),GrabzIt::Utility.nil_check(@mergeId),GrabzIt::Utility.nil_check(@address),GrabzIt::Utility.b_to_str(@noCookieNotifications),GrabzIt::Utility.nil_check(@password),GrabzIt::Utility.nil_check(@clickElement))
|
377
405
|
return items.join("|")
|
378
406
|
end
|
379
407
|
|
@@ -406,6 +434,8 @@ module GrabzIt
|
|
406
434
|
params['mergeid'] = GrabzIt::Utility.nil_check(@mergeId)
|
407
435
|
params['address'] = GrabzIt::Utility.nil_check(@address)
|
408
436
|
params['nonotify'] = GrabzIt::Utility.b_to_str(@noCookieNotifications)
|
437
|
+
params['password'] = GrabzIt::Utility.nil_check(@password)
|
438
|
+
params['click'] = GrabzIt::Utility.nil_check(@clickElement)
|
409
439
|
|
410
440
|
return params;
|
411
441
|
end
|
data/lib/grabzit/exception.rb
CHANGED
@@ -72,6 +72,10 @@ module GrabzIt
|
|
72
72
|
PARAMETER_INVALID_PROXY = 173
|
73
73
|
PARAMETER_INVALID_NO_NOTIFY = 174
|
74
74
|
PARAMETER_INVALID_HD = 176
|
75
|
+
PARAMETER_INVALID_MEDIA_TYPE = 177
|
76
|
+
PARAMETER_INVALID_PASSWORD = 178
|
77
|
+
PARAMETER_INVALID_MERGE = 179
|
78
|
+
PARAMETER_INVALID_CLICK_VALUE = 180
|
75
79
|
NETWORK_SERVER_OFFLINE = 200
|
76
80
|
NETWORK_GENERAL_ERROR = 201
|
77
81
|
NETWORK_DDOS_ATTACK = 202
|
data/lib/grabzit/imageoptions.rb
CHANGED
@@ -23,6 +23,7 @@ module GrabzIt
|
|
23
23
|
@noCookieNotifications = false
|
24
24
|
@address = nil
|
25
25
|
@hd = false
|
26
|
+
@clickElement = nil
|
26
27
|
end
|
27
28
|
|
28
29
|
# @return [Integer] the width of the browser in pixels
|
@@ -140,6 +141,19 @@ module GrabzIt
|
|
140
141
|
# @return [void]
|
141
142
|
def waitForElement=(value)
|
142
143
|
@waitForElement = value
|
144
|
+
end
|
145
|
+
|
146
|
+
# @return [String] get the CSS selector of the HTML element in the web page that must clicked before the capture is performed
|
147
|
+
def clickElement
|
148
|
+
@clickElement
|
149
|
+
end
|
150
|
+
|
151
|
+
# Set the CSS selector of the HTML element in the web page that must clicked before the capture is performed
|
152
|
+
#
|
153
|
+
# @param value [String] the element to click
|
154
|
+
# @return [void]
|
155
|
+
def clickElement=(value)
|
156
|
+
@clickElement = value
|
143
157
|
end
|
144
158
|
|
145
159
|
# @return [Integer] get which user agent type should be used
|
@@ -263,7 +277,7 @@ module GrabzIt
|
|
263
277
|
items.push(GrabzIt::Utility.nil_check(url))
|
264
278
|
end
|
265
279
|
|
266
|
-
items.push(GrabzIt::Utility.nil_check(callBackURL),GrabzIt::Utility.nil_check(@format),GrabzIt::Utility.nil_int_check(@height),GrabzIt::Utility.nil_int_check(@width),GrabzIt::Utility.nil_int_check(@browserHeight),GrabzIt::Utility.nil_int_check(@browserWidth),GrabzIt::Utility.nil_check(@customId),GrabzIt::Utility.nil_int_check(@delay),GrabzIt::Utility.nil_check(@targetElement),GrabzIt::Utility.nil_check(@customWaterMarkId),GrabzIt::Utility.nil_int_check(@requestAs),GrabzIt::Utility.nil_check(@country),GrabzIt::Utility.nil_int_check(@quality),GrabzIt::Utility.nil_check(@hideElement),GrabzIt::Utility.nil_check(@exportURL),GrabzIt::Utility.nil_check(@waitForElement),GrabzIt::Utility.b_to_str(@transparent),GrabzIt::Utility.nil_check(@encryptionKey),GrabzIt::Utility.b_to_str(@noAds),GrabzIt::Utility.nil_check(@post),GrabzIt::Utility.nil_check(@proxy),GrabzIt::Utility.nil_check(@address),GrabzIt::Utility.b_to_str(@noCookieNotifications),GrabzIt::Utility.b_to_str(@hd))
|
280
|
+
items.push(GrabzIt::Utility.nil_check(callBackURL),GrabzIt::Utility.nil_check(@format),GrabzIt::Utility.nil_int_check(@height),GrabzIt::Utility.nil_int_check(@width),GrabzIt::Utility.nil_int_check(@browserHeight),GrabzIt::Utility.nil_int_check(@browserWidth),GrabzIt::Utility.nil_check(@customId),GrabzIt::Utility.nil_int_check(@delay),GrabzIt::Utility.nil_check(@targetElement),GrabzIt::Utility.nil_check(@customWaterMarkId),GrabzIt::Utility.nil_int_check(@requestAs),GrabzIt::Utility.nil_check(@country),GrabzIt::Utility.nil_int_check(@quality),GrabzIt::Utility.nil_check(@hideElement),GrabzIt::Utility.nil_check(@exportURL),GrabzIt::Utility.nil_check(@waitForElement),GrabzIt::Utility.b_to_str(@transparent),GrabzIt::Utility.nil_check(@encryptionKey),GrabzIt::Utility.b_to_str(@noAds),GrabzIt::Utility.nil_check(@post),GrabzIt::Utility.nil_check(@proxy),GrabzIt::Utility.nil_check(@address),GrabzIt::Utility.b_to_str(@noCookieNotifications),GrabzIt::Utility.b_to_str(@hd),GrabzIt::Utility.nil_check(@clickElement))
|
267
281
|
|
268
282
|
return items.join("|")
|
269
283
|
end
|
@@ -289,6 +303,7 @@ module GrabzIt
|
|
289
303
|
params['address'] = GrabzIt::Utility.nil_check(@address)
|
290
304
|
params['nonotify'] = GrabzIt::Utility.b_to_str(@noCookieNotifications)
|
291
305
|
params['hd'] = GrabzIt::Utility.b_to_str(@hd)
|
306
|
+
params['click'] = GrabzIt::Utility.nil_check(@clickElement)
|
292
307
|
|
293
308
|
return params
|
294
309
|
end
|
data/lib/grabzit/pdfoptions.rb
CHANGED
@@ -33,6 +33,9 @@ module GrabzIt
|
|
33
33
|
@mergeId = nil
|
34
34
|
@noCookieNotifications = false
|
35
35
|
@address = nil
|
36
|
+
@cssMediaType = nil
|
37
|
+
@password = nil
|
38
|
+
@clickElement = nil
|
36
39
|
end
|
37
40
|
|
38
41
|
# @return [Boolean] true if the background of the web page should be included in the PDF
|
@@ -74,7 +77,21 @@ module GrabzIt
|
|
74
77
|
def orientation=(value)
|
75
78
|
value = GrabzIt::Utility.nil_check(value).capitalize
|
76
79
|
@orientation = value
|
77
|
-
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# @return [String] the CSS Media Type of the PDF to be returned
|
83
|
+
def cssMediaType
|
84
|
+
@cssMediaType
|
85
|
+
end
|
86
|
+
|
87
|
+
# Set the CSS Media Type of the PDF to be returned: 'Print' or 'Screen'
|
88
|
+
#
|
89
|
+
# @param value [String] CSS Media Type
|
90
|
+
# @return [void]
|
91
|
+
def cssMediaType=(value)
|
92
|
+
value = GrabzIt::Utility.nil_check(value).capitalize
|
93
|
+
@cssMediaType = value
|
94
|
+
end
|
78
95
|
|
79
96
|
# @return [Boolean] true if the links should be included in the PDF
|
80
97
|
def includeLinks
|
@@ -322,6 +339,19 @@ module GrabzIt
|
|
322
339
|
def waitForElement=(value)
|
323
340
|
@waitForElement = value
|
324
341
|
end
|
342
|
+
|
343
|
+
# @return [String] get the CSS selector of the HTML element in the web page that must clicked before the capture is performed
|
344
|
+
def clickElement
|
345
|
+
@clickElement
|
346
|
+
end
|
347
|
+
|
348
|
+
# Set the CSS selector of the HTML element in the web page that must clicked before the capture is performed
|
349
|
+
#
|
350
|
+
# @param value [String] the element to click
|
351
|
+
# @return [void]
|
352
|
+
def clickElement=(value)
|
353
|
+
@clickElement = value
|
354
|
+
end
|
325
355
|
|
326
356
|
# @return [String] get the ID of a capture that should be merged at the beginning of the new PDF document
|
327
357
|
def mergeId
|
@@ -373,7 +403,20 @@ module GrabzIt
|
|
373
403
|
# @return [void]
|
374
404
|
def address=(value)
|
375
405
|
@address = value
|
376
|
-
end
|
406
|
+
end
|
407
|
+
|
408
|
+
# @return [String] get the password that protects the PDF document
|
409
|
+
def password
|
410
|
+
@password
|
411
|
+
end
|
412
|
+
|
413
|
+
# Set the password that protects the PDF document
|
414
|
+
#
|
415
|
+
# @param value [String] the password
|
416
|
+
# @return [void]
|
417
|
+
def password=(value)
|
418
|
+
@password = value
|
419
|
+
end
|
377
420
|
|
378
421
|
# Define a HTTP Post parameter and optionally value, this method can be called multiple times to add multiple parameters. Using this method will force
|
379
422
|
# GrabzIt to perform a HTTP post.
|
@@ -400,7 +443,7 @@ module GrabzIt
|
|
400
443
|
items.push(GrabzIt::Utility.nil_check(url))
|
401
444
|
end
|
402
445
|
|
403
|
-
items.push(GrabzIt::Utility.nil_check(callBackURL),GrabzIt::Utility.nil_check(@customId),GrabzIt::Utility.b_to_str(@includeBackground),@pagesize ,@orientation,GrabzIt::Utility.nil_check(@customWaterMarkId),GrabzIt::Utility.b_to_str(@includeLinks),GrabzIt::Utility.b_to_str(@includeOutline),GrabzIt::Utility.nil_check(@title),GrabzIt::Utility.nil_check(@coverURL),GrabzIt::Utility.nil_int_check(@marginTop),GrabzIt::Utility.nil_int_check(@marginLeft),GrabzIt::Utility.nil_int_check(@marginBottom),GrabzIt::Utility.nil_int_check(@marginRight),GrabzIt::Utility.nil_int_check(@delay),GrabzIt::Utility.nil_int_check(@requestAs),GrabzIt::Utility.nil_check(@country),GrabzIt::Utility.nil_int_check(@quality),GrabzIt::Utility.nil_check(@templateId),GrabzIt::Utility.nil_check(@hideElement),GrabzIt::Utility.nil_check(@targetElement),GrabzIt::Utility.nil_check(@exportURL),GrabzIt::Utility.nil_check(@waitForElement),GrabzIt::Utility.nil_check(@encryptionKey),GrabzIt::Utility.b_to_str(@noAds),GrabzIt::Utility.nil_check(@post),GrabzIt::Utility.nil_int_check(@browserWidth),GrabzIt::Utility.nil_int_check(@height),GrabzIt::Utility.nil_int_check(@width),GrabzIt::Utility.nil_check(@templateVariables),GrabzIt::Utility.nil_check(@proxy),GrabzIt::Utility.nil_check(@mergeId),GrabzIt::Utility.nil_check(@address),GrabzIt::Utility.b_to_str(@noCookieNotifications))
|
446
|
+
items.push(GrabzIt::Utility.nil_check(callBackURL),GrabzIt::Utility.nil_check(@customId),GrabzIt::Utility.b_to_str(@includeBackground),@pagesize ,@orientation,GrabzIt::Utility.nil_check(@customWaterMarkId),GrabzIt::Utility.b_to_str(@includeLinks),GrabzIt::Utility.b_to_str(@includeOutline),GrabzIt::Utility.nil_check(@title),GrabzIt::Utility.nil_check(@coverURL),GrabzIt::Utility.nil_int_check(@marginTop),GrabzIt::Utility.nil_int_check(@marginLeft),GrabzIt::Utility.nil_int_check(@marginBottom),GrabzIt::Utility.nil_int_check(@marginRight),GrabzIt::Utility.nil_int_check(@delay),GrabzIt::Utility.nil_int_check(@requestAs),GrabzIt::Utility.nil_check(@country),GrabzIt::Utility.nil_int_check(@quality),GrabzIt::Utility.nil_check(@templateId),GrabzIt::Utility.nil_check(@hideElement),GrabzIt::Utility.nil_check(@targetElement),GrabzIt::Utility.nil_check(@exportURL),GrabzIt::Utility.nil_check(@waitForElement),GrabzIt::Utility.nil_check(@encryptionKey),GrabzIt::Utility.b_to_str(@noAds),GrabzIt::Utility.nil_check(@post),GrabzIt::Utility.nil_int_check(@browserWidth),GrabzIt::Utility.nil_int_check(@height),GrabzIt::Utility.nil_int_check(@width),GrabzIt::Utility.nil_check(@templateVariables),GrabzIt::Utility.nil_check(@proxy),GrabzIt::Utility.nil_check(@mergeId),GrabzIt::Utility.nil_check(@address),GrabzIt::Utility.b_to_str(@noCookieNotifications),GrabzIt::Utility.nil_check(@cssMediaType),GrabzIt::Utility.nil_check(@password),GrabzIt::Utility.nil_check(@clickElement))
|
404
447
|
|
405
448
|
return items.join("|")
|
406
449
|
end
|
@@ -436,7 +479,10 @@ module GrabzIt
|
|
436
479
|
params['mergeid'] = GrabzIt::Utility.nil_check(@mergeId)
|
437
480
|
params['address'] = GrabzIt::Utility.nil_check(@address)
|
438
481
|
params['nonotify'] = GrabzIt::Utility.b_to_str(@noCookieNotifications)
|
439
|
-
|
482
|
+
params['media'] = GrabzIt::Utility.nil_check(@cssMediaType)
|
483
|
+
params['password'] = GrabzIt::Utility.nil_check(@password)
|
484
|
+
params['click'] = GrabzIt::Utility.nil_check(@clickElement)
|
485
|
+
|
440
486
|
return params;
|
441
487
|
end
|
442
488
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grabzit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GrabzIt
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -24,11 +24,11 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
description: Use GrabzIt to convert HTML or URL's into images, PDF
|
28
|
-
These captures have highly customizable options include altering quality,
|
29
|
-
size, browser type, geographic location and much more. Additionally GrabzIt
|
30
|
-
even convert HTML tables on the web into a CSV or Excel spreadsheet. As well
|
31
|
-
enabling online video's to be converted into animated GIF's.
|
27
|
+
description: Use GrabzIt to convert HTML or URL's into images, PDF, rendered HTML
|
28
|
+
or DOCX. These captures have highly customizable options include altering quality,
|
29
|
+
delay, size, browser type, geographic location and much more. Additionally GrabzIt
|
30
|
+
can even convert HTML tables on the web into a CSV or Excel spreadsheet. As well
|
31
|
+
as enabling online video's to be converted into animated GIF's.
|
32
32
|
email: support@grabz.it
|
33
33
|
executables: []
|
34
34
|
extensions: []
|
@@ -57,7 +57,7 @@ homepage: https://grabz.it/api/ruby
|
|
57
57
|
licenses:
|
58
58
|
- MIT
|
59
59
|
metadata: {}
|
60
|
-
post_install_message:
|
60
|
+
post_install_message:
|
61
61
|
rdoc_options: []
|
62
62
|
require_paths:
|
63
63
|
- lib
|
@@ -72,8 +72,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: '0'
|
74
74
|
requirements: []
|
75
|
-
rubygems_version: 3.
|
76
|
-
signing_key:
|
75
|
+
rubygems_version: 3.1.6
|
76
|
+
signing_key:
|
77
77
|
specification_version: 4
|
78
78
|
summary: GrabzIt Ruby Client
|
79
79
|
test_files: []
|