grabzit 3.1.1 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZjE1ZGZiMzE3NmRjMzY2MzJkZmRlNzE1MjRiOGQxNGJlN2Q1MDIwYQ==
4
+ YmRiZjBkODBkNjYxOTVhMzg3ZTI3NDM1MjY4NDEwYjcxNjkwNWM5Ng==
5
5
  data.tar.gz: !binary |-
6
- YjI1ZTEzZWU4M2VhM2U0NWVkMDAwZDE0YzdmMTM2ZDkzMTIwYWMzNA==
6
+ MmMyN2FiMGJiNjEyZWEzOGZlYzVlN2FhZTA4YjQ5NGQwOTcwNjNiZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZDMzOTFhMmY0ZDUwMDgzMDA4ZTY4NjEzMGVlMTNkNTg3MTg1Y2M0ODE0Zjky
10
- NmFjZWUwZDliNjkxMzhmYmYxYjE1MGY1NDg2ZDM2YmRiMzg3NDA4OGQ4MmNj
11
- ZjA3OTdkNzRkMWI4M2NhM2Q2YmQ0YzhmM2FmMzdiYjVjNmFmYjg=
9
+ YjA1YzU2NjcyNDdmYjgzMzhkMTVkNTQyZTM0ZjY2MGQ0NTdhNTMzYTA2NWJk
10
+ ZjQwNTViMzk0NDFjNmE2NWE2MDBlNjFhMTBmMTcwMzZmOTk4ODk0MjhjNTAx
11
+ ZWIzNWFmODNiNmFlMGZlZjIwM2EzMzE2ZGE1ZjMxMDhjNDM2NjU=
12
12
  data.tar.gz: !binary |-
13
- MDQ1YzY2YzU5YjA5ZGYyMjZjZWZhZTI0NGQ1Yjk0MmUzZDI4MmFmNWVlMmFl
14
- NDUxZWU2ODA0YzQ3ZjRlMThiZjBmODEwMjkwZDM5ZGY5NzJjMzQxYTNmZmQ1
15
- M2QyOTQwNWRiYjhhMWY2MjViOTdkMzczMWU4NTVmOGVmNTA0NDI=
13
+ ZTEwMWY2Y2VmYTNjNGI4ODIxOGQ1MjFhZWQ1NmNjZDQ1Y2NjOWI3YzJkNzNk
14
+ ZmY0OTk3YTdlN2Y2ODQzNmVjMTY1MjllMGZlZTMxYjJhMDJmNmMzZmYwYjBi
15
+ Y2Q2N2NlYWNlNTcyODJiOTNhY2FlNGViMDk2NGQ0ZjFhYzU2MGQ=
@@ -9,7 +9,7 @@ module GrabzIt
9
9
  @width = 0
10
10
  @height = 0
11
11
  @start = 0
12
- @duration = 0
12
+ @duration = 1
13
13
  @speed = 0
14
14
  @framesPerSecond = 0
15
15
  @repeat = 0
@@ -164,7 +164,8 @@ module GrabzIt
164
164
  "|"+GrabzIt::Utility.nil_int_check(@height)+"|"+GrabzIt::Utility.nil_int_check(@width)+"|"+GrabzIt::Utility.nil_check(@customId)+"|"+
165
165
  GrabzIt::Utility.nil_float_check(@framesPerSecond)+"|"+GrabzIt::Utility.nil_float_check(@speed)+"|"+GrabzIt::Utility.nil_int_check(@duration)+
166
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)
167
+ "|"+GrabzIt::Utility.nil_check(@customWaterMarkId)+"|"+GrabzIt::Utility.nil_check(@country)+"|"+GrabzIt::Utility.nil_int_check(@quality)+
168
+ "|"+GrabzIt::Utility.nil_check(@exportURL)
168
169
  end
169
170
 
170
171
  # @!visibility private
@@ -6,6 +6,7 @@ module GrabzIt
6
6
  def initialize()
7
7
  @customId = nil
8
8
  @country = nil
