Class: Parsec::Request::Country

Inherits:
Base
  • Object
show all
Defined in:
lib/parsec/request/country.rb

Constant Summary

Constants inherited from Base

Base::DATE_FORMAT, Base::NAMESPACE, Base::RESOURCES

Instance Method Summary collapse

Methods inherited from Base

#client, #error, #initialize

Constructor Details

This class inherits a constructor from Parsec::Request::Base

Instance Method Details

#allObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/parsec/request/country.rb', line 6

def all
  message = { read_request: { hotel_read_request: { request_type: 'GetCountries' } } }
  response = client(:static_data).call('OTA_ReadRQ', message: message)

  response.body[:ota_read_rs][:read_response][:countries][:country] do |c|
    Parsec::Country.new(iso: c[:country_iso], name: c[:country_name], code: c[:@country_code])
  end
rescue Savon::Error => e
  Xlog.and_raise_error(e)
end