Beispiel #1
0
        private ApiV3LegacyDataTypeResolver()
        {
            var apiClient = ApiClientFactory.Create(BuffettCodeApiVersion.Version3, Configuration.GetInstance().ApiKey);

            var parser = ApiResponseParserFactory.Create(BuffettCodeApiVersion.Version3);

            // 適当にAPI をたたいて description を取得する
            var quarter = parser.Parse(
                DataTypeConfig.Quarter,
                apiClient.Get(DataTypeConfig.Quarter, quarterParameter, false, false, true)
                );
            var daily = parser.Parse(
                DataTypeConfig.Daily,
                apiClient.Get(DataTypeConfig.Daily, dayParameter, false, false, true)
                );

            // quarter を優先で map を作る
            foreach (string name in quarter.GetPropertyNames())
            {
                mappingTable[name] = DataTypeConfig.Quarter;
            }

            foreach (string name in daily.GetPropertyNames().Where(name => !mappingTable.ContainsKey(name)))
            {
                mappingTable[name] = DataTypeConfig.Daily;
            }
        }
Beispiel #2
0
        public BuffettCodeApiTaskProcessor(BuffettCodeApiVersion version)
        {
            client = ApiClientFactory.Create(version, config.ApiKey);
            parser = ApiResponseParserFactory.Create(version);
            var tierResolver = PeriodSupportedTierResolver.Create(client, parser);

            taskHelper = new ApiTaskHelper(tierResolver);
        }
 public void CreateTest()
 {
     Assert.IsInstanceOfType(ApiResponseParserFactory.Create(BuffettCodeApiVersion.Version2), typeof(ApiV2ResponseParser));
     Assert.IsInstanceOfType(ApiResponseParserFactory.Create(BuffettCodeApiVersion.Version3), typeof(ApiV3ResponseParser));
 }