Class: GrabzIt::TableOptions

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

Overview

Represents all of the options available when extracting tabular data

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

#initializeTableOptions

Returns a new instance of TableOptions.



8
9
10
11
12
13
14
15
16
17
# 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

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



115
116
117
# File 'lib/grabzit/tableoptions.rb', line 115

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



98
99
100
# File 'lib/grabzit/tableoptions.rb', line 98

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



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

def address=(value)
	@address = value
end

#formatString

Returns the format of the table should be.

Returns:

  • (String)

    the format of the table should be



33
34
35
# File 'lib/grabzit/tableoptions.rb', line 33

def format
	@format
end

#format=(value) ⇒ void

This method returns an undefined value.

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

Parameters:

  • value (String)

    the format



41
42
43
# File 'lib/grabzit/tableoptions.rb', line 41

def format=(value)
	@format = value
end

#includeAllTablesBoolean

Returns if every table on will be extracted with each table appearing in a separate spreadsheet sheet.

Returns:

  • (Boolean)

    if every table on will be extracted with each table appearing in a separate spreadsheet sheet



59
60
61
# File 'lib/grabzit/tableoptions.rb', line 59

def includeAllTables
	@includeAllTables
end

#includeAllTables=(value) ⇒ void

This method returns an undefined value.

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

Parameters:

  • value (Boolean)

    include all tables



67
68
69
# File 'lib/grabzit/tableoptions.rb', line 67

def includeAllTables=(value)
	@includeAllTables = value
end

#includeHeaderNamesBoolean

Returns if the header names are included in the table.

Returns:

  • (Boolean)

    if the header names are included in the table



46
47
48
# File 'lib/grabzit/tableoptions.rb', line 46

def includeHeaderNames
	@includeHeaderNames
end

#includeHeaderNames=(value) ⇒ void

This method returns an undefined value.

Set to true to include header names into the table

Parameters:

  • value (Boolean)

    include header names



54
55
56
# File 'lib/grabzit/tableoptions.rb', line 54

def includeHeaderNames=(value)
	@includeHeaderNames = value
end

#requestAsInteger

Returns get which user agent type should be used.

Returns:

  • (Integer)

    get which user agent type should be used



85
86
87
# File 'lib/grabzit/tableoptions.rb', line 85

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



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

def requestAs=(value)
	@requestAs = value
end

#tableNumberToIncludeInteger

Returns the index of the table to be converted.

Returns:

  • (Integer)

    the index of the table to be converted



20
21
22
# File 'lib/grabzit/tableoptions.rb', line 20

def tableNumberToInclude
	@tableNumberToInclude
end

#tableNumberToInclude=(value) ⇒ void

This method returns an undefined value.

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

Parameters:

  • value (Integer)

    the table number



28
29
30
# File 'lib/grabzit/tableoptions.rb', line 28

def tableNumberToInclude=(value)
	@tableNumberToInclude = value
end

#targetElementString

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

Returns:

  • (String)

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



72
73
74
# File 'lib/grabzit/tableoptions.rb', line 72

def targetElement
	@targetElement
end

#targetElement=(value) ⇒ void

This method returns an undefined value.

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

Parameters:

  • value (String)

    target



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

def targetElement=(value)
	@targetElement = value
end