Class: HotelBeds::HotelSearch::Response

Inherits:
Action::Response show all
Defined in:
lib/hotel_beds/hotel_search/response.rb

Instance Attribute Summary

Attributes inherited from Action::Response

#body, #errors, #headers, #request

Instance Method Summary collapse

Methods inherited from Action::Response

#initialize, #inspect, #success?

Constructor Details

This class inherits a constructor from HotelBeds::Action::Response

Instance Method Details

#currencyObject



27
28
29
# File 'lib/hotel_beds/hotel_search/response.rb', line 27

def currency
  body.at_css("Currency").attr("code")
end

#current_pageObject



11
12
13
14
15
16
17
# File 'lib/hotel_beds/hotel_search/response.rb', line 11

def current_page
  if data = pagination_data
    Integer(data.attr("currentPage"))
  else
    0
  end
end

#hotelsObject



31
32
33
34
35
# File 'lib/hotel_beds/hotel_search/response.rb', line 31

def hotels
  body.css("ServiceHotel").lazy.map do |hotel|
    HotelBeds::Parser::Hotel.new(hotel).to_model
  end
end

#session_idObject



7
8
9
# File 'lib/hotel_beds/hotel_search/response.rb', line 7

def session_id
  request.session_id
end

#total_pagesObject



19
20
21
22
23
24
25
# File 'lib/hotel_beds/hotel_search/response.rb', line 19

def total_pages
  if data = pagination_data
    Integer(data.attr("totalPages"))
  else
    0
  end
end