9
+ @exportURL = nil
9
10
  @delay = nil
10
11
  end
11
12
 
@@ -27,13 +28,26 @@ module GrabzIt
27
28
  @country
28
29
  end
29
30
 
30
- # Set the country the capture should be created from: Default = "", UK = "UK", US = "US".
31
+ # Set the country the capture should be created from: Default = "", Singapore = "SG", UK = "UK", US = "US".
31
32
  #
32
33
  # @param value [String] the country to use
33
34
  # @return [void]
34
35
  def country(value)
35
36
  @country = value
36
- end
37
+ end
38
+
39
+ # @return [String] the export URL that should be used to transfer the capture to a third party location.
40
+ def exportURL
41
+ @exportURL
42
+ end
43
+
44
+ # Set the export URL that should be used to transfer the capture to a third party location
45
+ #
46
+ # @param value [String] export URL to use
47
+ # @return [void]
48
+ def exportURL(value)
49
+ @exportURL = value
50
+ end
37
51
 
38
52
  # @!visibility private
39
53
  def startDelay
@@ -46,12 +60,13 @@ module GrabzIt
46
60
  protected
47
61
  def createParameters(applicationKey, sig, callBackURL, dataName, dataValue)
48
62
  params = Hash.new
49
- params['key'] = GrabzIt::Utility.nil_check(applicationKey);
50
- params['country'] = GrabzIt::Utility.nil_check(@country);
51
- params['customid'] = GrabzIt::Utility.nil_check(@customId);
52
- params['callback'] = GrabzIt::Utility.nil_check(callBackURL);
53
- params['sig'] = sig;
54
- params[dataName] = GrabzIt::Utility.nil_check(dataValue);
63
+ params['key'] = GrabzIt::Utility.nil_check(applicationKey)
64
+ params['country'] = GrabzIt::Utility.nil_check(@country)
65
+ params['customid'] = GrabzIt::Utility.nil_check(@customId)
66
+ params['callback'] = GrabzIt::Utility.nil_check(callBackURL)
67
+ params['export'] = GrabzIt::Utility.nil_check(@exportURL)
68
+ params['sig'] = sig
69
+ params[dataName] = GrabzIt::Utility.nil_check(dataValue)
55
70
 
56
71
  return params
57
72
  end
@@ -30,9 +30,9 @@ module GrabzIt
30
30
  # @see http://grabz.it/api/ruby/ GrabzIt Ruby API
31
31
  class Client
32
32
 
33
- WebServicesBaseURLGet = "http://api.grabz.it/services/"
33
+ WebServicesBaseURLGet = "://api.grabz.it/services/"
34
34
  private_constant :WebServicesBaseURLGet
35
- WebServicesBaseURLPost = "http://grabz.it/services/"
35
+ WebServicesBaseURLPost = "://grabz.it/services/"
36
36
  private_constant :WebServicesBaseURLPost
37
37
  TakePicture = "takepicture.ashx"
38
38
  private_constant :TakePicture
@@ -53,6 +53,7 @@ module GrabzIt
53
53
  def initialize(applicationKey, applicationSecret)
54
54
  @applicationKey = applicationKey
55
55
  @applicationSecret = applicationSecret
56
+ @protocol = 'http'
56
57
  end
57
58
 
58
59
  # This method specifies the URL of the online video that should be converted into a animated GIF
@@ -66,7 +67,7 @@ module GrabzIt
66
67
  options = AnimationOptions.new()
67
68
  end
68
69
 
69
- @request = Request.new(WebServicesBaseURLGet + "takeanimation.ashx", false, options, url)
70
+ @request = Request.new(@protocol + WebServicesBaseURLGet + "takeanimation.ashx", false, options, url)
70
71
  return nil
71
72
  end
72
73
 
@@ -81,7 +82,7 @@ module GrabzIt
81
82
  options = ImageOptions.new()
82
83
  end
83
84
 
84
- @request = Request.new(WebServicesBaseURLGet + TakePicture, false, options, url)
85
+ @request = Request.new(@protocol + WebServicesBaseURLGet + TakePicture, false, options, url)
85
86
  return nil
