Class: HotelBeds::Action::Response
- Inherits:
-
Object
- Object
- HotelBeds::Action::Response
- Defined in:
- lib/hotel_beds/action/response.rb
Direct Known Subclasses
BasketRemove::Response, HotelBasketAdd::Response, HotelSearch::Response, PurchaseConfirm::Response, PurchaseFlush::Response
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Instance Method Summary collapse
-
#initialize(request, response) ⇒ Response
constructor
A new instance of Response.
- #inspect ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(request, response) ⇒ Response
Returns a new instance of Response.
10 11 12 13 14 15 16 |
# File 'lib/hotel_beds/action/response.rb', line 10 def initialize(request, response) self.request = request self.headers = response.header self.body = Nokogiri::XML(response.body.values.first) self.errors = HotelBeds::Parser::Errors.new(response).to_model(self) freeze end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
7 8 9 |
# File 'lib/hotel_beds/action/response.rb', line 7 def body @body end |
#errors ⇒ Object
Returns the value of attribute errors.
7 8 9 |
# File 'lib/hotel_beds/action/response.rb', line 7 def errors @errors end |
#headers ⇒ Object
Returns the value of attribute headers.
7 8 9 |
# File 'lib/hotel_beds/action/response.rb', line 7 def headers @headers end |
#request ⇒ Object
Returns the value of attribute request.
7 8 9 |
# File 'lib/hotel_beds/action/response.rb', line 7 def request @request end |
Instance Method Details
#inspect ⇒ Object
18 19 20 |
# File 'lib/hotel_beds/action/response.rb', line 18 def inspect "<#{self.class.name} errors=#{errors.inspect} headers=#{headers.inspect} body=#{body.to_s}>" end |
#success? ⇒ Boolean
22 23 24 |
# File 'lib/hotel_beds/action/response.rb', line 22 def success? errors.empty? end |