Class: GrabzIt::DOCXOptions

Inherits:
BaseOptions show all
Defined in:
lib/grabzit/docxoptions.rb

Overview

Represents all of the options available when creating a DOCX

Author:

  • GrabzIt

Version:

  • 3.1

Instance Method Summary collapse

Methods inherited from BaseOptions

#country, #country=, #customId, #customId=, #encryptionKey, #encryptionKey=, #exportURL, #exportURL=, #proxy, #proxy=

Constructor Details

#initializeDOCXOptions

Returns a new instance of DOCXOptions.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/grabzit/docxoptions.rb', line 8

def initialize()
	super()
	@includeBackground = true
	@pagesize = 'A4'
	@orientation = 'Portrait'
	@includeLinks = true
	@includeImages = true
	@title = nil
	@marginTop = 10
	@marginLeft = 10
	@marginBottom = 10
	@marginRight = 10
	@requestAs = 0
	@quality = -1
	@hideElement = nil
	@waitForElement = nil
	@noAds = false
	@browserWidth = nil
	@templateVariables = nil
	@width = nil
	@height = nil
	@templateId = nil
	@targetElement = nil
	@mergeId = nil
	@noCookieNotifications = false
	@address = nil
	@password = nil
	@clickElement = nil
	@jsCode = nil
	@scrollElement = nil
	@hoverElement = nil
end

Instance Method Details

#add_post_parameter(name, value) ⇒ Object

Define a HTTP Post parameter and optionally value, this method can be called multiple times to add multiple parameters. Using this method will force GrabzIt to perform a HTTP post.

Parameters:

  • name (String)

    the name of the HTTP Post parameter

  • value (String)

    the value of the HTTP Post parameter



413
414
415
# File 'lib/grabzit/docxoptions.rb', line 413

def add_post_parameter(name, value)
	@post = appendParameter(@post, name, value)
end

#add_template_parameter(name, value) ⇒ Object

Define a custom template parameter and value, this method can be called multiple times to add multiple parameters.

Parameters:

  • name (String)

    the name of the template parameter

  • value (String)

    the value of the template parameter



421
422
423
# File 'lib/grabzit/docxoptions.rb', line 421

def add_template_parameter(name, value)
	@templateVariables = appendParameter(@templateVariables, name, value)
end

#addressString

Returns get the URL to execute the HTML code in.

Returns:

  • (String)

    get the URL to execute the HTML code in



383
384
385
# File 'lib/grabzit/docxoptions.rb', line 383

def address
	@address
end

#address=(value) ⇒ void

This method returns an undefined value.

Set the URL to execute the HTML code in

Parameters:

  • value (String)

    the address



391
392
393
# File 'lib/grabzit/docxoptions.rb', line 391

def address=(value)
	@address = value
end

#browserWidthInteger

Returns the width of the browser in pixels.

Returns:

  • (Integer)

    the width of the browser in pixels



174
175
176
# File 'lib/grabzit/docxoptions.rb', line 174

def browserWidth
	@browserWidth
end

#browserWidth=(value) ⇒ void

This method returns an undefined value.

Set the width of the browser in pixels

Parameters:

  • value (Integer)

    the browser width



182
183
184
# File 'lib/grabzit/docxoptions.rb', line 182

def browserWidth=(value)
	@browserWidth = value
end

#clickElementString

Returns get the CSS selector of the HTML element in the web page that must clicked before the capture is performed.

Returns:

  • (String)

    get the CSS selector of the HTML element in the web page that must clicked before the capture is performed



304
305
306
# File 'lib/grabzit/docxoptions.rb', line 304

def clickElement
	@clickElement
end

#clickElement=(value) ⇒ void

This method returns an undefined value.

Set the CSS selector of the HTML element in the web page that must clicked before the capture is performed

Parameters:

  • value (String)

    the element to click



312
313
314
# File 'lib/grabzit/docxoptions.rb', line 312

