Module: TL::Parser

Defined in:
lib/TL/parser.rb,
lib/TL/parser/version.rb

Overview

name beauty

Defined Under Namespace

Classes: Error

Constant Summary collapse

LOGIN_KEY =
"TL-INT-"
OFFERS_BASE_URL =
"https://ibe.tlintegration.com/ApiWebDistribution/BookingForm/hotel_availability"
VERSION =
"0.1.2"

Class Method Summary collapse

Class Method Details

.load_offers(url:, start_date: Date.today, finish_date: Date.tomorrow, adults_count: 2, children_ages: []) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/TL/parser.rb', line 18

def load_offers(url:, start_date: Date.today, finish_date: Date.tomorrow, adults_count: 2, children_ages: [])
  doc = load_page(url)
   = (doc)
  hotel_id = get_hotel_id()
  offers_link = generate_offers_link(hotel_id, start_date, finish_date, adults_count, children_ages)
  response = get_js(offers_link)
  return nil unless [Net::HTTPSuccess, Net::HTTPFound, Net::HTTPOK].include?(response.class)

  JSON.parse(response.body)
end