86
87
  end
87
88
 
@@ -96,7 +97,7 @@ module GrabzIt
96
97
  options = ImageOptions.new()
97
98
  end
98
99
 
99
- @request = Request.new(WebServicesBaseURLPost + TakePicture, true, options, html)
100
+ @request = Request.new(@protocol + WebServicesBaseURLPost + TakePicture, true, options, html)
100
101
  return nil
101
102
  end
102
103
 
@@ -120,7 +121,7 @@ module GrabzIt
120
121
  options = TableOptions.new()
121
122
  end
122
123
 
123
- @request = Request.new(WebServicesBaseURLGet + TakeTable, false, options, url)
124
+ @request = Request.new(@protocol + WebServicesBaseURLGet + TakeTable, false, options, url)
124
125
  return nil
125
126
  end
126
127
 
@@ -135,7 +136,7 @@ module GrabzIt
135
136
  options = TableOptions.new()
136
137
  end
137
138
 
138
- @request = Request.new(WebServicesBaseURLPost + TakeTable, true, options, html)
139
+ @request = Request.new(@protocol + WebServicesBaseURLPost + TakeTable, true, options, html)
139
140
  return nil
140
141
  end
141
142
 
@@ -159,7 +160,7 @@ module GrabzIt
159
160
  options = PDFOptions.new()
160
161
  end
161
162
 
162
- @request = Request.new(WebServicesBaseURLGet + TakePDF, false, options, url)
163
+ @request = Request.new(@protocol + WebServicesBaseURLGet + TakePDF, false, options, url)
163
164
  return nil
164
165
  end
165
166
 
@@ -174,7 +175,7 @@ module GrabzIt
174
175
  options = PDFOptions.new()
175
176
  end
176
177
 
177
- @request = Request.new(WebServicesBaseURLPost + TakePDF, true, options, html)
178
+ @request = Request.new(@protocol + WebServicesBaseURLPost + TakePDF, true, options, html)
178
179
  return nil
179
180
  end
180
181
 
@@ -198,7 +199,7 @@ module GrabzIt
198
199
  options = DOCXOptions.new()
199
200
  end
200
201
 
201
- @request = Request.new(WebServicesBaseURLGet + TakeDOCX, false, options, url)
202
+ @request = Request.new(@protocol + WebServicesBaseURLGet + TakeDOCX, false, options, url)
202
203
  return nil
203
204
  end
204
205
 
@@ -213,7 +214,7 @@ module GrabzIt
213
214
  options = DOCXOptions.new()
214
215
  end
215
216
 
216
- @request = Request.new(WebServicesBaseURLPost + TakeDOCX, true, options, html)
217
+ @request = Request.new(@protocol + WebServicesBaseURLPost + TakeDOCX, true, options, html)
217
218
  return nil
218
219
  end
219
220
 
@@ -316,7 +317,7 @@ module GrabzIt
316
317
  return nil
317
318
  end
318
319
 
319
- result = get(WebServicesBaseURLGet + "getstatus.ashx?id=" + GrabzIt::Utility.nil_check(id))
320
+ result = get(@protocol + WebServicesBaseURLGet + "getstatus.ashx?id=" + GrabzIt::Utility.nil_check(id))
320
321
 
321
322
  doc = REXML::Document.new(result)
322
323
 
@@ -338,7 +339,7 @@ module GrabzIt
338
339
  return nil
339
340
  end
340
341
 
341
- return get(WebServicesBaseURLGet + "getfile.ashx?id=" + GrabzIt::Utility.nil_check(id))
342
+ return get(@protocol + WebServicesBaseURLGet + "getfile.ashx?id=" + GrabzIt::Utility.nil_check(id))
342
343
  end
343
344
 
344
345
  # Get all the cookies that GrabzIt is using for a particular domain. This may include your user set cookies as well
@@ -351,7 +352,7 @@ module GrabzIt
351
352
 
