Class: GrabzIt::TableOptions
- Inherits:
-
BaseOptions
- Object
- BaseOptions
- GrabzIt::TableOptions
- Defined in:
- lib/grabzit/tableoptions.rb
Overview
Represents all of the options available when extracting tabular data
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.
-
#format ⇒ String
The format of the table should be.
-
#format=(value) ⇒ void
Set the format the table should be in: ‘csv’, ‘xlsx’ or ‘json’.
-
#includeAllTables ⇒ Boolean
If every table on will be extracted with each table appearing in a separate spreadsheet sheet.
-
#includeAllTables=(value) ⇒ void
Set to true to extract every table on the web page into a separate spreadsheet sheet.
-
#includeHeaderNames ⇒ Boolean
If the header names are included in the table.
-
#includeHeaderNames=(value) ⇒ void
Set to true to include header names into the table.
-
#initialize ⇒ TableOptions
constructor
A new instance of TableOptions.
-
#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.
-
#tableNumberToInclude ⇒ Integer
The index of the table to be converted.
-
#tableNumberToInclude=(value) ⇒ void
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.
-
#targetElement ⇒ String
The id of the only HTML element in the web page that should be used to extract tables from.
-
#targetElement=(value) ⇒ void
Set the id of the only HTML element in the web page that should be used to extract tables from.
Methods inherited from BaseOptions
#country, #country=, #customId, #customId=, #encryptionKey, #encryptionKey=, #exportURL, #exportURL=, #proxy, #proxy=
Constructor Details
#initialize ⇒ TableOptions
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.
115 116 117 |
# File 'lib/grabzit/tableoptions.rb', line 115 def add_post_parameter(name, value) @post = appendParameter(@post, name, value) end |
#address ⇒ String
Returns 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
106 107 108 |
# File 'lib/grabzit/tableoptions.rb', line 106 def address=(value) @address = value end |
#format ⇒ String
Returns 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’
41 42 43 |
# File 'lib/grabzit/tableoptions.rb', line 41 def format=(value) @format = value end |
#includeAllTables ⇒ Boolean
Returns 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
67 68 69 |
# File 'lib/grabzit/tableoptions.rb', line 67 def includeAllTables=(value) @includeAllTables = value end |
#includeHeaderNames ⇒ Boolean
Returns 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
54 55 56 |
# File 'lib/grabzit/tableoptions.rb', line 54 def includeHeaderNames=(value) @includeHeaderNames = value end |
#requestAs ⇒ Integer
Returns 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
93 94 95 |
# File 'lib/grabzit/tableoptions.rb', line 93 def requestAs=(value) @requestAs = value end |
#tableNumberToInclude ⇒ Integer
Returns 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
28 29 30 |
# File 'lib/grabzit/tableoptions.rb', line 28 def tableNumberToInclude=(value) @tableNumberToInclude = value end |
#targetElement ⇒ String
Returns 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
80 81 82 |
# File 'lib/grabzit/tableoptions.rb', line 80 def targetElement=(value) @targetElement = value end |