Skip to content

Commit

Permalink
Support for Places feed and updated dataset site model (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
openactive-bot authored Jul 2, 2022
1 parent 7303778 commit 0cbe702
Show file tree
Hide file tree
Showing 12 changed files with 183 additions and 30 deletions.
2 changes: 1 addition & 1 deletion OpenActive.NET.Test/EventTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public void RootTypeMismatchError()
public void ToString_EventAccessor()
{
output.WriteLine(this.@event.ToString());
Assert.Equal("Santa Clara City Library, Central Park Library", this.@event.Location.Name);
Assert.Equal("Santa Clara City Library, Central Park Library", this.@event.Location.Object.Name);
}

[Fact]
Expand Down
6 changes: 3 additions & 3 deletions OpenActive.NET.Test/RPDEGenericsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public RPDEGenericsTest(ITestOutputHelper output)
private static readonly SessionSeries @event = new OpenActive.NET.SessionSeries()
{
Name = "Virtual BODYPUMP",
Description = "This is the virtual version of the original barbell class, which will help you get lean, toned and fit - fast. Les Mills™ Virtual classes are designed for people who cannot get access to our live classes or who want to get a ‘taste’ of a Les Mills™ class before taking a live class with an instructor. The classes are played on a big video screen, with dimmed lighting and pumping surround sound, and are led onscreen by the people who actually choreograph the classes.",
Description = "This is the virtual version of the original barbell class, which will help you get lean, toned and fit - fast. Les Mills™ Virtual classes are designed for people who cannot get access to our live classes or who want to get a ‘taste’ of a Les Mills™ class before taking a live class with an instructor. The classes are played on a big video screen, with dimmed lighting and pumping surround sound, and are led onscreen by the people who actually choreograph the classes.",
Duration = TimeSpan.FromDays(1),
StartDate = new DateTimeOffset(2017, 4, 24, 19, 30, 0, TimeSpan.FromHours(-8)),
Location = new Place()
Expand Down Expand Up @@ -206,13 +206,13 @@ public RPDEGenericsTest(ITestOutputHelper output)
};

private readonly string jsonRpde =
"{\"next\":\"https://www.example.com/feed?afterTimestamp=5&afterId=1\",\"items\":[{\"state\":\"updated\",\"kind\":\"SessionSeries\",\"id\":\"2\",\"modified\":4,\"data\":{\"@context\":\"https://openactive.io/\",\"@type\":\"SessionSeries\",\"name\":\"Virtual BODYPUMP\",\"description\":\"This is the virtual version of the original barbell class, which will help you get lean, toned and fit - fast. Les Mills™ Virtual classes are designed for people who cannot get access to our live classes or who want to get a ‘taste’ of a Les Mills™ class before taking a live class with an instructor. The classes are played on a big video screen, with dimmed lighting and pumping surround sound, and are led onscreen by the people who actually choreograph the classes.\",\"attendeeInstructions\":\"Ensure you bring trainers and a bottle of water.\",\"duration\":\"P1D\",\"image\":[{\"@type\":\"ImageObject\",\"url\":\"http://www.example.com/event_image/12345\"}],\"location\":{\"@type\":\"Place\",\"name\":\"Santa Clara City Library, Central Park Library\",\"address\":{\"@type\":\"PostalAddress\",\"addressCountry\":\"US\",\"addressLocality\":\"Santa Clara\",\"addressRegion\":\"CA\",\"postalCode\":\"95051\",\"streetAddress\":\"2635 Homestead Rd\"}},\"offers\":[{\"@type\":\"Offer\",\"price\":30.0,\"priceCurrency\":\"USD\",\"url\":\"https://www.example.com/event_offer/12345_201803180430\",\"validFrom\":\"2017-01-20T16:20:00-08:00\"}],\"startDate\":\"2017-04-24T19:30:00-08:00\",\"endDate\":\"2017-04-24T23:00:00-08:00\"}},{\"state\":\"deleted\",\"kind\":\"SessionSeries\",\"id\":\"1\",\"modified\":5}],\"license\":\"https://creativecommons.org/licenses/by/4.0/\"}";
"{\"next\":\"https://www.example.com/feed?afterTimestamp=5&afterId=1\",\"items\":[{\"state\":\"updated\",\"kind\":\"SessionSeries\",\"id\":\"2\",\"modified\":4,\"data\":{\"@context\":\"https://openactive.io/\",\"@type\":\"SessionSeries\",\"name\":\"Virtual BODYPUMP\",\"description\":\"This is the virtual version of the original barbell class, which will help you get lean, toned and fit - fast. Les Mills™ Virtual classes are designed for people who cannot get access to our live classes or who want to get a ‘taste’ of a Les Mills™ class before taking a live class with an instructor. The classes are played on a big video screen, with dimmed lighting and pumping surround sound, and are led onscreen by the people who actually choreograph the classes.\",\"attendeeInstructions\":\"Ensure you bring trainers and a bottle of water.\",\"duration\":\"P1D\",\"image\":[{\"@type\":\"ImageObject\",\"url\":\"http://www.example.com/event_image/12345\"}],\"location\":{\"@type\":\"Place\",\"name\":\"Santa Clara City Library, Central Park Library\",\"address\":{\"@type\":\"PostalAddress\",\"addressCountry\":\"US\",\"addressLocality\":\"Santa Clara\",\"addressRegion\":\"CA\",\"postalCode\":\"95051\",\"streetAddress\":\"2635 Homestead Rd\"}},\"offers\":[{\"@type\":\"Offer\",\"price\":30.0,\"priceCurrency\":\"USD\",\"url\":\"https://www.example.com/event_offer/12345_201803180430\",\"validFrom\":\"2017-01-20T16:20:00-08:00\"}],\"startDate\":\"2017-04-24T19:30:00-08:00\",\"endDate\":\"2017-04-24T23:00:00-08:00\"}},{\"state\":\"deleted\",\"kind\":\"SessionSeries\",\"id\":\"1\",\"modified\":5}],\"license\":\"https://creativecommons.org/licenses/by/4.0/\"}";

private readonly string jsonRpdeEveryoneActive =
"{\"next\":\"https://opendata.leisurecloud.live/api/feeds/EveryoneActive-test-session-series?afterTimestamp=28577192&afterId=1217CRP17000217\",\"items\":[{\"state\":\"updated\",\"kind\":\"SessionSeries\",\"id\" :\"1502CMX20000216\",\"modified\":15529138,\"data\":{\"@context\":[\"https://openactive.io/\",\"https://openactive.io/ns-beta\"],\"type\":\"SessionSeries\",\"id\":\"https://tst.myeveryoneactive.com/OpenActive/api/session-series/2011CAQ15150119\",\"eventSchedule\":[{\"type\":\"PartialSchedule\",\"byDay\":[\"http://schema.org/Monday\"],\"duration\":\"PT45M\",\"endTime\":\"16:00\",\"startDate\":\"2019-04-01\",\"endDate\":\"2022-12-31\",\"startTime\":\"15:15\",\"beta:timeZone\":\"Europe/London\"}],\"identifier\":\"2011CAQ15150119\",\"name\":\"Active Aqua Mon 15:15\",\"category\":[\"Group Exercise 16+ Yrs\"],\"duration\":\"PT45M\",\"location\":{\"type\":\"Place\",\"identifier\":\"0201\",\"name\":\"Wythenshawe Forum Leisure\",\"address\":{\"type\":\"PostalAddress\",\"addressCountry\":\"GB\",\"addressLocality\":\"Wythenshawe\",\"addressRegion\":\"Manchester\",\"postalCode\":\"M22 5RX\",\"streetAddress\":\"Forum Square\"},\"amenityFeature\":[{\"type\":\"ChangingFacilities\",\"name\":\"Changing Facilities\",\"value\":true},{\"type\":\"Showers\",\"name\":\"Showers\",\"value\":true},{\"type\":\"Toilets\",\"name\":\"Toilets\",\"value\":true},{\"type\":\"Lockers\",\"name\":\"Lockers\",\"value\":true},{\"type\":\"Towels\",\"name\":\"Towels\",\"value\":false},{\"type\":\"Creche\",\"name\":\"Creche\",\"value\":false},{\"type\":\"Parking\",\"name\":\"Parking\",\"value\":false},{\"type\":\"BabyChanging\",\"name\":\"Baby Changing\",\"value\":true},{\"type\":\"beta:Cafe\",\"name\":\"Cafe\",\"value\":false},{\"type\":\"beta:Bar\",\"name\":\"Bar\",\"value\":false}],\"geo\":{\"type\":\"GeoCoordinates\",\"latitude\":53.380323,\"longitude\":-2.265142},\"telephone\":\"0161 935 4020\",\"url\":\"https://www-everyoneactive-dev.mediablazegroup.com/centre/wythenshawe-forum/\",\"beta:formattedDescription\":\"<p><br></p>\"},\"offers\":[{\"type\":\"Offer\",\"identifier\":\"STAND\",\"name\":\"Adult\",\"description\":\"Grp Ex - Aqua\",\"acceptedPaymentMethod\":[\"http://purl.org/goodrelations/v1#Cash\",\"http://purl.org/goodrelations/v1#PaymentMethodCreditCard\"],\"price\":1.0,\"priceCurrency\":\"GBP\"}],\"superEvent\":{\"type\":\"EventSeries\",\"identifier\":93,\"name\":\"Aqua Aerobics\",\"description\":\"A dedicated instructor led session for pregnant women or new mums only that provides an invigorating and safe all-over body work-out in the water with minimal impact.\",\"activity\":[{\"type\":\"Concept\",\"id\":\"https://openactive.io/activity-list#6e31262b-ce37-4fc7-b3e3-d827ac5e8b42\",\"inScheme\":\"https://openactive.io/activity-list\",\"prefLabel\":\"aqua_aerobics\"}],\"ageRange\":{\"type\":\"QuantitativeValue\",\"maxValue\":100,\"minValue\":16},\"isCoached\":true,\"organizer\":{\"type\":\"Organization\",\"name\":\"EveryoneActive\",\"legalName\":\"EveryoneActive\"}}}}],\"license\":\"https://creativecommons.org/licenses/by/4.0/\"}";

private readonly string jsonRpdeSlotEveryoneActive =
"{\"next\":\"https://opendata.leisurecloud.live/api/feeds/EveryoneActive-test-slots?afterTimestamp=2564761380&afterId=162OUTDOOR10_2020-03-04T18-30-00\",\"items\":[{\"state\":\"updated\",\"kind\":\"FacilityUse/Slot\",\"id\" :\"161ASTRO001_2020-03-04T16-00-00\",\"modified\":2564739554,\"data\":{\"@context\":[\"https://openactive.io/\",\"https://openactive.io/ns-beta\"],\"type\":\"Slot\",\"id\":\"https://tst.myeveryoneactive.com/OpenActive/api/slots/161ASTRO001_2020-03-04T16-00-00\",\"identifier\":\"161ASTRO001_2020-03-04T16-00-00\",\"duration\":\"PT1H\",\"facilityUse\":\"https://tst.myeveryoneactive.com/OpenActive/api/facility-uses/161ASTRO001\",\"maximumUses\":1,\"offers\":[{\"type\":\"Offer\",\"price\":169.3,\"priceCurrency\":\"GBP\"}],\"remainingUses\":1,\"startDate\":\"2020-03-04T16:00:00+00:00\",\"endDate\":\"2020-03-04T17:00:00+00:00\",\"beta:sportsActivityLocation\":[{\"type\":\"SportsActivityLocation\",\"name\":[\"Burgess Park Astroturf 1\",\"Burgess Park Astroturf 2\",\"Burgess Park Astroturf 3\"],\"identifier\":[\"161ZOUA001\",\"161ZOUA002\",\"161ZOUA003\"]}]}}],\"license\":\"https://creativecommons.org/licenses/by/4.0/\"}";
"{\"next\":\"https://opendata.leisurecloud.live/api/feeds/EveryoneActive-test-slots?afterTimestamp=2564761380&afterId=162OUTDOOR10_2020-03-04T18-30-00\",\"items\":[{\"state\":\"updated\",\"kind\":\"FacilityUse/Slot\",\"id\" :\"161ASTRO001_2020-03-04T16-00-00\",\"modified\":2564739554,\"data\":{\"@context\":[\"https://openactive.io/\",\"https://openactive.io/ns-beta\"],\"type\":\"Slot\",\"id\":\"https://tst.myeveryoneactive.com/OpenActive/api/slots/161ASTRO001_2020-03-04T16-00-00\",\"identifier\":\"161ASTRO001_2020-03-04T16-00-00\",\"duration\":\"PT1H\",\"facilityUse\":\"https://tst.myeveryoneactive.com/OpenActive/api/facility-uses/161ASTRO001\",\"maximumUses\":1,\"offers\":[{\"type\":\"Offer\",\"price\":169.3,\"priceCurrency\":\"GBP\"}],\"remainingUses\":1,\"startDate\":\"2020-03-04T16:00:00+00:00\",\"endDate\":\"2020-03-04T17:00:00+00:00\",\"beta:sportsActivityLocation\":[{\"type\":\"SportsActivityLocation\",\"name\":\"Burgess Park Astroturf 1\",\"identifier\":\"161ZOUA001\"}]}}],\"license\":\"https://creativecommons.org/licenses/by/4.0/\"}";

[Fact]
public void ToString_EventGoogleStructuredData_ReturnsExpectedJsonLd()
Expand Down
2 changes: 2 additions & 0 deletions OpenActive.NET/enums/PropertyEnumeration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public enum PropertyEnumeration
EligibleEntitlementType,
[EnumMember(Value = "https://openactive.io/emergencyContact")]
EmergencyContact,
[EnumMember(Value = "https://openactive.io/endpointUrl")]
EndpointUrl,
[EnumMember(Value = "https://openactive.io/entitlement")]
Entitlement,
[EnumMember(Value = "https://openactive.io/entitlementType")]
Expand Down
13 changes: 10 additions & 3 deletions OpenActive.NET/models/BookingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,31 @@ public override string ToString()
[JsonConverter(typeof(ValuesConverter))]
public new virtual string Name { get; set; }

/// <summary>
/// A human and machine-readable certification file that asserts the service's conformance to established standards. The value of this property should be a URL that resolves to a valid and up-to-date OpenActive Test Suite Conformance Certificate for this implementation. Note this property is in EARLY RELEASE AND IS SUBJECT TO CHANGE, as the [Dataset API Discovery specification](https://openactive.io/dataset-api-discovery/EditorsDraft/) evolves.
/// </summary>
[DataMember(Name = "hasCredential", EmitDefaultValue = false, Order = 8)]
[JsonConverter(typeof(ValuesConverter))]
public virtual Uri HasCredential { get; set; }

/// <summary>
/// The version of the application, useful for on-premise installations. Note this property is in EARLY RELEASE AND IS SUBJECT TO CHANGE, as the [Dataset API Discovery specification](https://openactive.io/dataset-api-discovery/EditorsDraft/) evolves.
/// </summary>
[DataMember(Name = "softwareVersion", EmitDefaultValue = false, Order = 8)]
[DataMember(Name = "softwareVersion", EmitDefaultValue = false, Order = 9)]
[JsonConverter(typeof(ValuesConverter))]
public new virtual string SoftwareVersion { get; set; }

/// <summary>
/// The terms of service of the Booking System.
/// </summary>
[DataMember(Name = "termsOfService", EmitDefaultValue = false, Order = 9)]
[DataMember(Name = "termsOfService", EmitDefaultValue = false, Order = 10)]
[JsonConverter(typeof(ValuesConverter))]
public virtual List<Terms> TermsOfService { get; set; }

/// <summary>
/// The URL of the website of the Booking System.
/// </summary>
[DataMember(Name = "url", EmitDefaultValue = false, Order = 10)]
[DataMember(Name = "url", EmitDefaultValue = false, Order = 11)]
[JsonConverter(typeof(ValuesConverter))]
public new virtual Uri Url { get; set; }
}
Expand Down
4 changes: 2 additions & 2 deletions OpenActive.NET/models/Event.cs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ public override string ToString()
/// </example>
[DataMember(Name = "location", EmitDefaultValue = false, Order = 30)]
[JsonConverter(typeof(ValuesConverter))]
public new virtual Place Location { get; set; }
public new virtual ReferenceValue<Place> Location { get; set; }