def clickElement=(value)
	@clickElement = value
end

#delayInteger

Returns the number of milliseconds to wait before creating the capture.

Returns:

  • (Integer)

    the number of milliseconds to wait before creating the capture



213
214
215
# File 'lib/grabzit/docxoptions.rb', line 213

def delay
	@delay
end

#delay=(value) ⇒ void

This method returns an undefined value.

Set the number of milliseconds to wait before creating the capture

Parameters:

  • value (Integer)

    delay



221
222
223
# File 'lib/grabzit/docxoptions.rb', line 221

def delay=(value)
	@delay = value
end

#hideElementString

Returns get the CSS selector(s) of the one or more HTML elements in the web page to hide.

Returns:

  • (String)

    get the CSS selector(s) of the one or more HTML elements in the web page to hide



278
279
280
# File 'lib/grabzit/docxoptions.rb', line 278

def hideElement
	@hideElement
end

#hideElement=(value) ⇒ void

This method returns an undefined value.

Set the CSS selector(s) of the one or more HTML elements in the web page to hide

Parameters:

  • value (String)

    the element(s) to hide



286
287
288
# File 'lib/grabzit/docxoptions.rb', line 286

def hideElement=(value)
	@hideElement = value
end

#hoverElementString

Returns get the CSS selector of the HTML element in the web page that must hovered over before the capture is performed.

Returns:

  • (String)

    get the CSS selector of the HTML element in the web page that must hovered over before the capture is performed



330
331
332
# File 'lib/grabzit/docxoptions.rb', line 330

def hoverElement
	@hoverElement
end

#hoverElement=(value) ⇒ void

This method returns an undefined value.

Set the CSS selector of the HTML element in the web page that must hovered over before the capture is performed

Parameters:

  • value (String)

    the element to hover over



338
339
340
# File 'lib/grabzit/docxoptions.rb', line 338

def hoverElement=(value)
	@hoverElement = value
end

#includeBackgroundBoolean

Returns true if the background images of the web page should be included in the DOCX.

Returns:

  • (Boolean)

    true if the background images of the web page should be included in the DOCX



42
43
44
# File 'lib/grabzit/docxoptions.rb', line 42

def includeBackground
	@includeBackground
end

#includeBackground=(value) ⇒ void

This method returns an undefined value.

Set to true if the background images of the web page should be included in the DOCX

Parameters:

  • value (Boolean)

    include background images



50
51
52
# File 'lib/grabzit/docxoptions.rb', line 50

def includeBackground=(value)
	@includeBackground = value
end

#includeImagesBoolean

Returns true if web page images should be included.

Returns:

  • (Boolean)

    true if web page images should be included



96
97
98
# File 'lib/grabzit/docxoptions.rb', line 96

def includeImages
	@includeImages
end

#includeImages=(value) ⇒ void

This method returns an undefined value.

Set to true if web page images should be included

Parameters:

  • value (Boolean)

    include images



104
105
106
# File 'lib/grabzit/docxoptions.rb', line 104

def includeImages=(value)
	@includeImages = value
end

Returns true if the links should be included in the DOCX.

Returns:

  • (Boolean)

    true if the links should be included in the DOCX



83
84
85
# File 'lib/grabzit/docxoptions.rb', line 83

def includeLinks
	@includeLinks
end

#includeLinks=(value) ⇒ void

This method returns an undefined value.

Set to true if links should be included in the DOCX

Parameters:

  • value (Boolean)

    include links



91
92
93
# File 'lib/grabzit/docxoptions.rb', line 91

def includeLinks=(value)
	@includeLinks = value
end

#jsCodeString

Returns get the JavaScript code that will be execute in the web page before the capture is performed.

Returns:

  • (String)

    get the JavaScript code that will be execute in the web page before the capture is performed



426
427
428
# File 'lib/grabzit/docxoptions.rb', line 426

def jsCode
	@jsCode
