resonline 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 297514306d6e71c05e51021dbf25541fd2032a6c
4
- data.tar.gz: 63cd8de633115d677c1c9be76da3c4d363373ece
3
+ metadata.gz: 4af17f9c19c1c2f4832aedf9d85910a88e936010
4
+ data.tar.gz: 559db72a0904c6a701106d148c56492a017fdcde
5
5
  SHA512:
6
- metadata.gz: b7b2a7cb2b5eaba6b1c143c3073b09e9b130244373a7fa66680e2f22962e7918f887d8807dcab21382a22ce7be5ea3894ac8baad545622caf2783ab0d83e804d
7
- data.tar.gz: 7c712f490b790a89898a9fc68617ca4a7bee2e27d265c28d74dcee6657cb4d4555f82d6bdf8207c5e35a7cdffd0837f71231ff8f4e66820784c2f63e6331b5e3
6
+ metadata.gz: b1eccfa2bd2a34d821538032cc5b9e64a67516fbae0662573abe28e19227af24cb85ae676e448ebf2c0dbbaf53e3c56e1435981ec81b6b55fcac160d1525213b
7
+ data.tar.gz: 28e49a8fd8f5b01ec9607ea3ba4b3f9b57e58cf409fc77dc50581f008b5080828fa3e14fa5313e38374f54bcc9c844e6c1e67dbcef69ea9fa337e328119e21a4
data/lib/resonline.rb CHANGED
@@ -5,4 +5,5 @@ require "resonline/error_messages"
5
5
  require "savon"
6
6
  require "resonline/inventory"
7
7
  require "resonline/service"
8
- require "resonline/transformation"
8
+ require "resonline/transformation"
9
+ require "resonline/notification"
@@ -41,6 +41,7 @@ module Resonline
41
41
  end
42
42
 
43
43
  def self.get_inventory(start_date, end_date, rate_package_ids = [])
44
+ puts "-------- Start Date : #{start_date}, End Date : #{end_date} --------------"
44
45
  client = Savon.client(soap_options)
45
46
  xml = '
46
47
  <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/">
@@ -58,14 +59,14 @@ module Resonline
58
59
  <!--Optional:-->
59
60
  <ns1:HotelId>' + Resonline.configuration.hotel_id.to_s + '</ns1:HotelId>
60
61
  <!--Optional:-->
61
-
62
+ <ns1:HotelAuthenticationKey/>
62
63
  <!--Optional:-->
63
- <ns:EndDate>' + end_date.xmlschema + '</ns:EndDate>
64
+ <ns:EndDate>' + end_date.strftime("%Y-%m-%d") + '</ns:EndDate>
64
65
  <ns:RatePackages>
65
66
  <!--Zero or more repetitions:-->' + rate_package_ids.map { |id| "<ns:RatePackageId>#{id}</ns:RatePackageId>" }.join('') + '
66
67
  </ns:RatePackages>
67
68
  <!--Optional:-->
68
- <ns:StartDate>' + start_date.xmlschema + '</ns:StartDate>
69
+ <ns:StartDate>' + start_date.strftime("%Y-%m-%d") + '</ns:StartDate>
69
70
  </ns:request>
70
71
  </ns:GetInventory>
71
72
  </soapenv:Body>
@@ -79,6 +80,5 @@ module Resonline
79
80
  rescue Exception => e
80
81
  return Resonline::ErrorMessages.exception(e)
81
82
  end
82
-
83
83
  end
84
84
  end
