ngsildclient.model.helper.openinghours#

Classes

OpeningHoursBuilder()

A helper class that allows to easily build an openingHours property.

OpeningHoursSpecification(opens, closes, ...)

An OpeningHoursSpecification as described here : https://schema.org/OpeningHoursSpecification

WeekDay(value)

An enumeration.

class ngsildclient.model.helper.openinghours.OpeningHoursBuilder[source]#

Bases: object

A helper class that allows to easily build an openingHours property.

Simplified. Support a single open timeslot per day.

Example

>>> from ngsildclient import *
>>> builder = OpeningHoursBuilder()
>>> openinghours = builder.businessdays("10:00", "17:30").saturday("10:00", "14:00").build()
>>> # Add an openingHours property to the entity you're creating
>>> library = Entity("Library", "MyLibrary")
>>> library.prop("openingHours", openinghours)
>>> library.pprint()
{
    "@context": [
        "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld"
    ],
    "id": "urn:ngsi-ld:Library:MyLibrary",
    "type": "Library",
    "openingHours": {
        "type": "Property",
        "value": [
        {
            "opens": "10:00",
            "closes": "17:30",
            "dayOfWeek": "Monday"
        },
        {
            "opens": "10:00",
            "closes": "17:30",
            "dayOfWeek": "Tuesday"
        },
        {
            "opens": "10:00",
            "closes": "17:30",
            "dayOfWeek": "Wednesday"
        },
        {
            "opens": "10:00",
            "closes": "17:30",
            "dayOfWeek": "Thursday"
        },
        {
            "opens": "10:00",
            "closes": "17:30",
            "dayOfWeek": "Friday"
        },
        {
            "opens": "10:00",
            "closes": "14:00",
            "dayOfWeek": "Saturday"
        }
        ]
    }
}
class ngsildclient.model.helper.openinghours.OpeningHoursSpecification(opens, closes, dayofweek)[source]#

Bases: object

An OpeningHoursSpecification as described here : https://schema.org/OpeningHoursSpecification

Simplified. Support a single open timeslot per day.

class ngsildclient.model.helper.openinghours.WeekDay(value)[source]#

Bases: Enum

An enumeration.