grabzit 3.2.6 → 3.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/grabzit/animationoptions.rb +18 -24
- data/lib/grabzit/baseoptions.rb +20 -5
- data/lib/grabzit/client.rb +53 -16
- data/lib/grabzit/docxoptions.rb +29 -36
- data/lib/grabzit/exception.rb +1 -0
- data/lib/grabzit/imageoptions.rb +22 -26
- data/lib/grabzit/pdfoptions.rb +32 -42
- data/lib/grabzit/tableoptions.rb +15 -20
- data/test/test_grabzit.rb +6 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a3201c51d99c10fd1c9df9b98cf71505776fd71
|
4
|
+
data.tar.gz: 0f835d0e1887efb9a9f3002f888f55ed9897e55e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc3aec7572f02f292eee573350fe583c41f4c9ffacdf50906da93ed16a4e8b86717307c5e22c672ac537d32ebd5b089fd8d03921158936719f1c060e4da85d7a
|
7
|
+
data.tar.gz: 36e8e0ad000d09ab7553595b9828668084785fda0cb76020a389cbd71eef0c2e03a09634d06513592c25d1eeee8f8abbb39f65663df06efa5b98d4ce597b68e1
|
@@ -6,6 +6,7 @@ module GrabzIt
|
|
6
6
|
# @author GrabzIt
|
7
7
|
class AnimationOptions < BaseOptions
|
8
8
|
def initialize()
|
9
|
+
super()
|
9
10
|
@width = 0
|
10
11
|
@height = 0
|
11
12
|
@start = 0
|
@@ -27,7 +28,7 @@ module GrabzIt
|
|
27
28
|
#
|
28
29
|
# @param value [Integer] the width
|
29
30
|
# @return [void]
|
30
|
-
def width(value)
|
31
|
+
def width=(value)
|
31
32
|
@width = value
|
32
33
|
end
|
33
34
|
|
@@ -40,7 +41,7 @@ module GrabzIt
|
|
40
41
|
#
|
41
42
|
# @param value [Integer] the height
|
42
43
|
# @return [void]
|
43
|
-
def height(value)
|
44
|
+
def height=(value)
|
44
45
|
@height = value
|
45
46
|
end
|
46
47
|
|
@@ -53,7 +54,7 @@ module GrabzIt
|
|
53
54
|
#
|
54
55
|
# @param value [Integer] the second to start at
|
55
56
|
# @return [void]
|
56
|
-
def start(value)
|
57
|
+
def start=(value)
|
57
58
|
@start = value
|
58
59
|
end
|
59
60
|
|
@@ -66,7 +67,7 @@ module GrabzIt
|
|
66
67
|
#
|
67
68
|
# @param value [Integer] the number of seconds
|
68
69
|
# @return [void]
|
69
|
-
def duration(value)
|
70
|
+
def duration=(value)
|
70
71
|
@duration = value
|
71
72
|
end
|
72
73
|
|
@@ -79,7 +80,7 @@ module GrabzIt
|
|
79
80
|
#
|
80
81
|
# @param value [Float] the speed
|
81
82
|
# @return [void]
|
82
|
-
def speed(value)
|
83
|
+
def speed=(value)
|
83
84
|
@speed = value
|
84
85
|
end
|
85
86
|
|
@@ -92,7 +93,7 @@ module GrabzIt
|
|
92
93
|
#
|
93
94
|
# @param value [Float] the number of frames per second
|
94
95
|
# @return [void]
|
95
|
-
def framesPerSecond(value)
|
96
|
+
def framesPerSecond=(value)
|
96
97
|
@framesPerSecond = value
|
97
98
|
end
|
98
99
|
|
@@ -105,7 +106,7 @@ module GrabzIt
|
|
105
106
|
#
|
106
107
|
# @param value [Integer] the number of times to loop
|
107
108
|
# @return [void]
|
108
|
-
def repeat(value)
|
109
|
+
def repeat=(value)
|
109
110
|
@repeat = value
|
110
111
|
end
|
111
112
|
|
@@ -118,7 +119,7 @@ module GrabzIt
|
|
118
119
|
#
|
119
120
|
# @param value [Boolean] reverse value
|
120
121
|
# @return [void]
|
121
|
-
def reverse(value)
|
122
|
+
def reverse=(value)
|
122
123
|
@reverse = value
|
123
124
|
end
|
124
125
|
|
@@ -131,7 +132,7 @@ module GrabzIt
|
|
131
132
|
#
|
132
133
|
# @param value [String] custom watermark id
|
133
134
|
# @return [void]
|
134
|
-
def customWaterMarkId(value)
|
135
|
+
def customWaterMarkId=(value)
|
135
136
|
@customWaterMarkId = value
|
136
137
|
end
|
137
138
|
|
@@ -144,28 +145,21 @@ module GrabzIt
|
|
144
145
|
#
|
145
146
|
# @param value [Integer] the custom identifier
|
146
147
|
# @return [void]
|
147
|
-
def quality(value)
|
148
|
+
def quality=(value)
|
148
149
|
@quality = value
|
149
150
|
end
|
150
151
|
|
151
152
|
# @!visibility private
|
152
153
|
def _getSignatureString(applicationSecret, callBackURL, url = nil)
|
153
|
-
|
154
|
-
if (url != nil)
|
155
|
-
urlParam = GrabzIt::Utility.nil_check(url)+"|"
|
156
|
-
end
|
154
|
+
items = [applicationSecret]
|
157
155
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
end
|
156
|
+
if(url != nil)
|
157
|
+
items.push(GrabzIt::Utility.nil_check(url))
|
158
|
+
end
|
162
159
|
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
"|"+GrabzIt::Utility.nil_int_check(@repeat)+"|"+GrabzIt::Utility.b_to_str(@reverse)+"|"+GrabzIt::Utility.nil_int_check(@start)+
|
167
|
-
"|"+GrabzIt::Utility.nil_check(@customWaterMarkId)+"|"+GrabzIt::Utility.nil_check(@country)+"|"+GrabzIt::Utility.nil_int_check(@quality)+
|
168
|
-
"|"+GrabzIt::Utility.nil_check(@exportURL)+"|"+GrabzIt::Utility.nil_check(@encryptionKey)
|
160
|
+
items.push(GrabzIt::Utility.nil_check(callBackURL),GrabzIt::Utility.nil_int_check(@height),GrabzIt::Utility.nil_int_check(@width),GrabzIt::Utility.nil_check(@customId),GrabzIt::Utility.nil_float_check(@framesPerSecond),GrabzIt::Utility.nil_float_check(@speed),GrabzIt::Utility.nil_int_check(@duration),GrabzIt::Utility.nil_int_check(@repeat),GrabzIt::Utility.b_to_str(@reverse),GrabzIt::Utility.nil_int_check(@start),GrabzIt::Utility.nil_check(@customWaterMarkId),GrabzIt::Utility.nil_check(@country),GrabzIt::Utility.nil_int_check(@quality),GrabzIt::Utility.nil_check(@exportURL),GrabzIt::Utility.nil_check(@encryptionKey),GrabzIt::Utility.nil_check(@proxy))
|
161
|
+
|
162
|
+
return items.join("|")
|
169
163
|
end
|
170
164
|
|
171
165
|
# @!visibility private
|
data/lib/grabzit/baseoptions.rb
CHANGED
@@ -10,6 +10,7 @@ module GrabzIt
|
|
10
10
|
@encryptionKey = nil
|
11
11
|
@delay = nil
|
12
12
|
@post = nil
|
13
|
+
@proxy = nil
|
13
14
|
end
|
14
15
|
|
15
16
|
# @return [String] the custom identifier that you can pass through to the web service.
|
@@ -21,7 +22,7 @@ module GrabzIt
|
|
21
22
|
#
|
22
23
|
# @param value [String] the custom identifier
|
23
24
|
# @return [void]
|
24
|
-
def customId(value)
|
25
|
+
def customId=(value)
|
25
26
|
@customId = value
|
26
27
|
end
|
27
28
|
|
@@ -34,7 +35,7 @@ module GrabzIt
|
|
34
35
|
#
|
35
36
|
# @param value [String] the country to use
|
36
37
|
# @return [void]
|
37
|
-
def country(value)
|
38
|
+
def country=(value)
|
38
39
|
@country = value
|
39
40
|
end
|
40
41
|
|
@@ -47,7 +48,7 @@ module GrabzIt
|
|
47
48
|
#
|
48
49
|
# @param value [String] export URL to use
|
49
50
|
# @return [void]
|
50
|
-
def exportURL(value)
|
51
|
+
def exportURL=(value)
|
51
52
|
@exportURL = value
|
52
53
|
end
|
53
54
|
|
@@ -60,9 +61,22 @@ module GrabzIt
|
|
60
61
|
#
|
61
62
|
# @param value [String] encryption key to use
|
62
63
|
# @return [void]
|
63
|
-
def encryptionKey(value)
|
64
|
+
def encryptionKey=(value)
|
64
65
|
@encryptionKey = value
|
65
|
-
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# @return [String] the HTTP proxy that should be used to create the capture.
|
69
|
+
def proxy
|
70
|
+
@proxy
|
71
|
+
end
|
72
|
+
|
73
|
+
# Set the HTTP proxy that should be used to create the capture.
|
74
|
+
#
|
75
|
+
# @param value [String] HTTP proxy to use
|
76
|
+
# @return [void]
|
77
|
+
def proxy=(value)
|
78
|
+
@proxy = value
|
79
|
+
end
|
66
80
|
|
67
81
|
# @!visibility private
|
68
82
|
def startDelay
|
@@ -105,6 +119,7 @@ module GrabzIt
|
|
105
119
|
params['callback'] = GrabzIt::Utility.nil_check(callBackURL)
|
106
120
|
params['export'] = GrabzIt::Utility.nil_check(@exportURL)
|
107
121
|
params['encryption'] = GrabzIt::Utility.nil_check(@encryptionKey)
|
122
|
+
params['proxy'] = GrabzIt::Utility.nil_check(@proxy)
|
108
123
|
params['sig'] = sig
|
109
124
|
params[dataName] = GrabzIt::Utility.nil_check(dataValue)
|
110
125
|
|
data/lib/grabzit/client.rb
CHANGED
@@ -353,7 +353,12 @@ module GrabzIt
|
|
353
353
|
def get_cookies(domain)
|
354
354
|
sig = encode(GrabzIt::Utility.nil_check(@applicationSecret)+"|"+GrabzIt::Utility.nil_check(domain))
|
355
355
|
|
356
|
-
qs = "key="
|
356
|
+
qs = "key="
|
357
|
+
qs.concat(CGI.escape(GrabzIt::Utility.nil_check(@applicationKey)))
|
358
|
+
qs.concat("&domain=")
|
359
|
+
qs.concat(CGI.escape(GrabzIt::Utility.nil_check(domain)))
|
360
|
+
qs.concat("&sig=")
|
361
|
+
qs.concat(sig)
|
357
362
|
|
358
363
|
result = get(@protocol + WebServicesBaseURLGet + "getcookies.ashx?" + qs)
|
359
364
|
|
@@ -393,9 +398,22 @@ module GrabzIt
|
|
393
398
|
"|"+GrabzIt::Utility.nil_check(value)+"|"+GrabzIt::Utility.nil_check(path)+"|"+GrabzIt::Utility.b_to_str(httponly)+
|
394
399
|
"|"+GrabzIt::Utility.nil_check(expires)+"|0")
|
395
400
|
|
396
|
-
qs = "key="
|
397
|
-
|
398
|
-
|
401
|
+
qs = "key="
|
402
|
+
qs.concat(CGI.escape(GrabzIt::Utility.nil_check(@applicationKey)))
|
403
|
+
qs.concat("&domain=")
|
404
|
+
qs.concat(CGI.escape(GrabzIt::Utility.nil_check(domain)))
|
405
|
+
qs.concat("&name=")
|
406
|
+
qs.concat(CGI.escape(GrabzIt::Utility.nil_check(name)))
|
407
|
+
qs.concat("&value=")
|
408
|
+
qs.concat(CGI.escape(GrabzIt::Utility.nil_check(value)))
|
409
|
+
qs.concat("&path=")
|
410
|
+
qs.concat(CGI.escape(GrabzIt::Utility.nil_check(path)))
|
411
|
+
qs.concat("&httponly=")
|
412
|
+
qs.concat(GrabzIt::Utility.b_to_str(httponly))
|
413
|
+
qs.concat("&expires=")
|
414
|
+
qs.concat(CGI.escape(GrabzIt::Utility.nil_check(expires)))
|
415
|
+
qs.concat("&sig=")
|
416
|
+
qs.concat(sig)
|
399
417
|
|
400
418
|
return (get_result_value(get(@protocol + WebServicesBaseURLGet + "setcookie.ashx?" + qs), "Result") == TrueString)
|
401
419
|
end
|
@@ -410,8 +428,14 @@ module GrabzIt
|
|
410
428
|
sig = encode(GrabzIt::Utility.nil_check(@applicationSecret)+"|"+GrabzIt::Utility.nil_check(name)+
|
411
429
|
"|"+GrabzIt::Utility.nil_check(domain)+"|1")
|
412
430
|
|
413
|
-
qs = "key="
|
414
|
-
|
431
|
+
qs = "key="
|
432
|
+
qs.concat(CGI.escape(GrabzIt::Utility.nil_check(@applicationKey)))
|
433
|
+
qs.concat("&domain=")
|
434
|
+
qs.concat(CGI.escape(GrabzIt::Utility.nil_check(domain)))
|
435
|
+
qs.concat("&name=")
|
436
|
+
qs.concat(CGI.escape(GrabzIt::Utility.nil_check(name)))
|
437
|
+
qs.concat("&delete=1&sig=")
|
438
|
+
qs.concat(sig)
|
415
439
|
|
416
440
|
return (get_result_value(get(@protocol + WebServicesBaseURLGet + "setcookie.ashx?" + qs), "Result") == TrueString)
|
417
441
|
end
|
@@ -421,7 +445,7 @@ module GrabzIt
|
|
421
445
|
# @param identifier [String, nil] the identifier of a particular custom watermark you want to view
|
422
446
|
# @return [WaterMark] the watermark with the specified identifier
|
423
447
|
def get_watermark(identifier)
|
424
|
-
watermarks =
|
448
|
+
watermarks = find_watermarks(identifier)
|
425
449
|
if watermarks.length == 1
|
426
450
|
return watermarks[0]
|
427
451
|
end
|
@@ -433,7 +457,7 @@ module GrabzIt
|
|
433
457
|
#
|
434
458
|
# @return [Array<WaterMark>] an array of uploaded watermarks
|
435
459
|
def get_watermarks()
|
436
|
-
return
|
460
|
+
return find_watermarks(nil)
|
437
461
|
end
|
438
462
|
|
439
463
|
# Add a new custom watermark
|
@@ -488,10 +512,13 @@ module GrabzIt
|
|
488
512
|
request = Net::HTTP::Post.new(url)
|
489
513
|
request.content_type = "multipart/form-data, boundary="+boundary
|
490
514
|
request.body = post_body.join
|
491
|
-
|
492
|
-
|
515
|
+
|
516
|
+
caller = Net::HTTP.new(uri.host, uri.port)
|
517
|
+
caller.use_ssl = uri.scheme == 'https'
|
518
|
+
response = caller.start {|http| http.request(request)}
|
519
|
+
|
493
520
|
response_check(response)
|
494
|
-
|
521
|
+
|
495
522
|
return (get_result_value(response.body(), "Result") == TrueString)
|
496
523
|
end
|
497
524
|
|
@@ -501,9 +528,14 @@ module GrabzIt
|
|
501
528
|
# @return [Boolean] returns true if the watermark was successfully deleted
|
502
529
|
# @raise [RuntimeError] if the GrabzIt service reports an error with the request it will be raised as a RuntimeError
|
503
530
|
def delete_watermark(identifier)
|
504
|
-
sig = encode(GrabzIt::Utility.nil_check(@applicationSecret)+"|"+GrabzIt::Utility.nil_check(identifier))
|
531
|
+
sig = encode(GrabzIt::Utility.nil_check(@applicationSecret)+"|"+GrabzIt::Utility.nil_check(identifier))
|
505
532
|
|
506
|
-
qs = "key="
|
533
|
+
qs = "key="
|
534
|
+
qs.concat(CGI.escape(GrabzIt::Utility.nil_check(@applicationKey)))
|
535
|
+
qs.concat("&identifier=")
|
536
|
+
qs.concat(CGI.escape(GrabzIt::Utility.nil_check(identifier)))
|
537
|
+
qs.concat("&sig=")
|
538
|
+
qs.concat(sig)
|
507
539
|
|
508
540
|
return (get_result_value(get(@protocol + WebServicesBaseURLGet + "deletewatermark.ashx?" + qs), "Result") == TrueString)
|
509
541
|
end
|
@@ -558,10 +590,15 @@ module GrabzIt
|
|
558
590
|
end
|
559
591
|
|
560
592
|
private
|
561
|
-
def
|
593
|
+
def find_watermarks(identifier = nil)
|
562
594
|
sig = encode(GrabzIt::Utility.nil_check(@applicationSecret)+"|"+GrabzIt::Utility.nil_check(identifier))
|
563
595
|
|
564
|
-
qs = "key="
|
596
|
+
qs = "key="
|
597
|
+
qs.concat(CGI.escape(GrabzIt::Utility.nil_check(@applicationKey)))
|
598
|
+
qs.concat("&identifier=")
|
599
|
+
qs.concat(CGI.escape(GrabzIt::Utility.nil_check(identifier)))
|
600
|
+
qs.concat("&sig=")
|
601
|
+
qs.concat(sig)
|
565
602
|
|
566
603
|
result = get(@protocol + WebServicesBaseURLGet + "getwatermarks.ashx?" + qs)
|
567
604
|
|
@@ -623,7 +660,7 @@ module GrabzIt
|
|
623
660
|
|
624
661
|
private
|
625
662
|
def encode(text)
|
626
|
-
return Digest::MD5.hexdigest(text.encode('ascii', {:invalid => :replace, :undef => :replace, :replace => '?'}))
|
663
|
+
return Digest::MD5.hexdigest(text.encode('ascii', {:invalid => :replace, :undef => :replace, :replace => '?'}))
|
627
664
|
end
|
628
665
|
|
629
666
|
private
|
data/lib/grabzit/docxoptions.rb
CHANGED
@@ -6,6 +6,7 @@ module GrabzIt
|
|
6
6
|
# @author GrabzIt
|
7
7
|
class DOCXOptions < BaseOptions
|
8
8
|
def initialize()
|
9
|
+
super()
|
9
10
|
@includeBackground = true
|
10
11
|
@pagesize = 'A4'
|
11
12
|
@orientation = 'Portrait'
|
@@ -38,7 +39,7 @@ module GrabzIt
|
|
38
39
|
#
|
39
40
|
# @param value [Boolean] include background images
|
40
41
|
# @return [void]
|
41
|
-
def includeBackground(value)
|
42
|
+
def includeBackground=(value)
|
42
43
|
@includeBackground = value
|
43
44
|
end
|
44
45
|
|
@@ -51,7 +52,7 @@ module GrabzIt
|
|
51
52
|
#
|
52
53
|
# @param value [String] page size
|
53
54
|
# @return [void]
|
54
|
-
def pagesize(value)
|
55
|
+
def pagesize=(value)
|
55
56
|
value = GrabzIt::Utility.nil_check(value).upcase
|
56
57
|
@pagesize = value
|
57
58
|
end
|
@@ -65,7 +66,7 @@ module GrabzIt
|
|
65
66
|
#
|
66
67
|
# @param value [String] page orientation
|
67
68
|
# @return [void]
|
68
|
-
def orientation(value)
|
69
|
+
def orientation=(value)
|
69
70
|
value = GrabzIt::Utility.nil_check(value).capitalize
|
70
71
|
@orientation = value
|
71
72
|
end
|
@@ -79,7 +80,7 @@ module GrabzIt
|
|
79
80
|
#
|
80
81
|
# @param value [Boolean] include links
|
81
82
|
# @return [void]
|
82
|
-
def includeLinks(value)
|
83
|
+
def includeLinks=(value)
|
83
84
|
@includeLinks = value
|
84
85
|
end
|
85
86
|
|
@@ -92,7 +93,7 @@ module GrabzIt
|
|
92
93
|
#
|
93
94
|
# @param value [Boolean] include images
|
94
95
|
# @return [void]
|
95
|
-
def includeImages(value)
|
96
|
+
def includeImages=(value)
|
96
97
|
@includeImages = value
|
97
98
|
end
|
98
99
|
|
@@ -105,7 +106,7 @@ module GrabzIt
|
|
105
106
|
#
|
106
107
|
# @param value [String] DOCX title
|
107
108
|
# @return [void]
|
108
|
-
def title(value)
|
109
|
+
def title=(value)
|
109
110
|
@title = value
|
110
111
|
end
|
111
112
|
|
@@ -118,7 +119,7 @@ module GrabzIt
|
|
118
119
|
#
|
119
120
|
# @param value [Integer] margin top
|
120
121
|
# @return [void]
|
121
|
-
def marginTop(value)
|
122
|
+
def marginTop=(value)
|
122
123
|
@marginTop = value
|
123
124
|
end
|
124
125
|
|
@@ -131,7 +132,7 @@ module GrabzIt
|
|
131
132
|
#
|
132
133
|
# @param value [Integer] margin left
|
133
134
|
# @return [void]
|
134
|
-
def marginLeft(value)
|
135
|
+
def marginLeft=(value)
|
135
136
|
@marginLeft = value
|
136
137
|
end
|
137
138
|
|
@@ -144,7 +145,7 @@ module GrabzIt
|
|
144
145
|
#
|
145
146
|
# @param value [Integer] margin bottom
|
146
147
|
# @return [void]
|
147
|
-
def marginBottom(value)
|
148
|
+
def marginBottom=(value)
|
148
149
|
@marginBottom = value
|
149
150
|
end
|
150
151
|
|
@@ -157,7 +158,7 @@ module GrabzIt
|
|
157
158
|
#
|
158
159
|
# @param value [Integer] margin right
|
159
160
|
# @return [void]
|
160
|
-
def marginRight(value)
|
161
|
+
def marginRight=(value)
|
161
162
|
@marginRight = value
|
162
163
|
end
|
163
164
|
|
@@ -170,7 +171,7 @@ module GrabzIt
|
|
170
171
|
#
|
171
172
|
# @param value [Integer] the browser width
|
172
173
|
# @return [void]
|
173
|
-
def browserWidth(value)
|
174
|
+
def browserWidth=(value)
|
174
175
|
@browserWidth = value
|
175
176
|
end
|
176
177
|
|
@@ -183,7 +184,7 @@ module GrabzIt
|
|
183
184
|
#
|
184
185
|
# @param value [Integer] the width
|
185
186
|
# @return [void]
|
186
|
-
def pageWidth(value)
|
187
|
+
def pageWidth=(value)
|
187
188
|
@width = value
|
188
189
|
end
|
189
190
|
|
@@ -196,7 +197,7 @@ module GrabzIt
|
|
196
197
|
#
|
197
198
|
# @param value [Integer] the height
|
198
199
|
# @return [void]
|
199
|
-
def pageHeight(value)
|
200
|
+
def pageHeight=(value)
|
200
201
|
@height = value
|
201
202
|
end
|
202
203
|
|
@@ -209,7 +210,7 @@ module GrabzIt
|
|
209
210
|
#
|
210
211
|
# @param value [Integer] delay
|
211
212
|
# @return [void]
|
212
|
-
def delay(value)
|
213
|
+
def delay=(value)
|
213
214
|
@delay = value
|
214
215
|
end
|
215
216
|
|
@@ -222,7 +223,7 @@ module GrabzIt
|
|
222
223
|
#
|
223
224
|
# @param value [Integer] the browser type
|
224
225
|
# @return [void]
|
225
|
-
def requestAs(value)
|
226
|
+
def requestAs=(value)
|
226
227
|
@requestAs = value
|
227
228
|
end
|
228
229
|
|
@@ -235,7 +236,7 @@ module GrabzIt
|
|
235
236
|
#
|
236
237
|
# @param value [String] template id
|
237
238
|
# @return [void]
|
238
|
-
def templateId(value)
|
239
|
+
def templateId=(value)
|
239
240
|
@templateId = value
|
240
241
|
end
|
241
242
|
|
@@ -248,7 +249,7 @@ module GrabzIt
|
|
248
249
|
#
|
249
250
|
# @param value [Integer] quality
|
250
251
|
# @return [void]
|
251
|
-
def quality(value)
|
252
|
+
def quality=(value)
|
252
253
|
@quality = value
|
253
254
|
end
|
254
255
|
|
@@ -261,7 +262,7 @@ module GrabzIt
|
|
261
262
|
#
|
262
263
|
# @param value [String] the target element
|
263
264
|
# @return [void]
|
264
|
-
def targetElement(value)
|
265
|
+
def targetElement=(value)
|
265
266
|
@targetElement = value
|
266
267
|
end
|
267
268
|
|
@@ -274,7 +275,7 @@ module GrabzIt
|
|
274
275
|
#
|
275
276
|
# @param value [String] the element(s) to hide
|
276
277
|
# @return [void]
|
277
|
-
def hideElement(value)
|
278
|
+
def hideElement=(value)
|
278
279
|
@hideElement = value
|
279
280
|
end
|
280
281
|
|
@@ -287,7 +288,7 @@ module GrabzIt
|
|
287
288
|
#
|
288
289
|
# @param value [String] the element to wait for
|
289
290
|
# @return [void]
|
290
|
-
def waitForElement(value)
|
291
|
+
def waitForElement=(value)
|
291
292
|
@waitForElement = value
|
292
293
|
end
|
293
294
|
|
@@ -300,7 +301,7 @@ module GrabzIt
|
|
300
301
|
#
|
301
302
|
# @param value [Boolean] hide adverts
|
302
303
|
# @return [void]
|
303
|
-
def noAds(value)
|
304
|
+
def noAds=(value)
|
304
305
|
@noAds = value
|
305
306
|
end
|
306
307
|
|
@@ -323,22 +324,14 @@ module GrabzIt
|
|
323
324
|
|
324
325
|
# @!visibility private
|
325
326
|
def _getSignatureString(applicationSecret, callBackURL, url = nil)
|
326
|
-
|
327
|
-
if (url != nil)
|
328
|
-
urlParam = GrabzIt::Utility.nil_check(url)+"|"
|
329
|
-
end
|
327
|
+
items = [applicationSecret]
|
330
328
|
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
return
|
337
|
-
"|"+GrabzIt::Utility.nil_check(@customId)+"|"+GrabzIt::Utility.b_to_str(@includeBackground)+"|"+@pagesize +"|"+@orientation+"|"+
|
338
|
-
GrabzIt::Utility.b_to_str(@includeImages)+"|"+GrabzIt::Utility.b_to_str(@includeLinks)+"|"+
|
339
|
-
GrabzIt::Utility.nil_check(@title)+"|"+GrabzIt::Utility.nil_int_check(@marginTop)+"|"+GrabzIt::Utility.nil_int_check(@marginLeft)+
|
340
|
-
"|"+GrabzIt::Utility.nil_int_check(@marginBottom)+"|"+GrabzIt::Utility.nil_int_check(@marginRight)+"|"+GrabzIt::Utility.nil_int_check(@delay)+"|"+
|
341
|
-
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)
|
329
|
+
if(url != nil)
|
330
|
+
items.push(GrabzIt::Utility.nil_check(url))
|
331
|
+
end
|
332
|
+
|
333
|
+
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))
|
334
|
+
return items.join("|")
|
342
335
|
end
|
343
336
|
|
344
337
|
# @!visibility private
|
data/lib/grabzit/exception.rb
CHANGED
data/lib/grabzit/imageoptions.rb
CHANGED
@@ -6,6 +6,7 @@ module GrabzIt
|
|
6
6
|
# @author GrabzIt
|
7
7
|
class ImageOptions < BaseOptions
|
8
8
|
def initialize()
|
9
|
+
super()
|
9
10
|
@browserWidth = nil
|
10
11
|
@browserHeight = nil
|
11
12
|
@width = nil
|
@@ -30,7 +31,7 @@ module GrabzIt
|
|
30
31
|
#
|
31
32
|
# @param value [Integer] the browser width
|
32
33
|
# @return [void]
|
33
|
-
def browserWidth(value)
|
34
|
+
def browserWidth=(value)
|
34
35
|
@browserWidth = value
|
35
36
|
end
|
36
37
|
|
@@ -43,7 +44,7 @@ module GrabzIt
|
|
43
44
|
#
|
44
45
|
# @param value [Integer] the browser height
|
45
46
|
# @return [void]
|
46
|
-
def browserHeight(value)
|
47
|
+
def browserHeight=(value)
|
47
48
|
@browserHeight = value
|
48
49
|
end
|
49
50
|
|
@@ -56,7 +57,7 @@ module GrabzIt
|
|
56
57
|
#
|
57
58
|
# @param value [Integer] the width
|
58
59
|
# @return [void]
|
59
|
-
def width(value)
|
60
|
+
def width=(value)
|
60
61
|
@width = value
|
61
62
|
end
|
62
63
|
|
@@ -69,7 +70,7 @@ module GrabzIt
|
|
69
70
|
#
|
70
71
|
# @param value [Integer] the height
|
71
72
|
# @return [void]
|
72
|
-
def height(value)
|
73
|
+
def height=(value)
|
73
74
|
@height = value
|
74
75
|
end
|
75
76
|
|
@@ -82,7 +83,7 @@ module GrabzIt
|
|
82
83
|
#
|
83
84
|
# @param value [String] the format
|
84
85
|
# @return [void]
|
85
|
-
def format(value)
|
86
|
+
def format=(value)
|
86
87
|
@format = value
|
87
88
|
end
|
88
89
|
|
@@ -95,7 +96,7 @@ module GrabzIt
|
|
95
96
|
#
|
96
97
|
# @param value [Integer] the delay
|
97
98
|
# @return [void]
|
98
|
-
def delay(value)
|
99
|
+
def delay=(value)
|
99
100
|
@delay = value
|
100
101
|
end
|
101
102
|
|
@@ -108,7 +109,7 @@ module GrabzIt
|
|
108
109
|
#
|
109
110
|
# @param value [String] the target element
|
110
111
|
# @return [void]
|
111
|
-
def targetElement(value)
|
112
|
+
def targetElement=(value)
|
112
113
|
@targetElement = value
|
113
114
|
end
|
114
115
|
|
@@ -121,7 +122,7 @@ module GrabzIt
|
|
121
122
|
#
|
122
123
|
# @param value [String] the element(s) to hide
|
123
124
|
# @return [void]
|
124
|
-
def hideElement(value)
|
125
|
+
def hideElement=(value)
|
125
126
|
@hideElement = value
|
126
127
|
end
|
127
128
|
|
@@ -134,7 +135,7 @@ module GrabzIt
|
|
134
135
|
#
|
135
136
|
# @param value [String] the element to wait for
|
136
137
|
# @return [void]
|
137
|
-
def waitForElement(value)
|
138
|
+
def waitForElement=(value)
|
138
139
|
@waitForElement = value
|
139
140
|
end
|
140
141
|
|
@@ -147,7 +148,7 @@ module GrabzIt
|
|
147
148
|
#
|
148
149
|
# @param value [Integer] the browser type
|
149
150
|
# @return [void]
|
150
|
-
def requestAs(value)
|
151
|
+
def requestAs=(value)
|
151
152
|
@requestAs = value
|
152
153
|
end
|
153
154
|
|
@@ -160,7 +161,7 @@ module GrabzIt
|
|
160
161
|
#
|
161
162
|
# @param value [String] custom watermark id
|
162
163
|
# @return [void]
|
163
|
-
def customWaterMarkId(value)
|
164
|
+
def customWaterMarkId=(value)
|
164
165
|
@customWaterMarkId = value
|
165
166
|
end
|
166
167
|
|
@@ -173,7 +174,7 @@ module GrabzIt
|
|
173
174
|
#
|
174
175
|
# @param value [Integer] the quality
|
175
176
|
# @return [void]
|
176
|
-
def quality(value)
|
177
|
+
def quality=(value)
|
177
178
|
@quality = value
|
178
179
|
end
|
179
180
|
|
@@ -186,7 +187,7 @@ module GrabzIt
|
|
186
187
|
#
|
187
188
|
# @param value [Boolean] true if the image should be transparent
|
188
189
|
# @return [void]
|
189
|
-
def transparent(value)
|
190
|
+
def transparent=(value)
|
190
191
|
@transparent = value
|
191
192
|
end
|
192
193
|
|
@@ -199,7 +200,7 @@ module GrabzIt
|
|
199
200
|
#
|
200
201
|
# @param value [Boolean] hide adverts
|
201
202
|
# @return [void]
|
202
|
-
def noAds(value)
|
203
|
+
def noAds=(value)
|
203
204
|
@noAds = value
|
204
205
|
end
|
205
206
|
|
@@ -214,20 +215,15 @@ module GrabzIt
|
|
214
215
|
|
215
216
|
# @!visibility private
|
216
217
|
def _getSignatureString(applicationSecret, callBackURL, url = nil)
|
217
|
-
|
218
|
-
if (url != nil)
|
219
|
-
urlParam = GrabzIt::Utility.nil_check(url)+"|"
|
220
|
-
end
|
218
|
+
items = [applicationSecret]
|
221
219
|
|
222
|
-
|
223
|
-
|
224
|
-
callBackURLParam = GrabzIt::Utility.nil_check(callBackURL)
|
220
|
+
if(url != nil)
|
221
|
+
items.push(GrabzIt::Utility.nil_check(url))
|
225
222
|
end
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
"|"+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)
|
223
|
+
|
224
|
+
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))
|
225
|
+
|
226
|
+
return items.join("|")
|
231
227
|
end
|
232
228
|
|
233
229
|
# @!visibility private
|
data/lib/grabzit/pdfoptions.rb
CHANGED
@@ -6,6 +6,7 @@ module GrabzIt
|
|
6
6
|
# @author GrabzIt
|
7
7
|
class PDFOptions < BaseOptions
|
8
8
|
def initialize()
|
9
|
+
super()
|
9
10
|
@includeBackground = true
|
10
11
|
@pagesize = 'A4'
|
11
12
|
@orientation = 'Portrait'
|
@@ -40,7 +41,7 @@ module GrabzIt
|
|
40
41
|
#
|
41
42
|
# @param value [Boolean] include background
|
42
43
|
# @return [void]
|
43
|
-
def includeBackground(value)
|
44
|
+
def includeBackground=(value)
|
44
45
|
@includeBackground = value
|
45
46
|
end
|
46
47
|
|
@@ -53,7 +54,7 @@ module GrabzIt
|
|
53
54
|
#
|
54
55
|
# @param value [String] page size
|
55
56
|
# @return [void]
|
56
|
-
def pagesize(value)
|
57
|
+
def pagesize=(value)
|
57
58
|
value = GrabzIt::Utility.nil_check(value).upcase
|
58
59
|
@pagesize = value
|
59
60
|
end
|
@@ -67,7 +68,7 @@ module GrabzIt
|
|
67
68
|
#
|
68
69
|
# @param value [String] page orientation
|
69
70
|
# @return [void]
|
70
|
-
def orientation(value)
|
71
|
+
def orientation=(value)
|
71
72
|
value = GrabzIt::Utility.nil_check(value).capitalize
|
72
73
|
@orientation = value
|
73
74
|
end
|
@@ -81,7 +82,7 @@ module GrabzIt
|
|
81
82
|
#
|
82
83
|
# @param value [Boolean] include links
|
83
84
|
# @return [void]
|
84
|
-
def includeLinks(value)
|
85
|
+
def includeLinks=(value)
|
85
86
|
@includeLinks = value
|
86
87
|
end
|
87
88
|
|
@@ -94,7 +95,7 @@ module GrabzIt
|
|
94
95
|
#
|
95
96
|
# @param value [Boolean] include links
|
96
97
|
# @return [void]
|
97
|
-
def includeOutline(value)
|
98
|
+
def includeOutline=(value)
|
98
99
|
@includeOutline = value
|
99
100
|
end
|
100
101
|
|
@@ -107,7 +108,7 @@ module GrabzIt
|
|
107
108
|
#
|
108
109
|
# @param value [String] PDF title
|
109
110
|
# @return [void]
|
110
|
-
def title(value)
|
111
|
+
def title=(value)
|
111
112
|
@title = value
|
112
113
|
end
|
113
114
|
|
@@ -120,7 +121,7 @@ module GrabzIt
|
|
120
121
|
#
|
121
122
|
# @param value [String] cover URL
|
122
123
|
# @return [void]
|
123
|
-
def coverURL(value)
|
124
|
+
def coverURL=(value)
|
124
125
|
@coverURL = value
|
125
126
|
end
|
126
127
|
|
@@ -133,7 +134,7 @@ module GrabzIt
|
|
133
134
|
#
|
134
135
|
# @param value [Integer] margin top
|
135
136
|
# @return [void]
|
136
|
-
def marginTop(value)
|
137
|
+
def marginTop=(value)
|
137
138
|
@marginTop = value
|
138
139
|
end
|
139
140
|
|
@@ -146,7 +147,7 @@ module GrabzIt
|
|
146
147
|
#
|
147
148
|
# @param value [Integer] margin left
|
148
149
|
# @return [void]
|
149
|
-
def marginLeft(value)
|
150
|
+
def marginLeft=(value)
|
150
151
|
@marginLeft = value
|
151
152
|
end
|
152
153
|
|
@@ -159,7 +160,7 @@ module GrabzIt
|
|
159
160
|
#
|
160
161
|
# @param value [Integer] margin bottom
|
161
162
|
# @return [void]
|
162
|
-
def marginBottom(value)
|
163
|
+
def marginBottom=(value)
|
163
164
|
@marginBottom = value
|
164
165
|
end
|
165
166
|
|
@@ -172,7 +173,7 @@ module GrabzIt
|
|
172
173
|
#
|
173
174
|
# @param value [Integer] margin right
|
174
175
|
# @return [void]
|
175
|
-
def marginRight(value)
|
176
|
+
def marginRight=(value)
|
176
177
|
@marginRight = value
|
177
178
|
end
|
178
179
|
|
@@ -185,7 +186,7 @@ module GrabzIt
|
|
185
186
|
#
|
186
187
|
# @param value [Integer] the browser width
|
187
188
|
# @return [void]
|
188
|
-
def browserWidth(value)
|
189
|
+
def browserWidth=(value)
|
189
190
|
@browserWidth = value
|
190
191
|
end
|
191
192
|
|
@@ -198,7 +199,7 @@ module GrabzIt
|
|
198
199
|
#
|
199
200
|
# @param value [Integer] the width
|
200
201
|
# @return [void]
|
201
|
-
def pageWidth(value)
|
202
|
+
def pageWidth=(value)
|
202
203
|
@width = value
|
203
204
|
end
|
204
205
|
|
@@ -211,7 +212,7 @@ module GrabzIt
|
|
211
212
|
#
|
212
213
|
# @param value [Integer] the height
|
213
214
|
# @return [void]
|
214
|
-
def pageHeight(value)
|
215
|
+
def pageHeight=(value)
|
215
216
|
@height = value
|
216
217
|
end
|
217
218
|
|
@@ -224,7 +225,7 @@ module GrabzIt
|
|
224
225
|
#
|
225
226
|
# @param value [Integer] delay
|
226
227
|
# @return [void]
|
227
|
-
def delay(value)
|
228
|
+
def delay=(value)
|
228
229
|
@delay = value
|
229
230
|
end
|
230
231
|
|
@@ -237,7 +238,7 @@ module GrabzIt
|
|
237
238
|
#
|
238
239
|
# @param value [Integer] the browser type
|
239
240
|
# @return [void]
|
240
|
-
def requestAs(value)
|
241
|
+
def requestAs=(value)
|
241
242
|
@requestAs = value
|
242
243
|
end
|
243
244
|
|
@@ -250,7 +251,7 @@ module GrabzIt
|
|
250
251
|
#
|
251
252
|
# @param value [String] template id
|
252
253
|
# @return [void]
|
253
|
-
def templateId(value)
|
254
|
+
def templateId=(value)
|
254
255
|
@templateId = value
|
255
256
|
end
|
256
257
|
|
@@ -263,7 +264,7 @@ module GrabzIt
|
|
263
264
|
#
|
264
265
|
# @param value [String] custom watermark id
|
265
266
|
# @return [void]
|
266
|
-
def customWaterMarkId(value)
|
267
|
+
def customWaterMarkId=(value)
|
267
268
|
@customWaterMarkId = value
|
268
269
|
end
|
269
270
|
|
@@ -276,7 +277,7 @@ module GrabzIt
|
|
276
277
|
#
|
277
278
|
# @param value [Integer] quality
|
278
279
|
# @return [void]
|
279
|
-
def quality(value)
|
280
|
+
def quality=(value)
|
280
281
|
@quality = value
|
281
282
|
end
|
282
283
|
|
@@ -289,7 +290,7 @@ module GrabzIt
|
|
289
290
|
#
|
290
291
|
# @param value [String] the target element
|
291
292
|
# @return [void]
|
292
|
-
def targetElement(value)
|
293
|
+
def targetElement=(value)
|
293
294
|
@targetElement = value
|
294
295
|
end
|
295
296
|
|
@@ -302,7 +303,7 @@ module GrabzIt
|
|
302
303
|
#
|
303
304
|
# @param value [String] the element(s) to hide
|
304
305
|
# @return [void]
|
305
|
-
def hideElement(value)
|
306
|
+
def hideElement=(value)
|
306
307
|
@hideElement = value
|
307
308
|
end
|
308
309
|
|
@@ -315,7 +316,7 @@ module GrabzIt
|
|
315
316
|
#
|
316
317
|
# @param value [String] the element to wait for
|
317
318
|
# @return [void]
|
318
|
-
def waitForElement(value)
|
319
|
+
def waitForElement=(value)
|
319
320
|
@waitForElement = value
|
320
321
|
end
|
321
322
|
|
@@ -328,7 +329,7 @@ module GrabzIt
|
|
328
329
|
#
|
329
330
|
# @param value [Boolean] hide adverts
|
330
331
|
# @return [void]
|
331
|
-
def noAds(value)
|
332
|
+
def noAds=(value)
|
332
333
|
@noAds = value
|
333
334
|
end
|
334
335
|
|
@@ -351,26 +352,15 @@ module GrabzIt
|
|
351
352
|
|
352
353
|
# @!visibility private
|
353
354
|
def _getSignatureString(applicationSecret, callBackURL, url = nil)
|
354
|
-
|
355
|
-
if (url != nil)
|
356
|
-
urlParam = GrabzIt::Utility.nil_check(url)+"|"
|
357
|
-
end
|
355
|
+
items = [applicationSecret]
|
358
356
|
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
GrabzIt::Utility.nil_check(@customWaterMarkId)+"|"+GrabzIt::Utility.b_to_str(@includeLinks)+"|"+GrabzIt::Utility.b_to_str(@includeOutline)+"|"+
|
367
|
-
GrabzIt::Utility.nil_check(@title)+"|"+GrabzIt::Utility.nil_check(@coverURL)+"|"+GrabzIt::Utility.nil_int_check(@marginTop)+"|"+GrabzIt::Utility.nil_int_check(@marginLeft)+
|
368
|
-
"|"+GrabzIt::Utility.nil_int_check(@marginBottom)+"|"+GrabzIt::Utility.nil_int_check(@marginRight)+"|"+GrabzIt::Utility.nil_int_check(@delay)+"|"+
|
369
|
-
GrabzIt::Utility.nil_int_check(@requestAs)+"|"+GrabzIt::Utility.nil_check(@country)+"|"+GrabzIt::Utility.nil_int_check(@quality)+"|"+
|
370
|
-
GrabzIt::Utility.nil_check(@templateId)+"|"+GrabzIt::Utility.nil_check(@hideElement)+"|"+GrabzIt::Utility.nil_check(@targetElement)+"|"+
|
371
|
-
GrabzIt::Utility.nil_check(@exportURL)+"|"+GrabzIt::Utility.nil_check(@waitForElement)+"|"+GrabzIt::Utility.nil_check(@encryptionKey)+"|"+
|
372
|
-
GrabzIt::Utility.b_to_str(@noAds)+"|"+GrabzIt::Utility.nil_check(@post)+"|"+GrabzIt::Utility.nil_int_check(@browserWidth)+"|"+
|
373
|
-
GrabzIt::Utility.nil_int_check(@height)+"|"+GrabzIt::Utility.nil_int_check(@width)+"|"+GrabzIt::Utility.nil_check(@templateVariables)
|
357
|
+
if(url != nil)
|
358
|
+
items.push(GrabzIt::Utility.nil_check(url))
|
359
|
+
end
|
360
|
+
|
361
|
+
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))
|
362
|
+
|
363
|
+
return items.join("|")
|
374
364
|
end
|
375
365
|
|
376
366
|
# @!visibility private
|
data/lib/grabzit/tableoptions.rb
CHANGED
@@ -6,6 +6,7 @@ module GrabzIt
|
|
6
6
|
# @author GrabzIt
|
7
7
|
class TableOptions < BaseOptions
|
8
8
|
def initialize()
|
9
|
+
super()
|
9
10
|
@tableNumberToInclude = 1
|
10
11
|
@format = 'csv'
|
11
12
|
@includeHeaderNames = true
|
@@ -23,7 +24,7 @@ module GrabzIt
|
|
23
24
|
#
|
24
25
|
# @param value [Integer] the table number
|
25
26
|
# @return [void]
|
26
|
-
def tableNumberToInclude(value)
|
27
|
+
def tableNumberToInclude=(value)
|
27
28
|
@tableNumberToInclude = value
|
28
29
|
end
|
29
30
|
|
@@ -36,7 +37,7 @@ module GrabzIt
|
|
36
37
|
#
|
37
38
|
# @param value [String] the format
|
38
39
|
# @return [void]
|
39
|
-
def format(value)
|
40
|
+
def format=(value)
|
40
41
|
@format = value
|
41
42
|
end
|
42
43
|
|
@@ -49,7 +50,7 @@ module GrabzIt
|
|
49
50
|
#
|
50
51
|
# @param value [Boolean] include header names
|
51
52
|
# @return [void]
|
52
|
-
def includeHeaderNames(value)
|
53
|
+
def includeHeaderNames=(value)
|
53
54
|
@includeHeaderNames = value
|
54
55
|
end
|
55
56
|
|
@@ -62,7 +63,7 @@ module GrabzIt
|
|
62
63
|
#
|
63
64
|
# @param value [Boolean] include all tables
|
64
65
|
# @return [void]
|
65
|
-
def includeAllTables(value)
|
66
|
+
def includeAllTables=(value)
|
66
67
|
@includeAllTables = value
|
67
68
|
end
|
68
69
|
|
@@ -75,7 +76,7 @@ module GrabzIt
|
|
75
76
|
#
|
76
77
|
# @param value [String] target
|
77
78
|
# @return [void]
|
78
|
-
def targetElement(value)
|
79
|
+
def targetElement=(value)
|
79
80
|
@targetElement = value
|
80
81
|
end
|
81
82
|
|
@@ -88,7 +89,7 @@ module GrabzIt
|
|
88
89
|
#
|
89
90
|
# @param value [Integer] the browser type
|
90
91
|
# @return [void]
|
91
|
-
def requestAs(value)
|
92
|
+
def requestAs=(value)
|
92
93
|
@requestAs = value
|
93
94
|
end
|
94
95
|
|
@@ -103,21 +104,15 @@ module GrabzIt
|
|
103
104
|
|
104
105
|
# @!visibility private
|
105
106
|
def _getSignatureString(applicationSecret, callBackURL, url = nil)
|
106
|
-
|
107
|
-
if (url != nil)
|
108
|
-
urlParam = GrabzIt::Utility.nil_check(url)+"|"
|
109
|
-
end
|
107
|
+
items = [applicationSecret]
|
110
108
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
"|"+GrabzIt::Utility.b_to_str(@includeHeaderNames)+"|"+GrabzIt::Utility.nil_check(@targetElement)+"|"+GrabzIt::Utility.nil_check(@format)+"|"+
|
119
|
-
GrabzIt::Utility.nil_int_check(@requestAs)+"|"+GrabzIt::Utility.nil_check(@country)+"|"+GrabzIt::Utility.nil_check(@exportURL)+"|"+
|
120
|
-
GrabzIt::Utility.nil_check(@encryptionKey)+"|"+GrabzIt::Utility.nil_check(@post)
|
109
|
+
if(url != nil)
|
110
|
+
items.push(GrabzIt::Utility.nil_check(url))
|
111
|
+
end
|
112
|
+
|
113
|
+
items.push(GrabzIt::Utility.nil_check(callBackURL),GrabzIt::Utility.nil_check(@customId),GrabzIt::Utility.nil_int_check(@tableNumberToInclude),GrabzIt::Utility.b_to_str(@includeAllTables),GrabzIt::Utility.b_to_str(@includeHeaderNames),GrabzIt::Utility.nil_check(@targetElement),GrabzIt::Utility.nil_check(@format),GrabzIt::Utility.nil_int_check(@requestAs),GrabzIt::Utility.nil_check(@country),GrabzIt::Utility.nil_check(@exportURL),GrabzIt::Utility.nil_check(@encryptionKey),GrabzIt::Utility.nil_check(@post),GrabzIt::Utility.nil_check(@proxy))
|
114
|
+
|
115
|
+
return items.join("|")
|
121
116
|
end
|
122
117
|
|
123
118
|
# @!visibility private
|
data/test/test_grabzit.rb
CHANGED
@@ -120,7 +120,7 @@ class GrabzItTest < Test::Unit::TestCase
|
|
120
120
|
end
|
121
121
|
|
122
122
|
def test_delete_watermark
|
123
|
-
assert_nothing_raised "An error occured when trying to
|
123
|
+
assert_nothing_raised "An error occured when trying to delete a watermark" do
|
124
124
|
grabzItClient = GrabzIt::Client.new(@applicationKey, @applicationSecret)
|
125
125
|
begin
|
126
126
|
grabzItClient.delete_watermark(WaterMark_Identifier)
|
@@ -225,8 +225,8 @@ class GrabzItTest < Test::Unit::TestCase
|
|
225
225
|
assert_nothing_raised "An error occured when trying to take a pdf screenshot" do
|
226
226
|
grabzItClient = GrabzIt::Client.new(@applicationKey, @applicationSecret)
|
227
227
|
options = GrabzIt::PDFOptions.new()
|
228
|
-
options.hideElement
|
229
|
-
options.delay
|
228
|
+
options.hideElement = ".ArevicoModal-bg,.ArevicoModal"
|
229
|
+
options.delay = 30000
|
230
230
|
grabzItClient.url_to_pdf("http://www.itnews24hrs.com/2016/05/turnkey-lender/", options)
|
231
231
|
assert_not_nil(grabzItClient.save(), "Failed to take screenshot using test_take_pdf_hide_popup method")
|
232
232
|
end
|
@@ -236,7 +236,7 @@ class GrabzItTest < Test::Unit::TestCase
|
|
236
236
|
assert_nothing_raised "An error occured when trying to take a image screenshot" do
|
237
237
|
grabzItClient = GrabzIt::Client.new(@applicationKey, @applicationSecret)
|
238
238
|
options = GrabzIt::ImageOptions.new()
|
239
|
-
options.customWaterMarkId
|
239
|
+
options.customWaterMarkId = "GrabzIt_Browser"
|
240
240
|
grabzItClient.url_to_image("http://www.google.com", options)
|
241
241
|
assert_not_nil(grabzItClient.save(), "Failed to take screenshot using url_to_image method")
|
242
242
|
end
|
@@ -246,8 +246,8 @@ class GrabzItTest < Test::Unit::TestCase
|
|
246
246
|
assert_nothing_raised "An error occured when trying to take a image screenshot" do
|
247
247
|
grabzItClient = GrabzIt::Client.new(@applicationKey, @applicationSecret)
|
248
248
|
options = GrabzIt::ImageOptions.new()
|
249
|
-
options.hideElement
|
250
|
-
options.delay
|
249
|
+
options.hideElement = ".ArevicoModal-bg,.ArevicoModal"
|
250
|
+
options.delay = 30000
|
251
251
|
grabzItClient.url_to_image("http://www.itnews24hrs.com/2016/05/turnkey-lender/", options)
|
252
252
|
assert_not_nil(grabzItClient.save(), "Failed to take screenshot using test_take_image_hide_popup method")
|
253
253
|
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.2.
|
4
|
+
version: 3.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GrabzIt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|