class GrabzIt::TableOptions

Represents all of the options available when extracting tabular data @version 3.0 @author GrabzIt

Public Class Methods

new() click to toggle source
Calls superclass method GrabzIt::BaseOptions::new
# File lib/grabzit/tableoptions.rb, line 8
def initialize()
        super()
        @tableNumberToInclude = 1
        @format = 'csv'
        @includeHeaderNames = true
        @includeAllTables = false
        @targetElement = nil
        @requestAs = 0
        @address = nil                       
end

Public Instance Methods

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

@!visibility private

# File lib/grabzit/tableoptions.rb, line 133
def _getParameters(applicationKey, sig, callBackURL, dataName, dataValue)
        params = createParameters(applicationKey, sig, callBackURL, dataName, dataValue)
        params['includeAllTables'] = GrabzIt::Utility.b_to_str(@includeAllTables)
        params['includeHeaderNames'] = GrabzIt::Utility.b_to_str(@includeHeaderNames)
        params['format'] = GrabzIt::Utility.nil_check(@format)
        params['tableToInclude'] = GrabzIt::Utility.nil_int_check(@tableNumberToInclude)
        params['target'] = GrabzIt::Utility.nil_check(@targetElement)
        params['requestmobileversion'] = GrabzIt::Utility.nil_int_check(@requestAs)
        params['post'] = GrabzIt::Utility.nil_check(@post)
        params['address'] = GrabzIt::Utility.nil_check(@address)
        
        return params
end
_getSignatureString(applicationSecret, callBackURL, url = nil) click to toggle source

@!visibility private

# File lib/grabzit/tableoptions.rb, line 120
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(@customId),GrabzIt::Utility.nil_int_check(@tableNumberToInclude),GrabzIt::Utility.b_to_str(@includeAllTables),GrabzIt::Utility.b_to_str(@includeHeaderNames),GrabzIt::Utility.nil_check(@targetElement),GrabzIt::Utility.nil_check(@format),GrabzIt::Utility.nil_int_check(@requestAs),GrabzIt::Utility.nil_check(@country),GrabzIt::Utility.nil_check(@exportURL),GrabzIt::Utility.nil_check(@encryptionKey),GrabzIt::Utility.nil_check(@post),GrabzIt::Utility.nil_check(@proxy),GrabzIt::Utility.nil_check(@address))
        
        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/tableoptions.rb, line 115
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/tableoptions.rb, line 98
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/tableoptions.rb, line 106
def address=(value)
        @address = value
end
format() click to toggle source

@return [String] the format of the table should be

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

Set the format the table should be in: 'csv', 'xlsx' or 'json'

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

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

@return [Boolean] if every table on will be extracted with each table appearing in a separate spreadsheet sheet

# File lib/grabzit/tableoptions.rb, line 59
def includeAllTables
        @includeAllTables
end
includeAllTables=(value) click to toggle source

Set to true to extract every table on the web page into a separate spreadsheet sheet. Only available with the XLSX and JSON formats

@param value [Boolean] include all tables @return [void]

# File lib/grabzit/tableoptions.rb, line 67
def includeAllTables=(value)
        @includeAllTables = value
end
includeHeaderNames() click to toggle source

@return [Boolean] if the header names are included in the table

# File lib/grabzit/tableoptions.rb, line 46
def includeHeaderNames
        @includeHeaderNames
end
includeHeaderNames=(value) click to toggle source

Set to true to include header names into the table

@param value [Boolean] include header names @return [void]

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

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

# File lib/grabzit/tableoptions.rb, line 85
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/tableoptions.rb, line 93
def requestAs=(value)
        @requestAs = value
end
tableNumberToInclude() click to toggle source

@return [Integer] the index of the table to be converted

# File lib/grabzit/tableoptions.rb, line 20
def tableNumberToInclude
        @tableNumberToInclude
end
tableNumberToInclude=(value) click to toggle source

Set the index of the table to be converted, were all tables in a web page are ordered from the top of the web page to bottom

@param value [Integer] the table number @return [void]

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

@return [String] the id of the only HTML element in the web page that should be used to extract tables from

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

Set the id of the only HTML element in the web page that should be used to extract tables from

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

# File lib/grabzit/tableoptions.rb, line 80
def targetElement=(value)
        @targetElement = value
end