Esempio n. 1
0
 public HrNewsWebApiService(HrNewsClientSettings settings)
 {
     client             = new HttpClient();
     client.BaseAddress = new Uri(settings.HrNewsApiUrl);
     client.DefaultRequestHeaders.Accept.Clear();
     client.DefaultRequestHeaders.Accept.Add(
         new MediaTypeWithQualityHeaderValue("application/json"));
 }
Esempio n. 2
0
        public static HrNewsClientSettings Build(IConfiguration configuration)
        {
            var hrSettings = new HrNewsClientSettings
            {
                WebApi        = configuration.GetSection("HrNewClientSettings")["WebApi"],
                WebApiVersion = configuration.GetSection("HrNewClientSettings")["WebApiVersion"],
                MaxTakeItem   = Convert.ToInt32(configuration.GetSection("HrNewClientSettings")["MaxTakeItem"])
            };

            return(hrSettings);
        }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Host"/> class.
 /// </summary>
 /// <param name="service">
 /// HrNewsWebApiService used to retrieve HR news web API.
 /// </param>
 /// <param name="repo">
 /// HrNewsRepository used to store data into the Azure Table.
 /// </param>
 /// <param name="settings">
 /// HrNewsClientSettings used to supply limit of items to
 /// process per cycle.
 /// </param>
 public Host(IHrNewsWebApiService service, IHrNewsRepository repo, HrNewsClientSettings settings)
 {
     _service  = service;
     _repo     = repo;
     _settings = settings;
 }