Class: GrabzIt::ImageOptions

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

Overview

Represents all of the options available when creating an image

Author:

  • GrabzIt

Version:

  • 3.0

Instance Method Summary collapse

Methods inherited from BaseOptions

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

Constructor Details

#initializeImageOptions

Returns a new instance of ImageOptions.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/grabzit/imageoptions.rb', line 8

def initialize()
	super()
	@browserWidth = nil
	@browserHeight = nil
	@width = nil
	@height = nil
	@format = nil
	@targetElement = nil
	@hideElement = nil
	@waitForElement = nil
	@requestAs = 0
	@customWaterMarkId = nil
	@quality = -1
	@transparent = false
	@noAds = false
	@noCookieNotifications = false
	@address = nil
	@hd = false
	@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



268
269
270
# File 'lib/grabzit/imageoptions.rb', line 268

def add_post_parameter(name, value)
	@post = appendParameter(@post, 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



251
252
253
# File 'lib/grabzit/imageoptions.rb', line 251

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



259
260
261
# File 'lib/grabzit/imageoptions.rb', line 259

def address=(value)
	@address = value
end

#browserHeightInteger

Returns the height of the browser in pixels.

Returns:

  • (Integer)

    the height of the browser in pixels



43
44
45
# File 'lib/grabzit/imageoptions.rb', line 43

def browserHeight
	@browserHeight
end

#browserHeight=(value) ⇒ void

This method returns an undefined value.

Set the height of the browser in pixels. Use -1 to screenshot the whole web page

Parameters:

  • value (Integer)

    the browser height



51
52
53
# File 'lib/grabzit/imageoptions.rb', line 51

def browserHeight=(value)
	@browserHeight = value
end

#browserWidthInteger

Returns the width of the browser in pixels.

Returns:

  • (Integer)

    the width of the browser in pixels



30
31
32
# File 'lib/grabzit/imageoptions.rb', line 30

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



38
39
40
# File 'lib/grabzit/imageoptions.rb', line 38

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



147
148
149
# File 'lib/grabzit/imageoptions.rb', line 147

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



155
156
157
# File 'lib/grabzit/imageoptions.rb', line 155

def clickElement=(value)
	@clickElement = value
end

#customWaterMarkIdString

Returns the custom watermark id.

Returns:

  • (String)

    the custom watermark id.



173
174
175
# File 'lib/grabzit/imageoptions.rb', line 173

def customWaterMarkId
	@customWaterMarkId
end

#customWaterMarkId=(value) ⇒ void

This method returns an undefined value.

Set a custom watermark to add to the screenshot.

Parameters:

  • value (String)

    custom watermark id



181
182
183
# File 'lib/grabzit/imageoptions.rb', line 181

def customWaterMarkId=(value)
	@customWaterMarkId = value
end

#delayInteger

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

Returns:

  • (Integer)

    get the number of milliseconds to wait before creating the capture



95
96
97
# File 'lib/grabzit/imageoptions.rb', line 95

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)

    the delay



103
104
105
# File 'lib/grabzit/imageoptions.rb', line 103

def delay=(value)
	@delay = value
end

#formatString

Returns get the format of the screenshot image.

Returns:

  • (String)

    get the format of the screenshot image



82
83
84
# File 'lib/grabzit/imageoptions.rb', line 82

def format
	@format
end

#format=(value) ⇒ void

This method returns an undefined value.

Set the format the screenshot should be in: bmp8, bmp16, bmp24, bmp, tiff, jpg, png

Parameters:

  • value (String)

    the format



90
91
92
# File 'lib/grabzit/imageoptions.rb', line 90

def format=(value)
	@format = value
end

#hdBoolean

Returns true if the image capture should be in high definition.

Returns:

  • (Boolean)

    true if the image capture should be in high definition



212
213
214
# File 'lib/grabzit/imageoptions.rb', line 212

def hd
	@hd
end

#hd=(value) ⇒ void

This method returns an undefined value.

Set to true if the image capture should be in high definition.

Parameters:

  • value (Boolean)

    true if the image should be high definition



220
221
222
# File 'lib/grabzit/imageoptions.rb', line 220

def hd=(value)
	@hd = value
end

#heightInteger

Returns get the height of the resulting screenshot in pixels.

Returns:

  • (Integer)

    get the height of the resulting screenshot in pixels



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

def height
	@height
end

#height=(value) ⇒ void

This method returns an undefined value.

Set the height of the resulting screenshot in pixels. Use -1 to not reduce the height of the screenshot

Parameters:

  • value (Integer)

    the height



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

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



121
122
123
# File 'lib/grabzit/imageoptions.rb', line 121

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



129
130
131
# File 'lib/grabzit/imageoptions.rb', line 129

def hideElement=(value)
	@hideElement = value
end

#noAdsBoolean

Returns get if adverts should be automatically hidden.

Returns:

  • (Boolean)

    get if adverts should be automatically hidden



225
226
227
# File 'lib/grabzit/imageoptions.rb', line 225

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



233
234
235
# File 'lib/grabzit/imageoptions.rb', line 233

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



238
239
240
# File 'lib/grabzit/imageoptions.rb', line 238

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



246
247
248
# File 'lib/grabzit/imageoptions.rb', line 246

def noCookieNotifications=(value)
	@noCookieNotifications = value
end

#qualityInteger

Returns the quality of the screenshot.

Returns:

  • (Integer)

    the quality of the screenshot.



186
187
188
# File 'lib/grabzit/imageoptions.rb', line 186

def quality
	@quality
end

#quality=(value) ⇒ void

This method returns an undefined value.

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

Parameters:

  • value (Integer)

    the quality



194
195
196
# File 'lib/grabzit/imageoptions.rb', line 194

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



160
161
162
# File 'lib/grabzit/imageoptions.rb', line 160

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



168
169
170
# File 'lib/grabzit/imageoptions.rb', line 168

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



108
109
110
# File 'lib/grabzit/imageoptions.rb', line 108

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



116
117
118
# File 'lib/grabzit/imageoptions.rb', line 116

def targetElement=(value)
	@targetElement = value
end

#transparentBoolean

Returns true if the image capture should be transparent.

Returns:

  • (Boolean)

    true if the image capture should be transparent



199
200
201
# File 'lib/grabzit/imageoptions.rb', line 199

def transparent
	@transparent
end

#transparent=(value) ⇒ void

This method returns an undefined value.

Set to true if the image capture should be transparent. This is only compatible with png and tiff images

Parameters:

  • value (Boolean)

    true if the image should be transparent



207
208
209
# File 'lib/grabzit/imageoptions.rb', line 207

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



134
135
136
# File 'lib/grabzit/imageoptions.rb', line 134

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



142
143
144
# File 'lib/grabzit/imageoptions.rb', line 142

def waitForElement=(value)
	@waitForElement = value
end

#widthInteger

Returns get the width of the resulting screenshot in pixels.

Returns:

  • (Integer)

    get the width of the resulting screenshot in pixels.



56
57
58
# File 'lib/grabzit/imageoptions.rb', line 56

def width
	@width
end

#width=(value) ⇒ void

This method returns an undefined value.

Set the width of the resulting screenshot in pixels. Use -1 to not reduce the width of the screenshot

Parameters:

  • value (Integer)

    the width



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

def width=(value)
	@width = value
end