Module: Resonline::Service

Defined in:
lib/resonline/service.rb

Class Method Summary collapse

Class Method Details

.get_hotel_rate_package_deals(rate_package_id) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/resonline/service.rb', line 43

def self.get_hotel_rate_package_deals(rate_package_id)
  client = Savon.client(soap_options)
  xml = '
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://cm.schema.com/direct/2.0/" xmlns:ns1="http://cm.schema.com/api-core/2.0/" xmlns:dir="http://schemas.datacontract.org/2004/07/DirectApi.Service.Content.Model">
      <soapenv:Header/>
      <soapenv:Body>
         <ns:GetHotelRatePackageDeals>
            <!--Optional:-->
            <ns:request>
               <ns1:ChannelManagerUsername>' + Resonline.configuration.cm_username + '</ns1:ChannelManagerUsername>
               <ns1:ChannelManagerPassword>' + Resonline.configuration.cm_password + '</ns1:ChannelManagerPassword>
               <!--Optional:-->
               <ns1:Username>' + Resonline.configuration.username + '</ns1:Username>
               <!--Optional:-->
               <ns1:Password>' + Resonline.configuration.password + '</ns1:Password>
               <!--Optional:-->
               <ns1:HotelId>' + Resonline.configuration.hotel_id.to_s + '</ns1:HotelId>
               <!--Optional:-->
               <dir:HotelRatePackageID>' + rate_package_id.to_s + '</dir:HotelRatePackageID>
            </ns:request>
         </ns:GetHotelRatePackageDeals>
      </soapenv:Body>
    </soapenv:Envelope>'
  response = client.call(:get_hotel_rate_package_deals, xml: xml)
  if response.success?
    return response.body[:get_hotel_rate_package_deals_response][:get_hotel_rate_package_deals_result]
  else
    return Resonline::ErrorMessages.failed_response(response)
  end
rescue Exception => e
  return Resonline::ErrorMessages.exception(e)
end

.get_hotel_roomsObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/resonline/service.rb', line 11

def self.get_hotel_rooms
  client = Savon.client(soap_options)
  xml = '
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://cm.schema.com/direct/2.0/" xmlns:ns1="http://cm.schema.com/api-core/2.0/">
      <soapenv:Header/>
      <soapenv:Body>
         <ns:GetHotelRooms>
            <!--Optional:-->
            <ns:request>
               <ns1:ChannelManagerUsername>' + Resonline.configuration.cm_username + '</ns1:ChannelManagerUsername>
               <ns1:ChannelManagerPassword>' + Resonline.configuration.cm_password + '</ns1:ChannelManagerPassword>
               <!--Optional:-->
               <ns1:Username>' + Resonline.configuration.username + '</ns1:Username>
               <!--Optional:-->
               <ns1:Password>' + Resonline.configuration.password + '</ns1:Password>
               <!--Optional:-->
               <ns1:HotelId>' + Resonline.configuration.hotel_id.to_s + '</ns1:HotelId>
               <!--Optional:-->
            </ns:request>
         </ns:GetHotelRooms>
      </soapenv:Body>
    </soapenv:Envelope>'
  response = client.call(:get_hotel_rooms, xml: xml)
  if response.success?
    return response.body[:get_hotel_rooms_response][:get_hotel_rooms_result]
  else
    return Resonline::ErrorMessages.failed_response(response)
  end
rescue Exception => e
  return Resonline::ErrorMessages.exception(e)
end

.soap_optionsObject



3
4
5
6
7
8
9
# File 'lib/resonline/service.rb', line 3

def self.soap_options
  options = Resonline::SOAPNamespaces.merge({
    endpoint: "#{Resonline::SOAPPrefixUrl}ContentService.svc",
    wsdl: "#{Resonline::SOAPPrefixUrl}ContentService.svc?wsdl=wsdl1"
  })
  options
end