class GrabzIt::ImageOptions

Represents all of the options available when creating an image @version 3.0 @author GrabzIt

Public Class Methods

new() click to toggle source
Calls superclass method GrabzIt::BaseOptions::new
# 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

Public Instance Methods

_getParameters(applicationKey, sig, callBackURL, dataName, dataValue) click to toggle source

@!visibility private

# File lib/grabzit/imageoptions.rb, line 286
def _getParameters(applicationKey, sig, callBackURL, dataName, dataValue)
        params = createParameters(applicationKey, sig, callBackURL, dataName, dataValue)             
        params['width'] = GrabzIt::Utility.nil_int_check(@width)
        params['height'] = GrabzIt::Utility.nil_int_check(@height)
        params['format'] = GrabzIt::Utility.nil_check(@format)
        params['bwidth'] = GrabzIt::Utility.nil_int_check(@browserWidth)
        params['customwatermarkid'] = GrabzIt::Utility.nil_check(@customWaterMarkId)
        params['bheight'] = GrabzIt::Utility.nil_int_check(@browserHeight)
        params['delay'] = GrabzIt::Utility.nil_int_check(@delay)
        params['target'] = GrabzIt::Utility.nil_check(@targetElement)
        params['hide'] = GrabzIt::Utility.nil_check(@hideElement)
        params['waitfor'] = GrabzIt::Utility.nil_check(@waitForElement)
        params['requestmobileversion'] = GrabzIt::Utility.nil_int_check(@requestAs)          
        params['quality'] = GrabzIt::Utility.nil_int_check(@quality)
        params['transparent'] = GrabzIt::Utility.b_to_str(@transparent)
        params['noads'] = GrabzIt::Utility.b_to_str(@noAds)
        params['post'] = GrabzIt::Utility.nil_check(@post)
        params['address'] = GrabzIt::Utility.nil_check(@address)
        params['nonotify'] = GrabzIt::Utility.b_to_str(@noCookieNotifications)
        params['hd'] = GrabzIt::Utility.b_to_str(@hd)
        params['click'] = GrabzIt::Utility.nil_check(@clickElement)
        
        return params
end
_getSignatureString(applicationSecret, callBackURL, url = nil) click to toggle source

@!visibility private

# File lib/grabzit/imageoptions.rb, line 273
def _getSignatureString(applicationSecret, callBackURL, url = nil)
        items = [applicationSecret]
        
        if(url != nil)
                items.push(GrabzIt::Utility.nil_check(url))
        end
        
        items.push(GrabzIt::Utility.nil_check(callBackURL),GrabzIt::Utility.nil_check(@format),GrabzIt::Utility.nil_int_check(@height),GrabzIt::Utility.nil_int_check(@width),GrabzIt::Utility.nil_int_check(@browserHeight),GrabzIt::Utility.nil_int_check(@browserWidth),GrabzIt::Utility.nil_check(@customId),GrabzIt::Utility.nil_int_check(@delay),GrabzIt::Utility.nil_check(@targetElement),GrabzIt::Utility.nil_check(@customWaterMarkId),GrabzIt::Utility.nil_int_check(@requestAs),GrabzIt::Utility.nil_check(@country),GrabzIt::Utility.nil_int_check(@quality),GrabzIt::Utility.nil_check(@hideElement),GrabzIt::Utility.nil_check(@exportURL),GrabzIt::Utility.nil_check(@waitForElement),GrabzIt::Utility.b_to_str(@transparent),GrabzIt::Utility.nil_check(@encryptionKey),GrabzIt::Utility.b_to_str(@noAds),GrabzIt::Utility.nil_check(@post),GrabzIt::Utility.nil_check(@proxy),GrabzIt::Utility.nil_check(@address),GrabzIt::Utility.b_to_str(@noCookieNotifications),GrabzIt::Utility.b_to_str(@hd),GrabzIt::Utility.nil_check(@clickElement))
        
        return items.join("|")
end
add_post_parameter(name, value) click to toggle source

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.

@param name [String] the name of the HTTP Post parameter @param value [String] the value of the HTTP Post parameter

# File lib/grabzit/imageoptions.rb, line 268
def add_post_parameter(name, value)
        @post = appendParameter(@post, name, value)
end
address() click to toggle source

@return [String] get the URL to execute the HTML code in

# File lib/grabzit/imageoptions.rb, line 251
def address
        @address
end
address=(value) click to toggle source

Set the URL to execute the HTML code in

@param value [String] the address @return [void]

# File lib/grabzit/imageoptions.rb, line 259
def address=(value)
        @address = value
end
browserHeight() click to toggle source

@return [Integer] the height of the browser in pixels

# File lib/grabzit/imageoptions.rb, line 43
def browserHeight
        @browserHeight
end
browserHeight=(value) click to toggle source

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

@param value [Integer] the browser height @return [void]

# File lib/grabzit/imageoptions.rb, line 51
def browserHeight=(value)
        @browserHeight = value
end
browserWidth() click to toggle source

@return [Integer] the width of the browser in pixels

# File lib/grabzit/imageoptions.rb, line 30
def browserWidth
        @browserWidth
end
browserWidth=(value) click to toggle source

Set the width of the browser in pixels

@param value [Integer] the browser width @return [void]

# File lib/grabzit/imageoptions.rb, line 38
def browserWidth=(value)
        @browserWidth = value
end
clickElement() click to toggle source

@return [String] get the CSS selector of the HTML element in the web page that must clicked before the capture is performed

# File lib/grabzit/imageoptions.rb, line 147
def clickElement
        @clickElement
