Class: Scrapio::Resources::Agoda

Inherits:
Object
  • Object
show all
Defined in:
lib/scrapio/resources/agoda.rb

Instance Method Summary collapse

Constructor Details

#initialize(http) ⇒ Agoda

Returns a new instance of Agoda.



4
# File 'lib/scrapio/resources/agoda.rb', line 4

def initialize(http) = @http = http

Instance Method Details

#get_property(property_id: nil, city_id: nil, url: nil, check_in:, check_out:, adults: nil, children: nil, children_ages: nil, rooms: nil, currency: nil, pos_country: nil) ⇒ Object

Provide url, or property_id together with city_id (from a prior search's resolved_city_id).



20
21
22
23
24
25
26
27
# File 'lib/scrapio/resources/agoda.rb', line 20

def get_property(property_id: nil, city_id: nil, url: nil, check_in:, check_out:, adults: nil,
                  children: nil, children_ages: nil, rooms: nil, currency: nil, pos_country: nil)
  @http.get("/v1/agoda/property", {
    property_id: property_id, city_id: city_id, url: url, check_in: check_in, check_out: check_out,
    adults: adults, children: children, children_ages: children_ages, rooms: rooms,
    currency: currency, pos_country: pos_country,
  })
end

#get_reviews(property_id: nil, url: nil, page: nil, language: nil) ⇒ Object



29
30
31
# File 'lib/scrapio/resources/agoda.rb', line 29

def get_reviews(property_id: nil, url: nil, page: nil, language: nil)
  @http.get("/v1/agoda/reviews", { property_id: property_id, url: url, page: page, language: language })
end

#search(location:, check_in:, check_out:, adults: nil, children: nil, children_ages: nil, rooms: nil, currency: nil, pos_country: nil, sort_by: nil, min_price: nil, max_price: nil, stars: nil, min_review_score: nil, page: nil) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/scrapio/resources/agoda.rb', line 6

def search(location:, check_in:, check_out:, adults: nil, children: nil, children_ages: nil,
           rooms: nil, currency: nil, pos_country: nil, sort_by: nil, min_price: nil,
           max_price: nil, stars: nil, min_review_score: nil, page: nil)
  @http.get("/v1/agoda/search", {
    location: location, check_in: check_in, check_out: check_out,
    adults: adults, children: children, children_ages: children_ages, rooms: rooms,
    currency: currency, pos_country: pos_country, sort_by: sort_by,
    min_price: min_price, max_price: max_price, stars: stars,
    min_review_score: min_review_score, page: page,
  })
end