352
353
  qs = "key=" +CGI.escape(GrabzIt::Utility.nil_check(@applicationKey))+"&domain="+CGI.escape(GrabzIt::Utility.nil_check(domain))+"&sig="+sig
353
354
 
354
- result = get(WebServicesBaseURLGet + "getcookies.ashx?" + qs)
355
+ result = get(@protocol + WebServicesBaseURLGet + "getcookies.ashx?" + qs)
355
356
 
356
357
  doc = REXML::Document.new(result)
357
358
 
@@ -393,7 +394,7 @@ module GrabzIt
393
394
  CGI.escape(GrabzIt::Utility.nil_check(name))+"&value="+CGI.escape(GrabzIt::Utility.nil_check(value))+"&path="+CGI.escape(GrabzIt::Utility.nil_check(path))+
394
395
  "&httponly="+GrabzIt::Utility.b_to_str(httponly)+"&expires="+CGI.escape(GrabzIt::Utility.nil_check(expires))+"&sig="+sig
395
396
 
396
- return (get_result_value(get(WebServicesBaseURLGet + "setcookie.ashx?" + qs), "Result") == TrueString)
397
+ return (get_result_value(get(@protocol + WebServicesBaseURLGet + "setcookie.ashx?" + qs), "Result") == TrueString)
397
398
  end
398
399
 
399
400
  # Delete a custom cookie or block a global cookie from being used
@@ -409,7 +410,7 @@ module GrabzIt
409
410
  qs = "key=" + CGI.escape(GrabzIt::Utility.nil_check(@applicationKey))+"&domain="+CGI.escape(GrabzIt::Utility.nil_check(domain))+
410
411
  "&name="+CGI.escape(GrabzIt::Utility.nil_check(name))+"&delete=1&sig="+sig
411
412
 
412
- return (get_result_value(get(WebServicesBaseURLGet + "setcookie.ashx?" + qs), "Result") == TrueString)
413
+ return (get_result_value(get(@protocol + WebServicesBaseURLGet + "setcookie.ashx?" + qs), "Result") == TrueString)
413
414
  end
414
415
 
415
416
  # Get your uploaded custom watermark
@@ -449,7 +450,7 @@ module GrabzIt
449
450
 
450
451
  boundary = '--------------------------'+Time.now.to_f.to_s
451
452
 
452
- url = "http://grabz.it/services/addwatermark.ashx"
453
+ url = @protocol + "://grabz.it/services/addwatermark.ashx"
453
454
  uri = URI.parse(url)
454
455
 
455
456
  file = File.open(path, "rb")
@@ -485,7 +486,7 @@ module GrabzIt
485
486
  request.content_type = "multipart/form-data, boundary="+boundary
486
487
  request.body = post_body.join
487
488
 
488
- response = Net::HTTP.new(uri.host, uri.port).start {|http| http.request(request) }
489
+ response = Net::HTTP.new(uri.host, uri.port, :use_ssl => uri.scheme == 'https').start {|http| http.request(request) }
489
490
  response_check(response)
490
491
 
491
492
  return (get_result_value(response.body(), "Result") == TrueString)
@@ -501,8 +502,19 @@ module GrabzIt
501
502
 
502
503
  qs = "key=" +CGI.escape(GrabzIt::Utility.nil_check(@applicationKey))+"&identifier="+CGI.escape(GrabzIt::Utility.nil_check(identifier))+"&sig="+sig
503
504
 
504
- return (get_result_value(get(WebServicesBaseURLGet + "deletewatermark.ashx?" + qs), "Result") == TrueString)
505
- end
505
+ return (get_result_value(get(@protocol + WebServicesBaseURLGet + "deletewatermark.ashx?" + qs), "Result") == TrueString)
506
+ end
507
+
508
+ # This method sets if requests to GrabzIt's API should use SSL or not
509
+ #
510
+ # @param value [Boolean] true if should use SSL
511
+ def use_ssl(value)
512
+ if value
513
+ @protocol = 'https'
514
+ else
515
+ @protocol = 'http'
516
+ end
517
+ end
506
518
 
