grabzit 3.2.4 → 3.2.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 688be2a43a18a59368cb1948f201417c7fb3a0b8
4
- data.tar.gz: d2a3bd6899fc169e1c373a429147063a560f7222
3
+ metadata.gz: 5b97db3e94be5fa244c215fc27499a93b843ae56
4
+ data.tar.gz: 57f776fddaab20da5dfc77be83483716600808ac
5
5
  SHA512:
6
- metadata.gz: d9cdc15cdc5db59a2268e32c8db072ffc1308284a0760542d88c61b9b91d5679f411511959242363e6322002168199e494850febd704da44308b638b6a702ae1
7
- data.tar.gz: 8a565a0f19d8f2feef8ae97b7dea683415517f628708f3dd11113c4f987dab8f8e36d87d47319ca44137f6b53d1bb83425118e7de6719705dc95cb661d0bc7d2
6
+ metadata.gz: 2dff82812656f1225cef45faf21c67cb45ed9f552c2b3b0123b06bc9442bc7bbbc1213b2e460ba18430baee3baf35dfeea82bb65c69ad267e3624a59c0db26e6
7
+ data.tar.gz: f127bd2d14687c79099a16f08a7423bf0f653debd2ae2781bb19e7851764f95c4079623268eb85ea4891d72062ce9c9e994c52e4416d55a5d670e55229da7d5f
@@ -20,7 +20,7 @@ module GrabzIt
20
20
  # Set a custom identifier to pass to the web service. This will be returned with the callback URL you have specified.
21
21
  #
22
22
  # @param value [String] the custom identifier
23
- # @return [void]
23
+ # @return [void]
24
24
  def customId(value)
25
25
  @customId = value
26
26
  end
@@ -73,7 +73,7 @@ module GrabzIt
73
73
  end
74
74
 
75
75
  protected
76
- def appendPostParameter(name, value)
76
+ def appendParameter(qs, name, value)
77
77
  val = ""
78
78
  if name != nil && name != ""
79
79
  val = CGI.escape(name)
@@ -84,15 +84,16 @@ module GrabzIt
84
84
  end
85
85
 
86
86
  if val == ""
87
- return
87
+ return qs
88
88
  end
89
- if @post == nil
90
- @post = val
91
- return
89
+ if qs == nil
90
+ qs = val
91
+ return qs
92
92
  end
93
93
 
94
- @post += "&"
95
- @post += val
94
+ qs += "&"
95
+ qs += val
96
+ return qs
96
97
  end
97
98
 
98
99
  protected
@@ -239,7 +239,7 @@ module GrabzIt
239
239
  # @param name [String] the name of the HTTP Post parameter
240
240
  # @param value [String] the value of the HTTP Post parameter
241
241
  def add_post_parameter(name, value)
242
- appendPostParameter(name, value)
242
+ @post = appendParameter(@post, name, value)
243
243
  end
244
244
 
245
245
  # @!visibility private
@@ -209,7 +209,7 @@ module GrabzIt
209
209
  # @param name [String] the name of the HTTP Post parameter
210
210
  # @param value [String] the value of the HTTP Post parameter
211
211
  def add_post_parameter(name, value)
212
- appendPostParameter(name, value)
212
+ @post = appendParameter(@post, name, value)
213
213
  end
214
214
 
215
215
  # @!visibility private
@@ -26,6 +26,9 @@ module GrabzIt
26
26
  @waitForElement = nil
27
27
  @noAds = false
28
28
  @browserWidth = nil
29
+ @templateVariables = nil
30
+ @width = nil
31
+ @height = nil
29
32
  end
30
33
 
31
34
  # @return [Boolean] true if the background of the web page should be included in the PDF
@@ -186,6 +189,31 @@ module GrabzIt
186
189
  @browserWidth = value
187
190
  end
188
191
 
192
+ # @return [Integer] get the page width of the resulting PDF in mm.
193
+ def pageWidth
194
+ @width
195
+ end
196
+
197
+ # Set the page width of the resulting PDF in mm
198
+ #
199
+ # @param value [Integer] the width
200
+ # @return [void]
201
+ def pageWidth(value)
202
+ @width = value
203
+ end
204
+
205
+ # @return [Integer] get the page height of the resulting PDF in mm
206
+ def pageHeight
207
+ @height
208
+ end
209
+
210
+ # Set the page height of the resulting PDF in mm
211
+ #
212
+ # @param value [Integer] the height
213
+ # @return [void]
214
+ def pageHeight(value)
215
+ @height = value
216
+ end
189
217
 
190
218
  # @return [Integer] the number of milliseconds to wait before creating the capture
191
219
  def delay
@@ -310,8 +338,16 @@ module GrabzIt
310
338
  # @param name [String] the name of the HTTP Post parameter
311
339
  # @param value [String] the value of the HTTP Post parameter
312
340
  def add_post_parameter(name, value)
313
- appendPostParameter(name, value)
314
- end
341
+ @post = appendParameter(@post, name, value)
342
+ end
343
+
344
+ # Define a custom PDF Template parameter and value, this method can be called multiple times to add multiple parameters.
345
+ #
346
+ # @param name [String] the name of the PDF template parameter
347
+ # @param value [String] the value of the PDF template parameter
348
+ def add_template_parameter(name, value)
349
+ @templateVariables = appendParameter(@templateVariables, name, value)
350
+ end
315
351
 
316
352
  # @!visibility private
317
353
  def _getSignatureString(applicationSecret, callBackURL, url = nil)
@@ -330,7 +366,11 @@ module GrabzIt
330
366
  GrabzIt::Utility.nil_check(@customWaterMarkId)+"|"+GrabzIt::Utility.b_to_str(@includeLinks)+"|"+GrabzIt::Utility.b_to_str(@includeOutline)+"|"+
331
367
  GrabzIt::Utility.nil_check(@title)+"|"+GrabzIt::Utility.nil_check(@coverURL)+"|"+GrabzIt::Utility.nil_int_check(@marginTop)+"|"+GrabzIt::Utility.nil_int_check(@marginLeft)+
332
368
  "|"+GrabzIt::Utility.nil_int_check(@marginBottom)+"|"+GrabzIt::Utility.nil_int_check(@marginRight)+"|"+GrabzIt::Utility.nil_int_check(@delay)+"|"+
333
- 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)
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)
334
374
  end
335
375
 
336
376
  # @!visibility private
@@ -358,6 +398,9 @@ module GrabzIt
358
398
  params['noads'] = GrabzIt::Utility.b_to_str(@noAds)
359
399
  params['post'] = GrabzIt::Utility.nil_check(@post)
360
400
  params['bwidth'] = GrabzIt::Utility.nil_int_check(@browserWidth)
401
+ params['width'] = GrabzIt::Utility.nil_int_check(@width)
402
+ params['height'] = GrabzIt::Utility.nil_int_check(@height)
403
+ params['tvars'] = GrabzIt::Utility.nil_check(@templateVariables)
361
404
 
362
405
  return params;
363
406
  end
@@ -98,7 +98,7 @@ module GrabzIt
98
98
  # @param name [String] the name of the HTTP Post parameter
99
99
  # @param value [String] the value of the HTTP Post parameter
100
100
  def add_post_parameter(name, value)
101
- appendPostParameter(name, value)
101
+ @post = appendParameter(@post, name, value)
102
102
  end
103
103
 
104
104
  # @!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.2.4
4
+ version: 3.2.5
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-25 00:00:00.000000000 Z
11
+ date: 2017-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake