Class: GrabzIt::ImageOptions
- Inherits:
-
BaseOptions
- Object
- BaseOptions
- GrabzIt::ImageOptions
- Defined in:
- lib/grabzit/imageoptions.rb
Overview
Represents all of the options available when creating an image
Instance Method Summary collapse
-
#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.
-
#address ⇒ String
Get the URL to execute the HTML code in.
-
#address=(value) ⇒ void
Set the URL to execute the HTML code in.
-
#browserHeight ⇒ Integer
The height of the browser in pixels.
-
#browserHeight=(value) ⇒ void
Set the height of the browser in pixels.
-
#browserWidth ⇒ Integer
The width of the browser in pixels.
-
#browserWidth=(value) ⇒ void
Set the width of the browser in pixels.
-
#clickElement ⇒ String
Get the CSS selector of the HTML element in the web page that must clicked before the capture is performed.
-
#clickElement=(value) ⇒ void
Set the CSS selector of the HTML element in the web page that must clicked before the capture is performed.
-
#customWaterMarkId ⇒ String
The custom watermark id.
-
#customWaterMarkId=(value) ⇒ void
Set a custom watermark to add to the screenshot.
-
#delay ⇒ Integer
Get the number of milliseconds to wait before creating the capture.
-
#delay=(value) ⇒ void
Set the number of milliseconds to wait before creating the capture.
-
#format ⇒ String
Get the format of the screenshot image.
-
#format=(value) ⇒ void
Set the format the screenshot should be in: bmp8, bmp16, bmp24, bmp, tiff, jpg, png.
-
#hd ⇒ Boolean
True if the image capture should be in high definition.
-
#hd=(value) ⇒ void
Set to true if the image capture should be in high definition.
-
#height ⇒ Integer
Get the height of the resulting screenshot in pixels.
-
#height=(value) ⇒ void
Set the height of the resulting screenshot in pixels.
-
#hideElement ⇒ String
Get the CSS selector(s) of the one or more HTML elements in the web page to hide.
-
#hideElement=(value) ⇒ void
Set the CSS selector(s) of the one or more HTML elements in the web page to hide.
-
#hoverElement ⇒ String
Get the CSS selector of the HTML element in the web page that must hovered over before the capture is performed.
-
#hoverElement=(value) ⇒ void
Set the CSS selector of the HTML element in the web page that must hovered over before the capture is performed.
-
#initialize ⇒ ImageOptions
constructor
A new instance of ImageOptions.
-
#jsCode ⇒ String
Get the JavaScript code that will be execute in the web page before the capture is performed.
-
#jsCode=(value) ⇒ void
Set the JavaScript code that will be execute in the web page before the capture is performed.
-
#noAds ⇒ Boolean
Get if adverts should be automatically hidden.
-
#noAds=(value) ⇒ void
Set to true if adverts should be automatically hidden.
-
#noCookieNotifications ⇒ Boolean
Get if cookie notifications should be automatically hidden.
-
#noCookieNotifications=(value) ⇒ void
Set to true if cookie notifications should be automatically hidden.
-
#quality ⇒ Integer
The quality of the screenshot.
-
#quality=(value) ⇒ void
Set the quality of the screenshot where 0 is poor and 100 excellent.
-
#requestAs ⇒ Integer
Get which user agent type should be used.
-
#requestAs=(value) ⇒ void
Set which user agent type should be used: Standard Browser = 0, Mobile Browser = 1, Search Engine = 2 and Fallback Browser = 3.
-
#scrollElement ⇒ String
Get the CSS selector of the HTML element in the web page that must scroll to before the capture is performed.
-
#scrollElement=(value) ⇒ void
Set the CSS selector of the HTML element in the web page that must scroll to before the capture is performed.
-
#targetElement ⇒ String
Get the CSS selector of the only HTML element in the web page to capture.
-
#targetElement=(value) ⇒ void
Set the CSS selector of the only HTML element in the web page to capture.
-
#transparent ⇒ Boolean
True if the image capture should be transparent.
-
#transparent=(value) ⇒ void
Set to true if the image capture should be transparent.
-
#waitForElement ⇒ String
Get the CSS selector of the HTML element in the web page that must be visible before the capture is performed.
-
#waitForElement=(value) ⇒ void
Set the CSS selector of the HTML element in the web page that must be visible before the capture is performed.
-
#width ⇒ Integer
Get the width of the resulting screenshot in pixels.
-
#width=(value) ⇒ void
Set the width of the resulting screenshot in pixels.
Methods inherited from BaseOptions
#country, #country=, #customId, #customId=, #encryptionKey, #encryptionKey=, #exportURL, #exportURL=, #proxy, #proxy=
Constructor Details
#initialize ⇒ ImageOptions
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 28 29 30 |
# 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 @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.
310 311 312 |
# File 'lib/grabzit/imageoptions.rb', line 310 def add_post_parameter(name, value) @post = appendParameter(@post, name, value) end |
#address ⇒ String
Returns get the URL to execute the HTML code in.
280 281 282 |
# File 'lib/grabzit/imageoptions.rb', line 280 def address @address end |
#address=(value) ⇒ void
This method returns an undefined value.
Set the URL to execute the HTML code in
288 289 290 |
# File 'lib/grabzit/imageoptions.rb', line 288 def address=(value) @address = value end |
#browserHeight ⇒ Integer
Returns the height of the browser in pixels.
46 47 48 |
# File 'lib/grabzit/imageoptions.rb', line 46 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
54 55 56 |
# File 'lib/grabzit/imageoptions.rb', line 54 def browserHeight=(value) @browserHeight = value end |
#browserWidth ⇒ Integer
Returns the width of the browser in pixels.
33 34 35 |
# File 'lib/grabzit/imageoptions.rb', line 33 def browserWidth @browserWidth end |
#browserWidth=(value) ⇒ void
This method returns an undefined value.
Set the width of the browser in pixels
41 42 43 |
# File 'lib/grabzit/imageoptions.rb', line 41 def browserWidth=(value) @browserWidth = value end |
#clickElement ⇒ String
Returns get the CSS selector of the HTML element in the web page that must clicked before the capture is performed.
150 151 152 |
# File 'lib/grabzit/imageoptions.rb', line 150 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
158 159 160 |
# File 'lib/grabzit/imageoptions.rb', line 158 def clickElement=(value) @clickElement = value end |
#customWaterMarkId ⇒ String
Returns the custom watermark id.
202 203 204 |
# File 'lib/grabzit/imageoptions.rb', line 202 def customWaterMarkId @customWaterMarkId end |
#customWaterMarkId=(value) ⇒ void
This method returns an undefined value.
Set a custom watermark to add to the screenshot.
210 211 212 |
# File 'lib/grabzit/imageoptions.rb', line 210 def customWaterMarkId=(value) @customWaterMarkId = value end |
#delay ⇒ Integer
Returns get the number of milliseconds to wait before creating the capture.
98 99 100 |
# File 'lib/grabzit/imageoptions.rb', line 98 def delay @delay end |
#delay=(value) ⇒ void
This method returns an undefined value.
Set the number of milliseconds to wait before creating the capture
106 107 108 |
# File 'lib/grabzit/imageoptions.rb', line 106 def delay=(value) @delay = value end |
#format ⇒ String
Returns get the format of the screenshot image.
85 86 87 |
# File 'lib/grabzit/imageoptions.rb', line 85 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
93 94 95 |
# File 'lib/grabzit/imageoptions.rb', line 93 def format=(value) @format = value end |
#hd ⇒ Boolean
Returns true if the image capture should be in high definition.
241 242 243 |
# File 'lib/grabzit/imageoptions.rb', line 241 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.
249 250 251 |
# File 'lib/grabzit/imageoptions.rb', line 249 def hd=(value) @hd = value end |
#height ⇒ Integer
Returns get the height of the resulting screenshot in pixels.
72 73 74 |
# File 'lib/grabzit/imageoptions.rb', line 72 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
80 81 82 |
# File 'lib/grabzit/imageoptions.rb', line 80 def height=(value) @height = value end |
#hideElement ⇒ String
Returns get the CSS selector(s) of the one or more HTML elements in the web page to hide.
124 125 126 |
# File 'lib/grabzit/imageoptions.rb', line 124 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
132 133 134 |
# File 'lib/grabzit/imageoptions.rb', line 132 def hideElement=(value) @hideElement = value end |
#hoverElement ⇒ String
Returns get the CSS selector of the HTML element in the web page that must hovered over before the capture is performed.
176 177 178 |
# File 'lib/grabzit/imageoptions.rb', line 176 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
184 185 186 |
# File 'lib/grabzit/imageoptions.rb', line 184 def hoverElement=(value) @hoverElement = value end |
#jsCode ⇒ String
Returns get the JavaScript code that will be execute in the web page before the capture is performed.
293 294 295 |
# File 'lib/grabzit/imageoptions.rb', line 293 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
301 302 303 |
# File 'lib/grabzit/imageoptions.rb', line 301 def jsCode=(value) @jsCode = value end |
#noAds ⇒ Boolean
Returns get if adverts should be automatically hidden.
254 255 256 |
# File 'lib/grabzit/imageoptions.rb', line 254 def noAds @noAds end |
#noAds=(value) ⇒ void
This method returns an undefined value.
Set to true if adverts should be automatically hidden
262 263 264 |
# File 'lib/grabzit/imageoptions.rb', line 262 def noAds=(value) @noAds = value end |
#noCookieNotifications ⇒ Boolean
Returns get if cookie notifications should be automatically hidden.
267 268 269 |
# File 'lib/grabzit/imageoptions.rb', line 267 def noCookieNotifications @noCookieNotifications end |
#noCookieNotifications=(value) ⇒ void
This method returns an undefined value.
Set to true if cookie notifications should be automatically hidden
275 276 277 |
# File 'lib/grabzit/imageoptions.rb', line 275 def noCookieNotifications=(value) @noCookieNotifications = value end |
#quality ⇒ Integer
Returns the quality of the screenshot.
215 216 217 |
# File 'lib/grabzit/imageoptions.rb', line 215 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
223 224 225 |
# File 'lib/grabzit/imageoptions.rb', line 223 def quality=(value) @quality = value end |
#requestAs ⇒ Integer
Returns get which user agent type should be used.
189 190 191 |
# File 'lib/grabzit/imageoptions.rb', line 189 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
197 198 199 |
# File 'lib/grabzit/imageoptions.rb', line 197 def requestAs=(value) @requestAs = value end |
#scrollElement ⇒ String
Returns get the CSS selector of the HTML element in the web page that must scroll to before the capture is performed.
163 164 165 |
# File 'lib/grabzit/imageoptions.rb', line 163 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
171 172 173 |
# File 'lib/grabzit/imageoptions.rb', line 171 def scrollElement=(value) @scrollElement = value end |
#targetElement ⇒ String
Returns get the CSS selector of the only HTML element in the web page to capture.
111 112 113 |
# File 'lib/grabzit/imageoptions.rb', line 111 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
119 120 121 |
# File 'lib/grabzit/imageoptions.rb', line 119 def targetElement=(value) @targetElement = value end |
#transparent ⇒ Boolean
Returns true if the image capture should be transparent.
228 229 230 |
# File 'lib/grabzit/imageoptions.rb', line 228 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
236 237 238 |
# File 'lib/grabzit/imageoptions.rb', line 236 def transparent=(value) @transparent = value end |
#waitForElement ⇒ String
Returns get the CSS selector of the HTML element in the web page that must be visible before the capture is performed.
137 138 139 |
# File 'lib/grabzit/imageoptions.rb', line 137 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
145 146 147 |
# File 'lib/grabzit/imageoptions.rb', line 145 def waitForElement=(value) @waitForElement = value end |
#width ⇒ Integer
Returns get the width of the resulting screenshot in pixels.
59 60 61 |
# File 'lib/grabzit/imageoptions.rb', line 59 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
67 68 69 |
# File 'lib/grabzit/imageoptions.rb', line 67 def width=(value) @width = value end |