/// <summary>
/// The maximum capacity of the Event.
Expand Down Expand Up @@ -657,7 +657,7 @@ public override string ToString()
/// </summary>
[DataMember(Name = "beta:sportsActivityLocation", EmitDefaultValue = false, Order = 1051)]
[JsonConverter(typeof(ValuesConverter))]
public virtual List<Schema.NET.SportsActivityLocation> SportsActivityLocation { get; set; }
public virtual List<SportsActivityLocation> SportsActivityLocation { get; set; }

/// <summary>
/// [NOTICE: This is a beta property, and is highly likely to change in future versions of this library.]
Expand Down
4 changes: 2 additions & 2 deletions OpenActive.NET/models/FacilityUse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ public override string ToString()
/// </example>
[DataMember(Name = "location", EmitDefaultValue = false, Order = 23)]
[JsonConverter(typeof(ValuesConverter))]
public new virtual Place Location { get; set; }
public new virtual ReferenceValue<Place> Location { get; set; }

/// <summary>
/// An array of schema:Offer that include the price of booking.
Expand Down Expand Up @@ -408,7 +408,7 @@ public override string ToString()
/// </summary>
[DataMember(Name = "beta:sportsActivityLocation", EmitDefaultValue = false, Order = 1030)]
[JsonConverter(typeof(ValuesConverter))]
public virtual List<Schema.NET.SportsActivityLocation> SportsActivityLocation { get; set; }
public virtual List<SportsActivityLocation> SportsActivityLocation { get; set; }

/// <summary>
/// [NOTICE: This is a beta property, and is highly likely to change in future versions of this library.]
Expand Down
2 changes: 1 addition & 1 deletion OpenActive.NET/models/OnDemandEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public override string ToString()
public override Schema.NET.EventStatusType? EventStatus { get; set; }

[Obsolete("This property is disinherited in this type, and must not be used.", true)]
public override Place Location { get; set; }
public override ReferenceValue<Place> Location { get; set; }

[Obsolete("This property is disinherited in this type, and must not be used.", true)]
public override long? MaximumAttendeeCapacity { get; set; }
Expand Down
Loading

0 comments on commit 0cbe702

Please sign in to comment.