507
519
  private
508
520
  def get_watermarks(identifier = nil)
@@ -510,7 +522,7 @@ module GrabzIt
510
522
 
511
523
  qs = "key=" +CGI.escape(GrabzIt::Utility.nil_check(@applicationKey))+"&identifier="+CGI.escape(GrabzIt::Utility.nil_check(identifier))+"&sig="+sig
512
524
 
513
- result = get(WebServicesBaseURLGet + "getwatermarks.ashx?" + qs)
525
+ result = get(@protocol + WebServicesBaseURLGet + "getwatermarks.ashx?" + qs)
514
526
 
515
527
  doc = REXML::Document.new(result)
516
528
 
@@ -530,16 +542,16 @@ module GrabzIt
530
542
  private
531
543
  def get(url)
532
544
  uri = URI.parse(url)
533
- response = Net::HTTP.start(uri.host, uri.port) { |http| http.get(uri.request_uri) }
545
+ response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') { |http| http.get(uri.request_uri) }
534
546
  response_check(response)
535
547
  return response.body
536
548
  end
537
549
 
538
550
  private
539
551
  def post(url, params)
540
- headers = {'Content-Type' => 'application/x-www-form-urlencoded'}
552
+ headers = {'Content-Type' => 'application/x-www-form-urlencoded'}
541
553
  uri = URI.parse(url)
542
- response = Net::HTTP.start(uri.host, uri.port) { |http| http.post(uri.request_uri, params, headers) }
554
+ response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') { |http| http.post(uri.request_uri, params, headers) }
543
555
  response_check(response)
544
556
  return response.body
545
557
  end
@@ -19,6 +19,7 @@ module GrabzIt
19
19
  @requestAs = 0
20
20
  @quality = -1
21
21
  @hideElement = nil
22
+ @waitForElement = nil
22
23
  end
23
24
 
24
25
  # @return [Boolean] true if the background images of the web page should be included in the DOCX
@@ -203,7 +204,20 @@ module GrabzIt
203
204
  # @return [void]
204
205
  def hideElement(value)
205
206
  @hideElement = value
206
- end
207
+ end
208
+
209
+ # @return [String] get the CSS selector of the HTML element in the web page that must be visible before the capture is performed
210
+ def waitForElement
211
+ @waitForElement
212
+ end
213
+
214
+ # Set the CSS selector of the HTML element in the web page that must be visible before the capture is performed
215
+ #
216
+ # @param value [String] the element to wait for
217
+ # @return [void]
218
+ def waitForElement(value)
219
+ @waitForElement = value
220
+ end
207
221
 
208
222
  # @!visibility private
209
223
  def _getSignatureString(applicationSecret, callBackURL, url = nil)
@@ -222,7 +236,7 @@ module GrabzIt
222
236
  GrabzIt::Utility.b_to_str(@includeImages)+"|"+GrabzIt::Utility.b_to_str(@includeLinks)+"|"+
223
237
  GrabzIt::Utility.nil_check(@title)+"|"+GrabzIt::Utility.nil_int_check(@marginTop)+"|"+GrabzIt::Utility.nil_int_check(@marginLeft)+
224
238
  "|"+GrabzIt::Utility.nil_int_check(@marginBottom)+"|"+GrabzIt::Utility.nil_int_check(@marginRight)+"|"+GrabzIt::Utility.nil_int_check(@delay)+"|"+
225
- GrabzIt::Utility.nil_int_check(@requestAs)+"|"+GrabzIt::Utility.nil_check(@country)+"|"+GrabzIt::Utility.nil_int_check(@quality)+"|"+GrabzIt::Utility.nil_check(@hideElement)
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)
226
240
  end
227
241
 
228
242
  # @!visibility private
@@ -242,6 +256,7 @@ module GrabzIt
242
256
  params['requestmobileversion'] = GrabzIt::Utility.nil_int_check(@requestAs)
243
257
  params['quality'] = GrabzIt::Utility.nil_int_check(@quality)
