Class: EhbrsRubyUtils::Booking::Parsers::List
- Inherits:
-
Aranha::Parsers::Html::ItemList
- Object
- Aranha::Parsers::Html::ItemList
- EhbrsRubyUtils::Booking::Parsers::List
- Defined in:
- lib/ehbrs_ruby_utils/booking/parsers/list.rb
Defined Under Namespace
Modules: NodeParserExtra
Constant Summary collapse
- ITEMS_XPATH =
'//*[@data-testid="property-card"]'
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.testid_xpath(value, *suffixes) ⇒ Object
8 9 10 |
# File 'lib/ehbrs_ruby_utils/booking/parsers/list.rb', line 8 def testid_xpath(value, *suffixes) ([".//*[@data-testid='#{value}']"] + suffixes).join('/') end |
Instance Method Details
#data ⇒ Object
27 28 29 |
# File 'lib/ehbrs_ruby_utils/booking/parsers/list.rb', line 27 def data { accommodations: items_data, declared_count: declared_count } end |
#declared_count ⇒ Integer?
32 33 34 35 36 |
# File 'lib/ehbrs_ruby_utils/booking/parsers/list.rb', line 32 def declared_count ['', '/span'].lazy .map { |e| node_parser.integer_optional_value(nokogiri, "//h1#{e}/text()") } .find(&:present?) end |
#items_xpath ⇒ Object
38 39 40 |
# File 'lib/ehbrs_ruby_utils/booking/parsers/list.rb', line 38 def items_xpath ITEMS_XPATH end |
#node_parser ⇒ Object
42 43 44 45 46 |
# File 'lib/ehbrs_ruby_utils/booking/parsers/list.rb', line 42 def node_parser r = super r.extend(NodeParserExtra) r end |