end

#jsCode=(value) ⇒ void

This method returns an undefined value.

Set the JavaScript code that will be execute in the web page before the capture is performed

Parameters:

  • value (String)

    the javascript to execute



434
435
436
# File 'lib/grabzit/docxoptions.rb', line 434

def jsCode=(value)
	@jsCode = value
end

#marginBottomInteger

Returns the margin that should appear at the bottom of the DOCX document page.

Returns:

  • (Integer)

    the margin that should appear at the bottom of the DOCX document page



148
149
150
# File 'lib/grabzit/docxoptions.rb', line 148

def marginBottom
	@marginBottom
end

#marginBottom=(value) ⇒ void

This method returns an undefined value.

Set the margin that should appear at the bottom of the DOCX document page

Parameters:

  • value (Integer)

    margin bottom



156
157
158
# File 'lib/grabzit/docxoptions.rb', line 156

def marginBottom=(value)
	@marginBottom = value
end

#marginLeftInteger

Returns the margin that should appear at the left of the DOCX document page.

Returns:

  • (Integer)

    the margin that should appear at the left of the DOCX document page



135
136
137
# File 'lib/grabzit/docxoptions.rb', line 135

def marginLeft
	@marginLeft
end

#marginLeft=(value) ⇒ void

This method returns an undefined value.

Set the margin that should appear at the left of the DOCX document page

Parameters:

  • value (Integer)

    margin left



143
144
145
# File 'lib/grabzit/docxoptions.rb', line 143

def marginLeft=(value)
	@marginLeft = value
end

#marginRightInteger

Returns the margin that should appear at the right of the DOCX document.

Returns:

  • (Integer)

    the margin that should appear at the right of the DOCX document



161
162
163
# File 'lib/grabzit/docxoptions.rb', line 161

def marginRight
	@marginRight
end

#marginRight=(value) ⇒ void

This method returns an undefined value.

Set the margin that should appear at the right of the DOCX document

Parameters:

  • value (Integer)

    margin right



169
170
171
# File 'lib/grabzit/docxoptions.rb', line 169

def marginRight=(value)
	@marginRight = value
end

#marginTopInteger

Returns the margin that should appear at the top of the DOCX document page.

Returns:

  • (Integer)

    the margin that should appear at the top of the DOCX document page



122
123
124
# File 'lib/grabzit/docxoptions.rb', line 122

def marginTop
	@marginTop
end

#marginTop=(value) ⇒ void

This method returns an undefined value.

Set the margin that should appear at the top of the DOCX document page

Parameters:

  • value (Integer)

    margin top



130
131
132
# File 'lib/grabzit/docxoptions.rb', line 130

def marginTop=(value)
	@marginTop = value
end

#mergeIdString

Returns get the ID of a capture that should be merged at the beginning of the new DOCX document.

Returns:

  • (String)

    get the ID of a capture that should be merged at the beginning of the new DOCX document



343
344
345
# File 'lib/grabzit/docxoptions.rb', line 343

def mergeId
	@mergeId
end

#mergeId=(value) ⇒ void

This method returns an undefined value.

Set the ID of a capture that should be merged at the beginning of the new DOCX document

Parameters:

  • value (String)

    the merge ID



351
352
353
# File 'lib/grabzit/docxoptions.rb', line 351

def mergeId=(value)
	@mergeId = value
end

#noAdsBoolean

Returns get if adverts should be automatically hidden.

Returns:

  • (Boolean)

    get if adverts should be automatically hidden



356
357
358
# File 'lib/grabzit/docxoptions.rb', line 356

def noAds
	@noAds
end

#noAds=(value) ⇒ void

This method returns an undefined value.

Set to true if adverts should be automatically hidden

Parameters:

  • value (Boolean)

    hide adverts



364
365
366
# File 'lib/grabzit/docxoptions.rb', line 364

def noAds=(value)
	@noAds = value
end