244
258
  params['hide'] = GrabzIt::Utility.nil_check(@hideElement)
259
+ params['waitfor'] = GrabzIt::Utility.nil_check(@waitForElement)
245
260
 
246
261
  return params;
247
262
  end
@@ -64,6 +64,8 @@ module GrabzIt
64
64
  PARAMETER_INVALID_TARGET_VALUE = 165
65
65
  PARAMETER_INVALID_HIDE_VALUE = 166
66
66
  PARAMETER_INVALID_INCLUDE_IMAGES = 167
67
+ PARAMETER_INVALID_EXPORT_URL = 168
68
+ PARAMETER_INVALID_WAIT_FOR_VALUE = 169
67
69
  NETWORK_SERVER_OFFLINE = 200
68
70
  NETWORK_GENERAL_ERROR = 201
69
71
  NETWORK_DDOS_ATTACK = 202
@@ -13,6 +13,7 @@ module GrabzIt
13
13
  @format = nil
14
14
  @targetElement = nil
15
15
  @hideElement = nil
16
+ @waitForElement = nil
16
17
  @requestAs = 0
17
18
  @customWaterMarkId = nil
18
19
  @quality = -1
@@ -122,6 +123,19 @@ module GrabzIt
122
123
  @hideElement = value
123
124
  end
124
125
 
126
+ # @return [String] get the CSS selector of the HTML element in the web page that must be visible before the capture is performed
127
+ def waitForElement
128
+ @waitForElement
129
+ end
130
+
131
+ # Set the CSS selector of the HTML element in the web page that must be visible before the capture is performed
132
+ #
133
+ # @param value [String] the element to wait for
134
+ # @return [void]
135
+ def waitForElement(value)
136
+ @waitForElement = value
137
+ end
138
+
125
139
  # @return [Integer] get which user agent type should be used
126
140
  def requestAs
127
141
  @requestAs
@@ -176,7 +190,7 @@ module GrabzIt
176
190
  return applicationSecret+"|"+ urlParam + callBackURLParam +
177
191
  "|"+GrabzIt::Utility.nil_check(@format)+"|"+GrabzIt::Utility.nil_int_check(@height)+"|"+GrabzIt::Utility.nil_int_check(@width)+"|"+GrabzIt::Utility.nil_int_check(@browserHeight)+
178
192
  "|"+GrabzIt::Utility.nil_int_check(@browserWidth)+"|"+GrabzIt::Utility.nil_check(@customId)+"|"+GrabzIt::Utility.nil_int_check(@delay)+"|"+GrabzIt::Utility.nil_check(@targetElement)+
179
- "|"+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)
193
+ "|"+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)
180
194
  end
181
195
 
182
196
  # @!visibility private
@@ -191,6 +205,7 @@ module GrabzIt
191
205
  params['delay'] = GrabzIt::Utility.nil_int_check(@delay)
192
206
  params['target'] = GrabzIt::Utility.nil_check(@targetElement)
193
207
  params['hide'] = GrabzIt::Utility.nil_check(@hideElement)
208
+ params['waitfor'] = GrabzIt::Utility.nil_check(@waitForElement)
194
209
  params['requestmobileversion'] = GrabzIt::Utility.nil_int_check(@requestAs)
195
210
  params['quality'] = GrabzIt::Utility.nil_int_check(@quality)
196
211
 
@@ -21,7 +21,9 @@ module GrabzIt
21
21
  @templateId = nil
22
22
  @customWaterMarkId = nil
23
23
  @quality = -1
24
+ @targetElement = nil
24
25
  @hideElement = nil
26
+ @waitForElement = nil
25
27
  end
26
28
 
27
29
  # @return [Boolean] true if the background of the web page should be included in the PDF
@@ -234,6 +236,19 @@ module GrabzIt
234
236
  @quality = value
235
237
  end
236
238
 
