コード例 #1
0
        /// <summary>
        /// Fiddler URL Dump
        ///
        /// http://api.ean.com/ean-services/rs/hotel/v3/info?hotelId=164989&options=HOTEL_IMAGES&apiKey=ty7wujrv6jc2vbrm2cpnmear&cid=55505&minorRev=20&currencyCode=GBP&locale=en_GB&customerUserAgent=Mozilla%2F5.0%20%28Windows%20NT%206.2%3B%20WOW64%29%20AppleWebKit%2F537.17%20%28KHTML%2C%20like%20Gecko%29%20Chrome%2F24.0.1312.57%20Safari%2F537.17&customerSessionId=0ABAA843-0682-2391-3CC2-CF6F03393718&customerIpAddress=%3A%3A1
        /// </summary>
        /// <param name="hotelInformationRequest"></param>
        /// <returns></returns>
        public override HotelInformationResponse GetHotelInformation(HotelInformationRequest hotelInformationRequest)
        {
            string           path             = PathFor("HotelInformationResponse.json");
            string           content          = Regex.Replace(File.ReadAllText(path), "");
            JsonDeserializer jsonDeserializer = new JsonDeserializer()
            {
                RootElement = "HotelInformationResponse"
            };
            HotelInformationResponse hotelInformationResponse = jsonDeserializer.Deserialize <HotelInformationResponse>(new RestResponse()
            {
                Content = content
            });

            return(hotelInformationResponse);
        }
コード例 #2
0
        public override HotelInformationResponse GetHotelInformation(HotelInformationRequest hotelInformationRequest)
        {
            Require.Argument("hotelInformationRequest", hotelInformationRequest); // Guard Clause

            var request = new RestRequest
            {
                Resource    = "info",
                Method      = Method.GET,
                RootElement = "HotelInformationResponse"
            };

            request.AddParameter("hotelId", hotelInformationRequest.HotelId);
            request.AddParameter("options", hotelInformationRequest.Options != null ? String.Join(",", hotelInformationRequest.Options) : "DEFAULT");

            return(Execute <HotelInformationResponse>(request));
        }
コード例 #3
0
        public HotelContentRS GetHotelInfo(HDSRequest request)
        {
            HotelInformationRequest hotelInfoRequest = new HotelInformationRequest();
            hotelInfoRequest = (HotelInformationRequest)commonHelper.GenerateBaseRequest(hotelInfoRequest, request);

            hotelInfoRequest.hotelId = (long)request.Hotels[0].Id;
            hotelInfoRequest.options = new hotelInfoOption[5];
            hotelInfoRequest.options[0] = new hotelInfoOption();
            hotelInfoRequest.options[0] = hotelInfoOption.HOTEL_DETAILS;        //hotel details
            hotelInfoRequest.options[1] = new hotelInfoOption();
            hotelInfoRequest.options[1] = hotelInfoOption.PROPERTY_AMENITIES;   //hotel amenities
            hotelInfoRequest.options[2] = new hotelInfoOption();
            hotelInfoRequest.options[2] = hotelInfoOption.HOTEL_IMAGES;         //hotel images
            hotelInfoRequest.options[3] = new hotelInfoOption();
            hotelInfoRequest.options[3] = hotelInfoOption.HOTEL_SUMMARY;        //hotel name and address
            hotelInfoRequest.options[4] = new hotelInfoOption();
            hotelInfoRequest.options[4] = hotelInfoOption.ROOM_TYPES;           //room info

                //submit soap request to expedia
            HotelInformationResponse hotelInfoResponse;
            try
            {
                serviceObjShop = new Expedia.HotelShoppingServiceReference.HotelServicesClient();
                hotelInfoResponse = serviceObjShop.getInformation(hotelInfoRequest);
            }
            catch (Exception e1)
            {
                HotelContentRS error = new HotelContentRS();
                error.Errors = new List<WarningAndError>();
                error.Errors.Add(new WarningAndError { Id = 9003, Message = "Error return from provider", DetailDescription = e1.ToString() });
                return error;
            }

            //do hotel content object mapping
            try
            {
                return objMapping.MappingHotelInfo(hotelInfoResponse);
            }
            catch(Exception e2)
            {
                HotelContentRS error = new HotelContentRS();
                error.Errors = new List<WarningAndError>();
                error.Errors.Add(new WarningAndError { Id = 9150, Message = "Hotel Conent mapping exception", DetailDescription = e2.ToString() });
                return error;
            }
        }
コード例 #4
0
 public abstract HotelInformationResponse GetHotelInformation(HotelInformationRequest hotelInformationRequest);