#noCookieNotificationsBoolean

Returns get if cookie notifications should be automatically hidden.

Returns:

  • (Boolean)

    get if cookie notifications should be automatically hidden



370
371
372
# File 'lib/grabzit/docxoptions.rb', line 370

def noCookieNotifications
	@noCookieNotifications
end

#noCookieNotifications=(value) ⇒ void

This method returns an undefined value.

Set to true if cookie notifications should be automatically hidden

Parameters:

  • value (Boolean)

    hide cookie notifications



378
379
380
# File 'lib/grabzit/docxoptions.rb', line 378

def noCookieNotifications=(value)
	@noCookieNotifications = value
end

#orientationString

Returns the orientation of the DOCX to be returned.

Returns:

  • (String)

    the orientation of the DOCX to be returned



69
70
71
# File 'lib/grabzit/docxoptions.rb', line 69

def orientation
	@orientation
end

#orientation=(value) ⇒ void

This method returns an undefined value.

Set the orientation of the DOCX to be returned: ‘Landscape’ or ‘Portrait’

Parameters:

  • value (String)

    page orientation



77
78
79
80
# File 'lib/grabzit/docxoptions.rb', line 77

def orientation=(value)
	value = GrabzIt::Utility.nil_check(value).capitalize
	@orientation = value
end

#pageHeightInteger

Returns get the page height of the resulting DOCX in mm.

Returns:

  • (Integer)

    get the page height of the resulting DOCX in mm



200
201
202
# File 'lib/grabzit/docxoptions.rb', line 200

def pageHeight
	@height
end

#pageHeight=(value) ⇒ void

This method returns an undefined value.

Set the page height of the resulting DOCX in mm

Parameters:

  • value (Integer)

    the height



208
209
210
# File 'lib/grabzit/docxoptions.rb', line 208

def pageHeight=(value)
	@height = value
end

#pagesizeString

Returns the page size of the DOCX to be returned.

Returns:

  • (String)

    the page size of the DOCX to be returned



55
56
57
# File 'lib/grabzit/docxoptions.rb', line 55

def pagesize
	@pagesize
end

#pagesize=(value) ⇒ void

This method returns an undefined value.

Set the page size of the DOCX to be returned: ‘A3’, ‘A4’, ‘A5’, ‘A6’, ‘B3’, ‘B4’, ‘B5’, ‘B6’, ‘Letter’

Parameters:

  • value (String)

    page size



63
64
65
66
# File 'lib/grabzit/docxoptions.rb', line 63

def pagesize=(value)
	value = GrabzIt::Utility.nil_check(value).upcase
	@pagesize = value
end

#pageWidthInteger

Returns get the page width of the resulting DOCX in mm.

Returns:

  • (Integer)

    get the page width of the resulting DOCX in mm.



187
188
189
# File 'lib/grabzit/docxoptions.rb', line 187

def pageWidth
	@width
end

#pageWidth=(value) ⇒ void

This method returns an undefined value.

Set the page width of the resulting DOCX in mm

Parameters:

  • value (Integer)

    the width



195
196
197
# File 'lib/grabzit/docxoptions.rb', line 195

def pageWidth=(value)
	@width = value
end

#passwordString

Returns get the password that protects the DOCX document.

Returns:

  • (String)

    get the password that protects the DOCX document



396
397
398
# File 'lib/grabzit/docxoptions.rb', line 396

def password
	@password
end

#password=(value) ⇒ void

This method returns an undefined value.

Set the password that protects the DOCX document

Parameters:

  • value (String)

    the password



404
405
406
# File 'lib/grabzit/docxoptions.rb', line 404

def password=(value)
	@password = value
end

#qualityInteger

Returns the quality of the DOCX.

Returns:

  • (Integer)

    the quality of the DOCX.



252
253
254
# File 'lib/grabzit/docxoptions.rb', line 252

def quality
	@quality
end

#quality=(value) ⇒ void