end
clickElement=(value) click to toggle source

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

@param value [String] the element to click @return [void]

# File lib/grabzit/imageoptions.rb, line 155
def clickElement=(value)
        @clickElement = value
end
customWaterMarkId() click to toggle source

@return [String] the custom watermark id.

# File lib/grabzit/imageoptions.rb, line 173
def customWaterMarkId
        @customWaterMarkId
end
customWaterMarkId=(value) click to toggle source

Set a custom watermark to add to the screenshot.

@param value [String] custom watermark id @return [void]

# File lib/grabzit/imageoptions.rb, line 181
def customWaterMarkId=(value)
        @customWaterMarkId = value
end
delay() click to toggle source

@return [Integer] get the number of milliseconds to wait before creating the capture

# File lib/grabzit/imageoptions.rb, line 95
def delay
        @delay
end
delay=(value) click to toggle source

Set the number of milliseconds to wait before creating the capture

@param value [Integer] the delay @return [void]

# File lib/grabzit/imageoptions.rb, line 103
def delay=(value)
        @delay = value
end
format() click to toggle source

@return [String] get the format of the screenshot image

# File lib/grabzit/imageoptions.rb, line 82
def format
        @format
end
format=(value) click to toggle source

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

@param value [String] the format @return [void]

# File lib/grabzit/imageoptions.rb, line 90
def format=(value)
        @format = value
end
hd() click to toggle source

@return [Boolean] true if the image capture should be in high definition

# File lib/grabzit/imageoptions.rb, line 212
def hd
        @hd
end
hd=(value) click to toggle source

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

@param value [Boolean] true if the image should be high definition @return [void]

# File lib/grabzit/imageoptions.rb, line 220
def hd=(value)
        @hd = value
end
height() click to toggle source

@return [Integer] get the height of the resulting screenshot in pixels

# File lib/grabzit/imageoptions.rb, line 69
def height
        @height
end
height=(value) click to toggle source

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

@param value [Integer] the height @return [void]

# File lib/grabzit/imageoptions.rb, line 77
def height=(value)
        @height = value
end
hideElement() click to toggle source

@return [String] get the CSS selector(s) of the one or more HTML elements in the web page to hide

# File lib/grabzit/imageoptions.rb, line 121
def hideElement
        @hideElement
end
hideElement=(value) click to toggle source

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

@param value [String] the element(s) to hide @return [void]

# File lib/grabzit/imageoptions.rb, line 129
def hideElement=(value)
        @hideElement = value
end
noAds() click to toggle source

@return [Boolean] get if adverts should be automatically hidden

# File lib/grabzit/imageoptions.rb, line 225
def noAds
        @noAds
end
noAds=(value) click to toggle source

Set to true if adverts should be automatically hidden

@param value [Boolean] hide adverts @return [void]

# File lib/grabzit/imageoptions.rb, line 233
def noAds=(value)
        @noAds = value
end
noCookieNotifications() click to toggle source

@return [Boolean] get if cookie notifications should be automatically hidden

# File lib/grabzit/imageoptions.rb, line 238
def noCookieNotifications
        @noCookieNotifications
end
noCookieNotifications=(value) click to toggle source

Set to true if cookie notifications should be automatically hidden

@param value [Boolean] hide cookie notifications @return [void]

# File lib/grabzit/imageoptions.rb, line 246
def noCookieNotifications=(value)
        @noCookieNotifications = value
end
quality() click to toggle source

@return [Integer] the quality of the screenshot.

# File lib/grabzit/imageoptions.rb, line 186
def quality
        @quality
end
quality=(value) click to toggle source

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

@param value [Integer] the quality @return [void]

# File lib/grabzit/imageoptions.rb, line 194
def quality=(value)
        @quality = value
end
requestAs() click to toggle source

@return [Integer] get which user agent type should be used

# File lib/grabzit/imageoptions.rb, line 160
def requestAs
        @requestAs
end
requestAs=(value) click to toggle source

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

@param value [Integer] the browser type @return [void]

# File lib/grabzit/imageoptions.rb, line 168
def requestAs=(value)
        @requestAs = value
end
targetElement() click to toggle source

@return [String] get the CSS selector of the only HTML element in the web page to capture

# File lib/grabzit/imageoptions.rb, line 108
def targetElement
        @targetElement
end
targetElement=(value) click to toggle source

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

@param value [String] the target element @return [void]

# File lib/grabzit/imageoptions.rb, line 116
def targetElement=(value)
        @targetElement = value
end
transparent() click to toggle source

@return [Boolean] true if the image capture should be transparent

# File lib/grabzit/imageoptions.rb, line 199
def transparent
        @transparent
end
transparent=(value) click to toggle source

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

@param value [Boolean] true if the image should be transparent @return [void]

# File lib/grabzit/imageoptions.rb, line 207
def transparent=(value)
        @transparent = value
end
waitForElement() click to toggle source

@return [String] get the CSS selector of the HTML element in the web page that must be visible before the capture is performed

# File lib/grabzit/imageoptions.rb, line 134
def waitForElement
        @waitForElement
end
waitForElement=(value) click to toggle source

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

@param value [String] the element to wait for @return [void]

# File lib/grabzit/imageoptions.rb, line 142
def waitForElement=(value)
        @waitForElement = value
end
width() click to toggle source

@return [Integer] get the width of the resulting screenshot in pixels.

# File lib/grabzit/imageoptions.rb, line 56
def width
        @width
end
width=(value) click to toggle source

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

@param value [Integer] the width @return [void]

# File lib/grabzit/imageoptions.rb, line 64
def width=(value)
        @width = value
end