require 'uri' require 'net/http' #### Specify the url according the Environment ###### my_url='http://staging.cleartrip.com/hotels/service/getRateRules’ ###### Enter the Hotel deatils in the XML file to get the Rate Rule####### data = File.read('RateruleRequest.xml') url = URI.parse(my_url) post = Net::HTTP::Post.new(url.path) post.body = data post['Content-Type'] = 'text/xml' ####### Enter the API Key here ########## post['X-CT-API-KEY'] = '{Enter your API – KEY}' response = Net::HTTP.start(url.host, url.port) do |http| #####Comment the line if basic Authentication not required###### post.basic_auth(‘{user name}’, ‘{password}') http.request(post) end puts response.inspect puts response.body