239
+ # @return [String] get the CSS selector of the only HTML element in the web page to capture
240
+ def targetElement
241
+ @targetElement
242
+ end
243
+
244
+ # Set the CSS selector of the only HTML element in the web page to capture
245
+ #
246
+ # @param value [String] the target element
247
+ # @return [void]
248
+ def targetElement(value)
249
+ @targetElement = value
250
+ end
251
+
237
252
  # @return [String] get the CSS selector(s) of the one or more HTML elements in the web page to hide
238
253
  def hideElement
239
254
  @hideElement
@@ -245,6 +260,19 @@ module GrabzIt
245
260
  # @return [void]
246
261
  def hideElement(value)
247
262
  @hideElement = value
263
+ end
264
+
265
+ # @return [String] get the CSS selector of the HTML element in the web page that must be visible before the capture is performed
266
+ def waitForElement
267
+ @waitForElement
268
+ end
269
+
270
+ # Set the CSS selector of the HTML element in the web page that must be visible before the capture is performed
271
+ #
272
+ # @param value [String] the element to wait for
273
+ # @return [void]
274
+ def waitForElement(value)
275
+ @waitForElement = value
248
276
  end
249
277
 
250
278
  # @!visibility private
@@ -264,7 +292,7 @@ module GrabzIt
264
292
  GrabzIt::Utility.nil_check(@customWaterMarkId)+"|"+GrabzIt::Utility.b_to_str(@includeLinks)+"|"+GrabzIt::Utility.b_to_str(@includeOutline)+"|"+
265
293
  GrabzIt::Utility.nil_check(@title)+"|"+GrabzIt::Utility.nil_check(@coverURL)+"|"+GrabzIt::Utility.nil_int_check(@marginTop)+"|"+GrabzIt::Utility.nil_int_check(@marginLeft)+
266
294
  "|"+GrabzIt::Utility.nil_int_check(@marginBottom)+"|"+GrabzIt::Utility.nil_int_check(@marginRight)+"|"+GrabzIt::Utility.nil_int_check(@delay)+"|"+
267
- 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)
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)
268
296
  end
269
297
 
270
298
  # @!visibility private
@@ -286,7 +314,9 @@ module GrabzIt
286
314
  params['delay'] = GrabzIt::Utility.nil_int_check(@delay)
287
315
  params['requestmobileversion'] = GrabzIt::Utility.nil_int_check(@requestAs)
288
316
  params['quality'] = GrabzIt::Utility.nil_int_check(@quality)
317
+ params['target'] = GrabzIt::Utility.nil_check(@targetElement)
289
318
  params['hide'] = GrabzIt::Utility.nil_check(@hideElement)
319
+ params['waitfor'] = GrabzIt::Utility.nil_check(@waitForElement)
290
320
 
291
321
  return params;
292
322
  end
@@ -107,7 +107,7 @@ module GrabzIt
107
107
  return applicationSecret+"|"+ urlParam + callBackURLParam +
108
108
  "|"+GrabzIt::Utility.nil_check(@customId)+"|"+GrabzIt::Utility.nil_int_check(@tableNumberToInclude)+"|"+GrabzIt::Utility.b_to_str(@includeAllTables)+
109
109
  "|"+GrabzIt::Utility.b_to_str(@includeHeaderNames)+"|"+GrabzIt::Utility.nil_check(@targetElement)+"|"+GrabzIt::Utility.nil_check(@format)+"|"+
110
- GrabzIt::Utility.nil_int_check(@requestAs)+"|"+GrabzIt::Utility.nil_check(@country)
110
+ GrabzIt::Utility.nil_int_check(@requestAs)+"|"+GrabzIt::Utility.nil_check(@country)+"|"+GrabzIt::Utility.nil_check(@exportURL)
111
111
  end
112
112
 
113
113
  # @!visibility private
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.1.1
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GrabzIt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-11 00:00:00.000000000 Z
11
+ date: 2017-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -71,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  version: '0'
72
72
  requirements: []
73
73
  rubyforge_project:
74
- rubygems_version: 2.6.7
74
+ rubygems_version: 2.6.12
75
75
  signing_key:
76
76
  specification_version: 4
77
77
  summary: GrabzIt Ruby Client