Exemple #1
0
        public LeagueAPIServiceTests(ILeagueApiConfiguration configuration)
        {
            configuration = configuration ??
                            new LeagueApiConfiguration(string.Empty, RegionEnum.Euw, true, new FakeHttpRequestService());

            _leagueAPI = new LeagueApi(configuration);
        }
        public LeagueAPIServiceTests(ILeagueApiConfiguration configuration)
        {
            configuration = configuration ??
                            new LeagueApiConfiguration(ApiKey, RegionEnum.Euw, true, HttpRequestService);

            _leagueAPI = new LeagueApi(configuration);
        }
Exemple #3
0
        public LeagueAPIServiceTests(ILeagueApiConfiguration configuration)
        {
            configuration = configuration ??
                            new LeagueApiConfiguration(ApiKey, RegionEnum.Euw, true, HttpRequestService);

            _leagueAPI = new LeagueApi(configuration);
        }
Exemple #4
0
        protected BaseService(
            ILeagueApiConfiguration apiConfiguration,
            VersionEnum version,
            string prefix,
            bool isLimitedByRateLimit = true)
        {
            if (apiConfiguration == null)
            {
                throw new ArgumentNullException("apiConfiguration");
            }
            if (prefix == null)
            {
                throw new ArgumentNullException("prefix");
            }

            _apiConfiguration = apiConfiguration;

            _version = version;
            Prefix   = prefix;
            _isLimitedByRateLimit = isLimitedByRateLimit;

            if (!LastRequests.ContainsKey(_apiConfiguration.Key))
            {
                LastRequests[_apiConfiguration.Key] = new List <DateTime>();
            }

            AutoMapperService = new AutoMapperService(apiConfiguration);

            AutoMapperService.CreateMap <long, DateTime>()
            .ConvertUsing(x => new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds(x));
        }
Exemple #5
0
        public LeagueService(
            ILeagueApiConfiguration config)
            : base(config, VersionEnum.V2Rev4, "league")
        {
            Models.League.CreateMap(AutoMapperService);

#if DEBUG
            AutoMapperService.AssertConfigurationIsValid();
#endif
        }