@@ -0,0 +1,82 @@
1
+ module Resonline
2
+ module Notification
3
+ def self.soap_options
4
+ options = Resonline::SOAPNamespaces.merge({
5
+ endpoint: "#{Resonline::SOAPPrefixUrl}NotificationService.svc",
6
+ wsdl: "#{Resonline::SOAPPrefixUrl}NotificationService.svc?wsdl=wsdl0"
7
+ })
8
+ options
9
+ end
10
+ def self.booking_notification(options={})
11
+ client = Savon.client(soap_options)
12
+ 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.Notification.Model">
13
+ <soapenv:Header/>
14
+ <soapenv:Body>
15
+ <ns:BookingNotification>
16
+ <!--Optional:-->
17
+ <ns:request>
18
+ <ns1:ChannelManagerUsername>' + Resonline.configuration.cm_username + '</ns1:ChannelManagerUsername>
19
+ <ns1:ChannelManagerPassword>' + Resonline.configuration.cm_password + '</ns1:ChannelManagerPassword>
20
+ <!--Optional:-->
21
+ <ns1:Username>' + Resonline.configuration.username + '</ns1:Username>
22
+ <!--Optional:-->
23
+ <ns1:Password>' + Resonline.configuration.password + '</ns1:Password>
24
+ <!--Optional:-->
25
+ <ns1:HotelId>' + Resonline.configuration.hotel_id.to_s + '</ns1:HotelId>
26
+ <!--Optional:-->
27
+ <ns1:HotelAuthenticationKey></ns1:HotelAuthenticationKey>
28
+ <dir:Booking>
29
+ <ns:BookingDetails>
30
+ <ns:Adults>' + options[:number_of_guests] + '</ns:Adults>
31
+ <ns:CheckIn>' + options[:checkin].try(:xmlschema) + '</ns:CheckIn>
32
+ <ns:CheckOut>' + options[:checkout].try(:xmlschema) + '</ns:CheckOut>
33
+ <ns:Children>' + options[:children] + '</ns:Children>
34
+ <!--Optional:-->
35
+ <ns:CurrencyISO>' + options[:currency] + '</ns:CurrencyISO>
36
+ <ns:Infants>' + options[:infants] + '</ns:Infants>
37
+ <!--Optional:-->
38
+ <ns:OwingAmount>' + options[:total_amount] +'</ns:OwingAmount>
39
+ <ns:PropertyId>' + Resonline.configuration.hotel_id.to_s + '</ns:PropertyId>
40
+ <ns:RoomCode>' + options[:room_code] + '</ns:RoomCode>
41
+ <!--Optional:-->
42
+ <ns:Quantity>' + options[:quantity] + '</ns:Quantity>
43
+ <!--Optional:-->
44
+ <ns:SpecialRequests>' + options[:special_request] + '</ns:SpecialRequests>
45
+ </ns:BookingDetails>
46
+ <!--Optional:-->
47
+ <ns:BookingRef>' + options[:booking_reference] + '</ns:BookingRef>
48
+ <!--Optional:-->
49
+ <ns:BookingType>' + options[:booking_type] + '</ns:BookingType>
50
+ <!--Optional:-->
51
+ <ns:CreditCardDetails>
52
+ <ns:ExpiryDate>' + options[:cc_expired].try(:xmlschema) + '</ns:ExpiryDate>
53
+ <ns:HolderFullName>' + options[:full_name] + '</ns:HolderFullName>
54
+ <ns:Number>' + options[:cc_number] + '</ns:Number>
55
+ <ns:VerificationNumber>' + options[:cc_verification_number] + '</ns:VerificationNumber>
56
+ </ns:CreditCardDetails>
57
+ <ns:MainGuest>
58
+ <ns:AddressFirstLine>' + options[:address_1] + '</ns:AddressFirstLine>
59
+ <!--Optional:-->
60
+ <ns:AddressSecondLine>' + options[:address_2] + '</ns:AddressSecondLine>
61
+ <ns:City>' + options[:city] + '</ns:City>
62
+ <ns:CountryIso>' + options[:country_iso] + '</ns:CountryIso>
63
+ <ns:Email>' + options[:email] + '</ns:Email>
64
+ <ns:FirstName>' + options[:first_name] + '</ns:FirstName>
65
+ <ns:LastName>' + options[:last_name] + '</ns:LastName>
66
+ <!--Optional:-->
67
+ <ns:Mobile>' + options[:mobile] + '</ns:Mobile>
68
+ <ns:Phone>' + options[:phone] + '</ns:Phone>
69
+ <ns:Postcode>' + options[:postcode] + '</ns:Postcode>
70
+ <ns:State>' + options[:state] + '</ns:State>
71
+ </ns:MainGuest>
72
+ </dir:Booking>
73
+ <dir:RequestType>API</dir:RequestType>
74
+ </ns:request>
75
+ </ns:BookingNotification>
76
+ </soapenv:Body>
77
+ </soapenv:Envelope>'
78
+ response = client.call(:booking_notification, xml: xml)
79
+ response.body[:booking_notification_response][:booking_notification_result][:response][:booking_response]
80
+ end
81
+ end
82
+ end
@@ -1,3 +1,3 @@
1
1
  module Resonline
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/resonline.gemspec CHANGED
@@ -6,8 +6,8 @@ require 'resonline/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "resonline"
8
8
  spec.version = Resonline::VERSION
9
- spec.authors = ["Rijaludin Muhsin"]
10
- spec.email = ["rijaludinmuhsin@gmail.com"]
9
+ spec.authors = ["Rijaludin Muhsin", "Lutvi Rosyady"]
10
+ spec.email = ["rijaludinmuhsin@gmail.com", "moorails@gmail.com"]
11
11
  spec.summary = %q{Ruby Helper for resonline SOAP}
12
12
  spec.description = %q{Ruby Helper for resonline SOAP}
13
13
  spec.homepage = ""
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resonline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rijaludin Muhsin
8
+ - Lutvi Rosyady
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-09-29 00:00:00.000000000 Z
12
+ date: 2015-06-04 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
@@ -41,6 +42,7 @@ dependencies:
41
42
  description: Ruby Helper for resonline SOAP
42
43
  email:
43
44
  - rijaludinmuhsin@gmail.com
45
+ - moorails@gmail.com
44
46
  executables: []
45
47
  extensions: []
46
48
  extra_rdoc_files: []
@@ -55,6 +57,7 @@ files:
55
57
  - lib/resonline/constants.rb
56
58
  - lib/resonline/error_messages.rb
57
59
  - lib/resonline/inventory.rb
60
+ - lib/resonline/notification.rb
58
61
  - lib/resonline/service.rb
59
62
  - lib/resonline/transformation.rb
60
63
  - lib/resonline/version.rb