class OracleOWS::GuestServices

Guest Services Web Service

{docs.oracle.com/cd/E90572_01/docs/Guest%20Services%20Web%20Service%20Specification.htm}

Public Class Methods

new(options = {}) click to toggle source

Initialize

@param [Hash] object with connection parameters

Calls superclass method OracleOWS::Base::new
# File lib/oracle_ows/guest_services.rb, line 19
def initialize(options = {})
  # call the parent method, all arguments passed
  super

  # we need these for API calls
  more_namespaces = {
    'xmlns:gue' => 'http://webservices.micros.com/og/4.3/GuestServices/',
    'xmlns:hot' => 'http://webservices.micros.com/og/4.3/HotelCommon/'
  }
  # merge base + additional namespaces
  @namespaces.merge!(more_namespaces)
end

Public Instance Methods

update_room_status(options = {}) click to toggle source

Update Room Status

@param [Hash] options to update the room status @option options [String] :hotel_code code of the hotel @option options [Numeric, String] :room number to update

@return [Hash] result hash extracted from the deply nested XML

# File lib/oracle_ows/guest_services.rb, line 41
def update_room_status(options = {})
  # save resources if we have nothing to do
  return {} if options.blank?

  # make the SOAP API call
  response = soap_client.call(
    # endpoint action
    :update_room_status,
    # payload
    message: {
      'HotelReference' => {
        '@hotelCode' => options[:hotel_code]
      },
      'RoomNumber' => options[:room],
      'RoomStatus' => 'Clean',
      'TurnDownStatus' => 'Completed',
      'GuestServiceStatus' => 'DoNotDisturb'
    }
  )

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

# handle exceptions gracefully
rescue OracleOWS::Error => e
  # handle exception gracefully
ensure
  {} # at least return a blank hash
end
wake_up_call(options = {}) click to toggle source

Wake Up Call

@param [Hash] options parameters @option options [String] :hotel_code is the code of the hotel @option options [Numeric, String] :room number

@return [Hash] result hash from the deeply nested XML response

# File lib/oracle_ows/guest_services.rb, line 80
def wake_up_call(options = {})
  return {} if options.blank?

  response = soap_client.call(
    :wake_up_call,
    message: {
      'HotelReference' => { '@hotelCode' => options[:hotel_code] },
      'RoomNumber' => options[:room]
    }
  )

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

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