grabzit 3.2.2 → 3.2.3
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/baseoptions.rb +24 -0
- data/lib/grabzit/docxoptions.rb +26 -1
- data/lib/grabzit/exception.rb +3 -2
- data/lib/grabzit/imageoptions.rb +26 -1
- data/lib/grabzit/pdfoptions.rb +26 -1
- data/lib/grabzit/tableoptions.rb +12 -2
- 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: ac861b1b741d2b6c533a29b4bd2d047476f2669b
|
4
|
+
data.tar.gz: 7cac14efbf3cdd1b639c01111d6e2df2fd22eb4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89aa83b322dcd096ff561d75397e374b6b1f711cad30c8a7cf73715f7ab7bdb255a7d908651ebfc911bfd3bbebf13242427dd4b39cbcd937a3cd50c9bd8c5a3f
|
7
|
+
data.tar.gz: 08f6157ddb1674d4cbae723874a0ad418cdf63e9d227129802dfb866c922026990f587e96dac919f1a69ab398f9c07bb58aa3917cf6fa7ff030dd5f11cc3bb12
|
data/lib/grabzit/baseoptions.rb
CHANGED
@@ -9,6 +9,7 @@ module GrabzIt
|
|
9
9
|
@exportURL = nil
|
10
10
|
@encryptionKey = nil
|
11
11
|
@delay = nil
|
12
|
+
@post = nil
|
12
13
|
end
|
13
14
|
|
14
15
|
# @return [String] the custom identifier that you can pass through to the web service.
|
@@ -71,6 +72,29 @@ module GrabzIt
|
|
71
72
|
return @delay
|
72
73
|
end
|
73
74
|
|
75
|
+
protected
|
76
|
+
def appendPostParameter(name, value)
|
77
|
+
val = ""
|
78
|
+
if name != nil && name != ""
|
79
|
+
val = CGI.escape(name)
|
80
|
+
val += "="
|
81
|
+
if value != nil && value != ""
|
82
|
+
val += CGI.escape(value)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
if val == ""
|
87
|
+
return
|
88
|
+
end
|
89
|
+
if @post == nil
|
90
|
+
@post = val
|
91
|
+
return
|
92
|
+
end
|
93
|
+
|
94
|
+
@post += "&"
|
95
|
+
@post += val
|
96
|
+
end
|
97
|
+
|
74
98
|
protected
|
75
99
|
def createParameters(applicationKey, sig, callBackURL, dataName, dataValue)
|
76
100
|
params = Hash.new
|
data/lib/grabzit/docxoptions.rb
CHANGED
@@ -20,6 +20,7 @@ module GrabzIt
|
|
20
20
|
@quality = -1
|
21
21
|
@hideElement = nil
|
22
22
|
@waitForElement = nil
|
23
|
+
@noAds = false
|
23
24
|
end
|
24
25
|
|
25
26
|
# @return [Boolean] true if the background images of the web page should be included in the DOCX
|
@@ -218,6 +219,28 @@ module GrabzIt
|
|
218
219
|
def waitForElement(value)
|
219
220
|
@waitForElement = value
|
220
221
|
end
|
222
|
+
|
223
|
+
# @return [Boolean] get if adverts should be automatically hidden
|
224
|
+
def noAds
|
225
|
+
@noAds
|
226
|
+
end
|
227
|
+
|
228
|
+
# Set to true if adverts should be automatically hidden
|
229
|
+
#
|
230
|
+
# @param value [Boolean] hide adverts
|
231
|
+
# @return [void]
|
232
|
+
def noAds(value)
|
233
|
+
@noAds = value
|
234
|
+
end
|
235
|
+
|
236
|
+
# Define a HTTP Post parameter and optionally value, this method can be called multiple times to add multiple parameters. Using this method will force
|
237
|
+
# GrabzIt to perform a HTTP post.
|
238
|
+
#
|
239
|
+
# @param name [String] the name of the HTTP Post parameter
|
240
|
+
# @param value [String] the value of the HTTP Post parameter
|
241
|
+
def add_post_parameter(name, value)
|
242
|
+
appendPostParameter(name, value)
|
243
|
+
end
|
221
244
|
|
222
245
|
# @!visibility private
|
223
246
|
def _getSignatureString(applicationSecret, callBackURL, url = nil)
|
@@ -236,7 +259,7 @@ module GrabzIt
|
|
236
259
|
GrabzIt::Utility.b_to_str(@includeImages)+"|"+GrabzIt::Utility.b_to_str(@includeLinks)+"|"+
|
237
260
|
GrabzIt::Utility.nil_check(@title)+"|"+GrabzIt::Utility.nil_int_check(@marginTop)+"|"+GrabzIt::Utility.nil_int_check(@marginLeft)+
|
238
261
|
"|"+GrabzIt::Utility.nil_int_check(@marginBottom)+"|"+GrabzIt::Utility.nil_int_check(@marginRight)+"|"+GrabzIt::Utility.nil_int_check(@delay)+"|"+
|
239
|
-
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)
|
262
|
+
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)
|
240
263
|
end
|
241
264
|
|
242
265
|
# @!visibility private
|
@@ -257,6 +280,8 @@ module GrabzIt
|
|
257
280
|
params['quality'] = GrabzIt::Utility.nil_int_check(@quality)
|
258
281
|
params['hide'] = GrabzIt::Utility.nil_check(@hideElement)
|
259
282
|
params['waitfor'] = GrabzIt::Utility.nil_check(@waitForElement)
|
283
|
+
params['noads'] = GrabzIt::Utility.b_to_str(@noAds)
|
284
|
+
params['post'] = GrabzIt::Utility.nil_check(@post)
|
260
285
|
|
261
286
|
return params;
|
262
287
|
end
|
data/lib/grabzit/exception.rb
CHANGED
@@ -68,6 +68,7 @@ module GrabzIt
|
|
68
68
|
PARAMETER_INVALID_WAIT_FOR_VALUE = 169
|
69
69
|
PARAMETER_INVALID_TRANSPARENT_VALUE = 170
|
70
70
|
PARAMETER_INVALID_ENCRYPTION_KEY = 171
|
71
|
+
PARAMETER_INVALID_NO_ADS = 172
|
71
72
|
NETWORK_SERVER_OFFLINE = 200
|
72
73
|
NETWORK_GENERAL_ERROR = 201
|
73
74
|
NETWORK_DDOS_ATTACK = 202
|
@@ -77,7 +78,7 @@ module GrabzIt
|
|
77
78
|
UPGRADE_REQUIRED = 500
|
78
79
|
FILE_SAVE_ERROR = 600
|
79
80
|
FILE_NON_EXISTANT_PATH = 601
|
80
|
-
|
81
|
+
|
81
82
|
# @api private
|
82
83
|
def initialize(message, code)
|
83
84
|
@Code = code
|
@@ -87,6 +88,6 @@ module GrabzIt
|
|
87
88
|
# @return [Integer] the value of the error code
|
88
89
|
def code
|
89
90
|
@Code
|
90
|
-
end
|
91
|
+
end
|
91
92
|
end
|
92
93
|
end
|
data/lib/grabzit/imageoptions.rb
CHANGED
@@ -18,6 +18,7 @@ module GrabzIt
|
|
18
18
|
@customWaterMarkId = nil
|
19
19
|
@quality = -1
|
20
20
|
@transparent = false
|
21
|
+
@noAds = false
|
21
22
|
end
|
22
23
|
|
23
24
|
# @return [Integer] the width of the browser in pixels
|
@@ -189,6 +190,28 @@ module GrabzIt
|
|
189
190
|
@transparent = value
|
190
191
|
end
|
191
192
|
|
193
|
+
# @return [Boolean] get if adverts should be automatically hidden
|
194
|
+
def noAds
|
195
|
+
@noAds
|
196
|
+
end
|
197
|
+
|
198
|
+
# Set to true if adverts should be automatically hidden
|
199
|
+
#
|
200
|
+
# @param value [Boolean] hide adverts
|
201
|
+
# @return [void]
|
202
|
+
def noAds(value)
|
203
|
+
@noAds = value
|
204
|
+
end
|
205
|
+
|
206
|
+
# Define a HTTP Post parameter and optionally value, this method can be called multiple times to add multiple parameters. Using this method will force
|
207
|
+
# GrabzIt to perform a HTTP post.
|
208
|
+
#
|
209
|
+
# @param name [String] the name of the HTTP Post parameter
|
210
|
+
# @param value [String] the value of the HTTP Post parameter
|
211
|
+
def add_post_parameter(name, value)
|
212
|
+
appendPostParameter(name, value)
|
213
|
+
end
|
214
|
+
|
192
215
|
# @!visibility private
|
193
216
|
def _getSignatureString(applicationSecret, callBackURL, url = nil)
|
194
217
|
urlParam = ''
|
@@ -204,7 +227,7 @@ module GrabzIt
|
|
204
227
|
return applicationSecret+"|"+ urlParam + callBackURLParam +
|
205
228
|
"|"+GrabzIt::Utility.nil_check(@format)+"|"+GrabzIt::Utility.nil_int_check(@height)+"|"+GrabzIt::Utility.nil_int_check(@width)+"|"+GrabzIt::Utility.nil_int_check(@browserHeight)+
|
206
229
|
"|"+GrabzIt::Utility.nil_int_check(@browserWidth)+"|"+GrabzIt::Utility.nil_check(@customId)+"|"+GrabzIt::Utility.nil_int_check(@delay)+"|"+GrabzIt::Utility.nil_check(@targetElement)+
|
207
|
-
"|"+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)
|
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)
|
208
231
|
end
|
209
232
|
|
210
233
|
# @!visibility private
|
@@ -223,6 +246,8 @@ module GrabzIt
|
|
223
246
|
params['requestmobileversion'] = GrabzIt::Utility.nil_int_check(@requestAs)
|
224
247
|
params['quality'] = GrabzIt::Utility.nil_int_check(@quality)
|
225
248
|
params['transparent'] = GrabzIt::Utility.b_to_str(@transparent)
|
249
|
+
params['noads'] = GrabzIt::Utility.b_to_str(@noAds)
|
250
|
+
params['post'] = GrabzIt::Utility.nil_check(@post)
|
226
251
|
|
227
252
|
return params
|
228
253
|
end
|
data/lib/grabzit/pdfoptions.rb
CHANGED
@@ -24,6 +24,7 @@ module GrabzIt
|
|
24
24
|
@targetElement = nil
|
25
25
|
@hideElement = nil
|
26
26
|
@waitForElement = nil
|
27
|
+
@noAds = false
|
27
28
|
end
|
28
29
|
|
29
30
|
# @return [Boolean] true if the background of the web page should be included in the PDF
|
@@ -275,6 +276,28 @@ module GrabzIt
|
|
275
276
|
@waitForElement = value
|
276
277
|
end
|
277
278
|
|
279
|
+
# @return [Boolean] get if adverts should be automatically hidden
|
280
|
+
def noAds
|
281
|
+
@noAds
|
282
|
+
end
|
283
|
+
|
284
|
+
# Set to true if adverts should be automatically hidden
|
285
|
+
#
|
286
|
+
# @param value [Boolean] hide adverts
|
287
|
+
# @return [void]
|
288
|
+
def noAds(value)
|
289
|
+
@noAds = value
|
290
|
+
end
|
291
|
+
|
292
|
+
# Define a HTTP Post parameter and optionally value, this method can be called multiple times to add multiple parameters. Using this method will force
|
293
|
+
# GrabzIt to perform a HTTP post.
|
294
|
+
#
|
295
|
+
# @param name [String] the name of the HTTP Post parameter
|
296
|
+
# @param value [String] the value of the HTTP Post parameter
|
297
|
+
def add_post_parameter(name, value)
|
298
|
+
appendPostParameter(name, value)
|
299
|
+
end
|
300
|
+
|
278
301
|
# @!visibility private
|
279
302
|
def _getSignatureString(applicationSecret, callBackURL, url = nil)
|
280
303
|
urlParam = ''
|
@@ -292,7 +315,7 @@ module GrabzIt
|
|
292
315
|
GrabzIt::Utility.nil_check(@customWaterMarkId)+"|"+GrabzIt::Utility.b_to_str(@includeLinks)+"|"+GrabzIt::Utility.b_to_str(@includeOutline)+"|"+
|
293
316
|
GrabzIt::Utility.nil_check(@title)+"|"+GrabzIt::Utility.nil_check(@coverURL)+"|"+GrabzIt::Utility.nil_int_check(@marginTop)+"|"+GrabzIt::Utility.nil_int_check(@marginLeft)+
|
294
317
|
"|"+GrabzIt::Utility.nil_int_check(@marginBottom)+"|"+GrabzIt::Utility.nil_int_check(@marginRight)+"|"+GrabzIt::Utility.nil_int_check(@delay)+"|"+
|
295
|
-
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)
|
318
|
+
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)
|
296
319
|
end
|
297
320
|
|
298
321
|
# @!visibility private
|
@@ -317,6 +340,8 @@ module GrabzIt
|
|
317
340
|
params['target'] = GrabzIt::Utility.nil_check(@targetElement)
|
318
341
|
params['hide'] = GrabzIt::Utility.nil_check(@hideElement)
|
319
342
|
params['waitfor'] = GrabzIt::Utility.nil_check(@waitForElement)
|
343
|
+
params['noads'] = GrabzIt::Utility.b_to_str(@noAds)
|
344
|
+
params['post'] = GrabzIt::Utility.nil_check(@post)
|
320
345
|
|
321
346
|
return params;
|
322
347
|
end
|
data/lib/grabzit/tableoptions.rb
CHANGED
@@ -92,6 +92,15 @@ module GrabzIt
|
|
92
92
|
@requestAs = value
|
93
93
|
end
|
94
94
|
|
95
|
+
# Define a HTTP Post parameter and optionally value, this method can be called multiple times to add multiple parameters. Using this method will force
|
96
|
+
# GrabzIt to perform a HTTP post.
|
97
|
+
#
|
98
|
+
# @param name [String] the name of the HTTP Post parameter
|
99
|
+
# @param value [String] the value of the HTTP Post parameter
|
100
|
+
def add_post_parameter(name, value)
|
101
|
+
appendPostParameter(name, value)
|
102
|
+
end
|
103
|
+
|
95
104
|
# @!visibility private
|
96
105
|
def _getSignatureString(applicationSecret, callBackURL, url = nil)
|
97
106
|
urlParam = ''
|
@@ -108,7 +117,7 @@ module GrabzIt
|
|
108
117
|
"|"+GrabzIt::Utility.nil_check(@customId)+"|"+GrabzIt::Utility.nil_int_check(@tableNumberToInclude)+"|"+GrabzIt::Utility.b_to_str(@includeAllTables)+
|
109
118
|
"|"+GrabzIt::Utility.b_to_str(@includeHeaderNames)+"|"+GrabzIt::Utility.nil_check(@targetElement)+"|"+GrabzIt::Utility.nil_check(@format)+"|"+
|
110
119
|
GrabzIt::Utility.nil_int_check(@requestAs)+"|"+GrabzIt::Utility.nil_check(@country)+"|"+GrabzIt::Utility.nil_check(@exportURL)+"|"+
|
111
|
-
GrabzIt::Utility.nil_check(@encryptionKey)
|
120
|
+
GrabzIt::Utility.nil_check(@encryptionKey)+"|"+GrabzIt::Utility.nil_check(@post)
|
112
121
|
end
|
113
122
|
|
114
123
|
# @!visibility private
|
@@ -120,7 +129,8 @@ module GrabzIt
|
|
120
129
|
params['tableToInclude'] = GrabzIt::Utility.nil_int_check(@tableNumberToInclude)
|
121
130
|
params['target'] = GrabzIt::Utility.nil_check(@targetElement)
|
122
131
|
params['requestmobileversion'] = GrabzIt::Utility.nil_int_check(@requestAs)
|
123
|
-
|
132
|
+
params['post'] = GrabzIt::Utility.nil_check(@post)
|
133
|
+
|
124
134
|
return params
|
125
135
|
end
|
126
136
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GrabzIt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|