Exemple #6
0
        public GameService(
            ILeagueApiConfiguration config)
            : base(config, VersionEnum.V1Rev3, "game")
        {
            Models.Game.CreateMap(AutoMapperService);

#if DEBUG
            AutoMapperService.AssertConfigurationIsValid();
#endif
        }
        public GameService(
            ILeagueApiConfiguration config)
            : base(config, VersionEnum.V1Rev3, "game")
        {
            Models.Game.CreateMap(AutoMapperService);

#if DEBUG
            AutoMapperService.AssertConfigurationIsValid();
#endif
        }
        public ChampionService(
            ILeagueApiConfiguration config)
            : base(config, VersionEnum.V1Rev2, "champion")
        {
            Models.Champion.CreateMap(AutoMapperService);

#if DEBUG
            AutoMapperService.AssertConfigurationIsValid();
#endif
        }
        public LeagueService(
            ILeagueApiConfiguration config)
            : base(config, VersionEnum.V2Rev5, "league")
        {
            Models.League.CreateMap(AutoMapperService);

#if DEBUG
            AutoMapperService.AssertConfigurationIsValid();
#endif
        }
        public TeamService(
            ILeagueApiConfiguration config)
            : base(config, VersionEnum.V2Rev4, "team")
        {
            Models.Team.CreateMap(AutoMapperService);

#if DEBUG
            AutoMapperService.AssertConfigurationIsValid();
#endif
        }
        public ChampionService(
            ILeagueApiConfiguration config)
            : base(config, VersionEnum.V1Rev2, "champion")
        {
            Models.Champion.CreateMap(AutoMapperService);

#if DEBUG
            AutoMapperService.AssertConfigurationIsValid();
#endif
        }
        public TeamService(
            ILeagueApiConfiguration config)
            : base(config, VersionEnum.V2Rev3, "team")
        {
            Models.Team.CreateMap(AutoMapperService);

#if DEBUG
            AutoMapperService.AssertConfigurationIsValid();
#endif
        }
        public LeagueApi(ILeagueApiConfiguration leagueApiConfiguration)
        {
            if (leagueApiConfiguration == null)
            {
                throw new ArgumentNullException("leagueApiConfiguration");
            }

            LeagueApiConfiguration = leagueApiConfiguration;

            Init();
        }
        public LeagueApi(ILeagueApiConfiguration leagueApiConfiguration)
        {
            if (leagueApiConfiguration == null)
            {
                throw new ArgumentNullException("leagueApiConfiguration");
            }

            LeagueApiConfiguration = leagueApiConfiguration;

            Init();
        }
        public StatsService(
            ILeagueApiConfiguration config)
            : base(config, VersionEnum.V1Rev3, "stats")
        {
            RankedStats.CreateMap(AutoMapperService);
            PlayerStatsSummary.CreateMap(AutoMapperService);

#if DEBUG
            AutoMapperService.AssertConfigurationIsValid();
#endif
        }
        public StatsService(
            ILeagueApiConfiguration config)
            : base(config, VersionEnum.V1Rev3, "stats")
        {
            RankedStats.CreateMap(AutoMapperService);
            PlayerStatsSummary.CreateMap(AutoMapperService);

#if DEBUG
            AutoMapperService.AssertConfigurationIsValid();
#endif
        }
        public SummonerService(
            ILeagueApiConfiguration config)
            : base(config, VersionEnum.V1Rev4, "summoner")
        {
            MasteryPage.CreateMap(AutoMapperService);
            RunePage.CreateMap(AutoMapperService);
            Models.Summoner.CreateMap(AutoMapperService);

#if DEBUG
            AutoMapperService.AssertConfigurationIsValid();
#endif
        }
        public SummonerService(
            ILeagueApiConfiguration config)
            : base(config, VersionEnum.V1Rev4, "summoner")
        {
            MasteryPage.CreateMap(AutoMapperService);
            RunePage.CreateMap(AutoMapperService);
            Models.Summoner.CreateMap(AutoMapperService);

#if DEBUG
            AutoMapperService.AssertConfigurationIsValid();
#endif
        }
        public StaticService(
            ILeagueApiConfiguration config)
            : base(config, VersionEnum.V1Rev2, "static-data", false)
        {
            ChampionList.CreateMap(AutoMapperService);
            ItemList.CreateMap(AutoMapperService);
            MasteryList.CreateMap(AutoMapperService);
            Realm.CreateMap(AutoMapperService);
            RuneList.CreateMap(AutoMapperService);
            SummonerSpellList.CreateMap(AutoMapperService);

#if DEBUG
            AutoMapperService.AssertConfigurationIsValid();
#endif
        }
        public LeagueApi(
            string apiKey,
            RegionEnum? region = null,
            bool waitToAvoidRateLimit = false,
            IHttpRequestService httpRequestService = null)
        {
            if (apiKey == null)
            {
                throw new ArgumentNullException("apiKey");
            }

            httpRequestService = httpRequestService ?? new HttpRequestService();

            LeagueApiConfiguration = new LeagueApiConfiguration(apiKey, region, waitToAvoidRateLimit, httpRequestService);

            Init();
        }
        public LeagueApi(
            string apiKey,
            RegionEnum?region         = null,
            bool waitToAvoidRateLimit = false,
            IHttpRequestService httpRequestService = null)
        {
            if (apiKey == null)
            {
                throw new ArgumentNullException("apiKey");
            }

            httpRequestService = httpRequestService ?? new HttpRequestService();

            LeagueApiConfiguration = new LeagueApiConfiguration(apiKey, region, waitToAvoidRateLimit, httpRequestService);

            Init();
        }
 internal AutoMapperService(ILeagueApiConfiguration apiConfiguration)
 {
     _configurationStore = new ConfigurationStore(new TypeMapFactory(), MapperRegistry.Mappers);
     _mappingEngine = new MappingEngine(_configurationStore);
     _apiConfiguration = apiConfiguration;
 }