This method returns an undefined value.

Set the quality of the DOCX where 0 is poor and 100 excellent. The default is -1 which uses the recommended quality

Parameters:

  • value (Integer)

    quality



260
261
262
# File 'lib/grabzit/docxoptions.rb', line 260

def quality=(value)
	@quality = value
end

#requestAsInteger

Returns get which user agent type should be used.

Returns:

  • (Integer)

    get which user agent type should be used



226
227
228
# File 'lib/grabzit/docxoptions.rb', line 226

def requestAs
	@requestAs
end

#requestAs=(value) ⇒ void

This method returns an undefined value.

Set which user agent type should be used: Standard Browser = 0, Mobile Browser = 1, Search Engine = 2 and Fallback Browser = 3

Parameters:

  • value (Integer)

    the browser type



234
235
236
# File 'lib/grabzit/docxoptions.rb', line 234

def requestAs=(value)
	@requestAs = value
end

#scrollElementString

Returns get the CSS selector of the HTML element in the web page that must scroll to before the capture is performed.

Returns:

  • (String)

    get the CSS selector of the HTML element in the web page that must scroll to before the capture is performed



317
318
319
# File 'lib/grabzit/docxoptions.rb', line 317

def scrollElement
	@scrollElement
end

#scrollElement=(value) ⇒ void

This method returns an undefined value.

Set the CSS selector of the HTML element in the web page that must scroll to before the capture is performed

Parameters:

  • value (String)

    the element to scroll to



325
326
327
# File 'lib/grabzit/docxoptions.rb', line 325

def scrollElement=(value)
	@scrollElement = value
end

#targetElementString

Returns get the CSS selector of the only HTML element in the web page to capture.

Returns:

  • (String)

    get the CSS selector of the only HTML element in the web page to capture



265
266
267
# File 'lib/grabzit/docxoptions.rb', line 265

def targetElement
	@targetElement
end

#targetElement=(value) ⇒ void

This method returns an undefined value.

Set the CSS selector of the only HTML element in the web page to capture

Parameters:

  • value (String)

    the target element



273
274
275
# File 'lib/grabzit/docxoptions.rb', line 273

def targetElement=(value)
	@targetElement = value
end

#templateIdString

Returns the template ID that specifies the header and footer of the DOCX document.

Returns:

  • (String)

    the template ID that specifies the header and footer of the DOCX document



239
240
241
# File 'lib/grabzit/docxoptions.rb', line 239

def templateId
	@templateId
end

#templateId=(value) ⇒ void

This method returns an undefined value.

Set a template ID that specifies the header and footer of the DOCX document

Parameters:

  • value (String)

    template id



247
248
249
# File 'lib/grabzit/docxoptions.rb', line 247

def templateId=(value)
	@templateId = value
end

#titleString

Returns a title for the DOCX document.

Returns:

  • (String)

    a title for the DOCX document



109
110
111
# File 'lib/grabzit/docxoptions.rb', line 109

def title
	@title
end

#title=(value) ⇒ void

This method returns an undefined value.

Set a title for the DOCX document

Parameters:

  • value (String)

    DOCX title



117
118
119
# File 'lib/grabzit/docxoptions.rb', line 117

def title=(value)
	@title = value
end

#waitForElementString

Returns get the CSS selector of the HTML element in the web page that must be visible before the capture is performed.

Returns:

  • (String)

    get the CSS selector of the HTML element in the web page that must be visible before the capture is performed



291
292
293
# File 'lib/grabzit/docxoptions.rb', line 291

def waitForElement
	@waitForElement
end

#waitForElement=(value) ⇒ void

This method returns an undefined value.

Set the CSS selector of the HTML element in the web page that must be visible before the capture is performed

Parameters:

  • value (String)

    the element to wait for



299
300
301
# File 'lib/grabzit/docxoptions.rb', line 299

def waitForElement=(value)
	@waitForElement = value
end