Class: OracleOWS::Information

Inherits:
Base
  • Object
show all
Defined in:
lib/oracle_ows/information.rb

Overview

Instance Attribute Summary

Attributes included from Common

#namespaces, #password, #url, #username

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Information

initialize the API endpoint object

Parameters:

  • base (OracleOws::Base)

    object with initial parameters



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/oracle_ows/information.rb', line 17

def initialize(options = {})
  # call the parent method, all arguments passed
  super

  # we need these for API calls
  more_namespaces = {
    'xmlns:inf' => 'http://webservices.micros.com/ows/5.1/Information.wsdl'
  }
  # merge base + additional namespaces
  @namespaces.merge!(more_namespaces)
end

Instance Method Details

#hotel_information(options = {}) ⇒ Object

action: hotel information Usage:

hotel_information({ hotel_code: 'ABC' })


32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/oracle_ows/information.rb', line 32

def hotel_information(options = {})
  return {} if options.blank?

  response = soap_client.call(
    :query_hotel_information,
    message: {
      'HotelInformationQuery' => { '@hotelCode' => options[:hotel_code] }
    }
  )

  # fetch the response safely (without exception or too many conditional blocks)
  response.body.dig(:hotel_information_response, :result)

# handle exceptions gracefully
rescue OracleOWS::Error => e
  # handle exception gracefully
ensure
  {} # at least return a blank hash
end