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
# 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
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



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

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



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

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



354
355
356
# File 'lib/grabzit/docxoptions.rb', line 354

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



362
363
364
# File 'lib/grabzit/docxoptions.rb', line 362

def address=(value)
	@address = value
end

#browserWidthInteger

Returns the width of the browser in pixels.

Returns:

  • (Integer)

    the width of the browser in pixels



171
172
173
# File 'lib/grabzit/docxoptions.rb', line 171

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



179
180
181
# File 'lib/grabzit/docxoptions.rb', line 179

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



301
302
303
# File 'lib/grabzit/docxoptions.rb', line 301

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



309
310
311
# File 'lib/grabzit/docxoptions.rb', line 309

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



210
211
212
# File 'lib/grabzit/docxoptions.rb', line 210

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



218
219
220
# File 'lib/grabzit/docxoptions.rb', line 218

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



275
276
277
# File 'lib/grabzit/docxoptions.rb', line 275

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



283
284
285
# File 'lib/grabzit/docxoptions.rb', line 283

def hideElement=(value)
	@hideElement = 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



39
40
41
# File 'lib/grabzit/docxoptions.rb', line 39

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



47
48
49
# File 'lib/grabzit/docxoptions.rb', line 47

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



93
94
95
# File 'lib/grabzit/docxoptions.rb', line 93

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



101
102
103
# File 'lib/grabzit/docxoptions.rb', line 101

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



80
81
82
# File 'lib/grabzit/docxoptions.rb', line 80

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



88
89
90
# File 'lib/grabzit/docxoptions.rb', line 88

def includeLinks=(value)
	@includeLinks = 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



145
146
147
# File 'lib/grabzit/docxoptions.rb', line 145

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



153
154
155
# File 'lib/grabzit/docxoptions.rb', line 153

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



132
133
134
# File 'lib/grabzit/docxoptions.rb', line 132

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



140
141
142
# File 'lib/grabzit/docxoptions.rb', line 140

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



158
159
160
# File 'lib/grabzit/docxoptions.rb', line 158

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



166
167
168
# File 'lib/grabzit/docxoptions.rb', line 166

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



119
120
121
# File 'lib/grabzit/docxoptions.rb', line 119

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



127
128
129
# File 'lib/grabzit/docxoptions.rb', line 127

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



314
315
316
# File 'lib/grabzit/docxoptions.rb', line 314

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



322
323
324
# File 'lib/grabzit/docxoptions.rb', line 322

def mergeId=(value)
	@mergeId = value
end

#noAdsBoolean

Returns get if adverts should be automatically hidden.

Returns:

  • (Boolean)

    get if adverts should be automatically hidden



327
328
329
# File 'lib/grabzit/docxoptions.rb', line 327

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



335
336
337
# File 'lib/grabzit/docxoptions.rb', line 335

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



341
342
343
# File 'lib/grabzit/docxoptions.rb', line 341

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



349
350
351
# File 'lib/grabzit/docxoptions.rb', line 349

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



66
67
68
# File 'lib/grabzit/docxoptions.rb', line 66

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



74
75
76
77
# File 'lib/grabzit/docxoptions.rb', line 74

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



197
198
199
# File 'lib/grabzit/docxoptions.rb', line 197

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



205
206
207
# File 'lib/grabzit/docxoptions.rb', line 205

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



52
53
54
# File 'lib/grabzit/docxoptions.rb', line 52

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



60
61
62
63
# File 'lib/grabzit/docxoptions.rb', line 60

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.



184
185
186
# File 'lib/grabzit/docxoptions.rb', line 184

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



192
193
194
# File 'lib/grabzit/docxoptions.rb', line 192

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



367
368
369
# File 'lib/grabzit/docxoptions.rb', line 367

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



375
376
377
# File 'lib/grabzit/docxoptions.rb', line 375

def password=(value)
	@password = value
end

#qualityInteger

Returns the quality of the DOCX.

Returns:

  • (Integer)

    the quality of the DOCX.



249
250
251
# File 'lib/grabzit/docxoptions.rb', line 249

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



257
258
259
# File 'lib/grabzit/docxoptions.rb', line 257

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



223
224
225
# File 'lib/grabzit/docxoptions.rb', line 223

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



231
232
233
# File 'lib/grabzit/docxoptions.rb', line 231

def requestAs=(value)
	@requestAs = 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



262
263
264
# File 'lib/grabzit/docxoptions.rb', line 262

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



270
271
272
# File 'lib/grabzit/docxoptions.rb', line 270

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



236
237
238
# File 'lib/grabzit/docxoptions.rb', line 236

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



244
245
246
# File 'lib/grabzit/docxoptions.rb', line 244

def templateId=(value)
	@templateId = value
end

#titleString

Returns a title for the DOCX document.

Returns:

  • (String)

    a title for the DOCX document



106
107
108
# File 'lib/grabzit/docxoptions.rb', line 106

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



114
115
116
# File 'lib/grabzit/docxoptions.rb', line 114

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



288
289
290
# File 'lib/grabzit/docxoptions.rb', line 288

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



296
297
298
# File 'lib/grabzit/docxoptions.rb', line 296

def waitForElement=(value)
	@waitForElement = value
end