public RequestExecutionEngine(IRestfulService restService,
                               AgentIdentifier identifier, IRequestVisitor <string> endpointCreator, IRequestVisitor <string> headerTokenCreator,
                               IRequestVisitor <Dictionary <HttpStatusCode, LevelUpRestWrapper.ResponseAction> > customHttpStatusCodeHandlers)
 {
     _restWrapper                  = new LevelUpRestWrapper(restService, identifier);
     _endpointCreator              = endpointCreator;
     _headerTokenCreator           = headerTokenCreator;
     _customHttpStatusCodeHandlers = customHttpStatusCodeHandlers;
 }
 public LevelUpRestWrapper(IRestfulService restService, AgentIdentifier identifier)
 {
     RestService = restService;
     Identifier  = identifier;
 }
Example #3
0
        /// <summary>
        /// For Unit Testing, allowing mocking of the LevelUpHttpRestfulService.  Note
        /// that the AssemblyInfo.cs file enables internals to be visible to the unit
        /// test project.
        /// </summary>
        internal static T Create <T>(AgentIdentifier identifier, LevelUpEnvironment enviornment, IRestfulService restService)
            where T : ILevelUpClientModule
        {
            var client = new LevelUpClient(GetDefaultLevelUpRequestEngine(identifier, enviornment, restService));

            return((T)(object)client);
        }
Example #4
0
        /// <summary>
        /// Creates an IRequestVisitor<IResponse> (i.e. the "request execution engine") using the default
        /// implementation for each of the requisite visitors.  Unless a 3rd-party client wants to override
        /// a particular visitor (in order to modify the way that the SDK creates and interperates calls
        /// to the LevelUp api) for some reason, these defaults are what should be used in the creation of
        /// the LevelUpClient implementation class.
        /// </summary>
        private static IRequestVisitor <IResponse> GetDefaultLevelUpRequestEngine(AgentIdentifier identifier,
                                                                                  LevelUpEnvironment enviornment, IRestfulService httpRestService)
        {
            IRequestVisitor <string> endpointCreator = new RequestEndpointCreator(enviornment);

            IRequestVisitor <string> headerAuthorizationTokenCreator = new RequestHeaderTokenCreator();

            IRequestVisitor <Dictionary <HttpStatusCode, LevelUpRestWrapper.ResponseAction> > customHttpStatusCodeHandlers
                = new AdditionalHttpStatusCodeHandlers();

            IRequestVisitor <IResponse> requestExecutionEngine = new RequestExecutionEngine(httpRestService, identifier,
                                                                                            endpointCreator, headerAuthorizationTokenCreator, customHttpStatusCodeHandlers);

            return(requestExecutionEngine);
        }
Example #5
0
 internal LevelUpClient(IRestfulService restService, AgentIdentifier identifier, LevelUpEnvironment targetEnviornment)
 {
     _restWrapper       = new LevelUpRestWrapper(restService, identifier);
     _targetEnviornment = targetEnviornment;
 }
Example #6
0
 public Browser()
 {
     _proxy = new ForwardProxyServer();
 }