class GetterCyndi5
The main GetterCyndi5
driver
Public Class Methods
go(options = {})
click to toggle source
Getter
Example:
>> GetterCyndi5.go( base_url = 'https://thehappyco.com', products_page_path = '/kelly/products', item_row_selector = '.item-row', item_anchor_selector = 'div > div.product-desc.text-center > div.product-title > h3 > a', item_price_selector = 'div > div.product-desc.text-center > div.product-price', price_a_text: 'One Time Purchase', price_b_text: 'SmartShip', mode = 2, filename = './tmp/test_document.html' )
Arguments:
base_url: (String) products_page_path: (String) item_row_selector: (String) item_anchor_selector: (String) item_price_selector: (String) price_a_text: (String) price_b_text: (String) mode: (Integer) 0 = retrieve and parse without saving HTML document to file, 1 = retrieve and parse saving HTML document to file, 2 = load and parse HTML document from file filename: (String)
# File lib/getter_cyndi5.rb, line 31 def self.go(options = {}) all_products = products(**options) all_products.each do |product| puts "#{product.inspect}" end end
products(options = {})
click to toggle source
# File lib/getter_cyndi5.rb, line 38 def self.products(options = {}) retriever = Retriever.new(**options) retriever.retrieve parser = Parser.new(document: retriever.document, **options) products = parser.parse end