static async Task Main(string[] args) { var configService = new EnvironmentConfigService(); var apiKey = configService.Get("GOOGLE_API_KEY"); var sheetId = configService.Get("COMMUNITY_SHEET_ID"); var outputPath = configService.Get("OUTPUT_PATH"); var getSheeetServices = new List <string> { "Housewares", "Miscellaneous", "Wall-mounted", "Wallpaper", "Floors", "Rugs", "Photos", "Posters", "Art", "Fossils", "Music", }.Select(_ => (IGetSheetService)GetSheetService.Default(apiKey, sheetId, _)).ToList(); var service = new CommunitySheetIngestService(getSheeetServices); var result = await service.Ingest(); await File.WriteAllTextAsync(outputPath, JsonSerializer.Serialize(result)); }
public async Task NullVariantItem() { var mock = SetupGetSheetService(new List <IList <object> > { new List <object> { "Internal ID", "Name", "Catalog", "Source", "Image" }, new List <object> { "5036", "aqua tile flooring", "For sale", "Nook's Cranny", @"=IMAGE(""https://acnhcdn.com/latest/FtrIcon/RoomTexFloorTile01.png"")" }, }); var service = new CommunitySheetIngestService(new List <IGetSheetService> { mock.Object }); var actual = await service.Ingest(); actual.Should().HaveCount(1); actual.Should().Contain(new Item( ItemId.From("5036"), ItemName.From("aqua tile flooring"), CatalogueStatus.FOR_SALE, Source.NOOKS_CRANNY, Image.From("https://acnhcdn.com/latest/FtrIcon/RoomTexFloorTile01.png"), null )); }
public async Task VariantItem() { var mock = SetupGetSheetService(new List <IList <object> > { new List <object> { "Internal ID", "Name", "Catalog", "Source", "Image", "Variant ID", "Variation" }, new List <object> { "3821", "air circulator", "For sale", "Nook's Cranny", @"=IMAGE(""https://acnhcdn.com/latest/FtrIcon/FtrCirculator_Remake_2_0.png"")", "2_0", "Pink" }, }); var service = new CommunitySheetIngestService(new List <IGetSheetService> { mock.Object }); var actual = await service.Ingest(); actual.Should().HaveCount(1); actual.Should().Contain(new Item( ItemId.From("3821"), ItemName.From("air circulator"), CatalogueStatus.FOR_SALE, Source.NOOKS_CRANNY, Image.From("https://acnhcdn.com/latest/FtrIcon/FtrCirculator_Remake_2_0.png"), new ItemVariant( ItemVariantId.From("2_0"), ItemVariantName.From("Pink") ) )); }
public async Task AlbumImage() { var mock = SetupGetSheetService(new List <IList <object> > { new List <object> { "Internal ID", "Name", "Catalog", "Source", "Album Image" }, new List <object> { "3200", "K.K. Fusion", "For sale", "K.K. concert; Nook Shopping Catalog", @"=IMAGE(""https://acnhcdn.com/latest/Audio/mjk_Fusion.png"")" }, }); var service = new CommunitySheetIngestService(new List <IGetSheetService> { mock.Object }); var actual = await service.Ingest(); actual.Should().HaveCount(1); actual.Should().Contain(new Item( ItemId.From("3200"), ItemName.From("K.K. Fusion"), CatalogueStatus.FOR_SALE, Source.UNKNOWN, Image.From("https://acnhcdn.com/latest/Audio/mjk_Fusion.png"), null )); }
public async Task NonVariantItem() { var mock = SetupGetSheetService(new List <IList <object> > { new List <object> { "Internal ID", "Name", "Catalog", "Source", "Image", "Variant ID", "Variantion" }, new List <object> { "1317", "anatomical model", "For sale", "Nook's Cranny", @"=IMAGE(""https://acnhcdn.com/latest/FtrIcon/FtrAnatomicalmodel.png"")", "NA", "NA" }, }); var service = new CommunitySheetIngestService(new List <IGetSheetService> { mock.Object }); var actual = await service.Ingest(); actual.Should().HaveCount(1); actual.Should().Contain(new Item( ItemId.From("1317"), ItemName.From("anatomical model"), CatalogueStatus.FOR_SALE, Source.NOOKS_CRANNY, Image.From("https://acnhcdn.com/latest/FtrIcon/FtrAnatomicalmodel.png"), null )); }
public async Task KnownSource(string input, Source output) { var mock = SetupGetSheetService(new List <IList <object> > { new List <object> { "Internal ID", "Name", "Catalog", "Source", "Image", "Variant ID", "Variation" }, new List <object> { "3821", "air circulator", "For sale", input, @"=IMAGE(""https://acnhcdn.com/latest/FtrIcon/FtrCirculator_Remake_2_0.png"")", "2_0", "Pink" }, }); var service = new CommunitySheetIngestService(new List <IGetSheetService> { mock.Object }); var actual = await service.Ingest(); actual.Should().ContainSingle(_ => _.Source == output); }