/// <summary> /// Handler for Dataset Site endpoint /// </summary> /// <returns></returns> public ResponseContent RenderDatasetSite() { if (datasetSettings == null || supportedFeeds == null) { throw new NotSupportedException("RenderDatasetSite is only supported if DatasetSiteGeneratorSettings are supplied to the IBookingEngine"); } // TODO add caching layer in front of dataset site rendering return(ResponseContent.HtmlResponse(DatasetSiteGenerator.RenderSimpleDatasetSite(datasetSettings, supportedFeeds))); }
public void SettingsContainedInRenderedPage() { // Customer-specific settings for dataset JSON (these should come from a database) var settings = new DatasetSiteGeneratorSettings { OpenDataFeedBaseUrl = "https://customer.example.com/feed".ParseUrlOrNull(), OpenBookingAPIBaseUrl = "https://customer.example.com/api/openbooking".ParseUrlOrNull(), OpenBookingAPIAuthenticationAuthority = "https://auth.acmebooker.example.com".ParseUrlOrNull(), DatasetSiteUrl = "https://halo-odi.legendonlineservices.co.uk/openactive/".ParseUrlOrNull(), DatasetDiscussionUrl = "https://github.com/gll-better/opendata".ParseUrlOrNull(), DatasetDocumentationUrl = "https://docs.acmebooker.example.com/".ParseUrlOrNull(), DatasetLanguages = new List <string> { "en-GB" }, OrganisationName = "Better", OrganisationUrl = "https://www.better.org.uk/".ParseUrlOrNull(), OrganisationLegalEntity = "GLL", OrganisationPlainTextDescription = "Established in 1993, GLL is the largest UK-based charitable social enterprise delivering leisure, health and community services. Under the consumer facing brand Better, we operate 258 public Sports and Leisure facilities, 88 libraries, 10 children’s centres and 5 adventure playgrounds in partnership with 50 local councils, public agencies and sporting organisations. Better leisure facilities enjoy 46 million visitors a year and have more than 650,000 members.", OrganisationLogoUrl = "http://data.better.org.uk/images/logo.png".ParseUrlOrNull(), OrganisationEmail = "*****@*****.**", PlatformName = "AcmeBooker", PlatformUrl = "https://acmebooker.example.com/".ParseUrlOrNull(), PlatformVersion = "2.0", BackgroundImageUrl = "https://data.better.org.uk/images/bg.jpg".ParseUrlOrNull(), DateFirstPublished = new DateTimeOffset(new DateTime(2019, 01, 14)) }; var supportedFeeds = new List <OpportunityType> { OpportunityType.SessionSeries, OpportunityType.ScheduledSession, OpportunityType.FacilityUse, OpportunityType.FacilityUseSlot, OpportunityType.CourseInstance }; var html = DatasetSiteGenerator.RenderSimpleDatasetSite(settings, supportedFeeds); output.WriteLine(html); Assert.Contains(settings.OrganisationPlainTextDescription, html); }