Source code for oceanbolt.sdk.data.entities

from oceanbolt.sdk.client import APIClient
from oceanbolt.sdk.helpers import (pb_list_to_pandas)


[docs]class Ports: """ The ``Ports`` returns a list ports. """ RESOURCE_NAME = "entities/ports" def __init__(self, client: APIClient): self.client = client._entities_client() self.metadata = client.metadata
[docs] def get(self): """Retrieves list of ports as a pandas.DataFrame""" return pb_list_to_pandas(self.client.list_ports(metadata=self.metadata).ports)
[docs]class Zones: """ The ``Zones`` returns a list zones. """ RESOURCE_NAME = "entities/zones" def __init__(self, client: APIClient): self.client = client._entities_client() self.metadata = client.metadata
[docs] def get(self): """Retrieves list of zones as a pandas.DataFrame""" return pb_list_to_pandas(self.client.list_zones(metadata=self.metadata).zones)
[docs]class Regions: """ The ``Regions`` returns a list regions. """ RESOURCE_NAME = "entities/regions" def __init__(self, client: APIClient): self.client = client._entities_client() self.metadata = client.metadata
[docs] def get(self): """Retrieves list of regions as a pandas.DataFrame""" return pb_list_to_pandas(self.client.list_regions(metadata=self.metadata).regions)
[docs]class Countries: """ The ``Countries`` returns a list countries. """ RESOURCE_NAME = "entities/countries" def __init__(self, client: APIClient): self.client = client._entities_client() self.metadata = client.metadata def get(self): return pb_list_to_pandas(self.client.list_countries(metadata=self.metadata).countries)
[docs]class Commodities: """ The ``Commodities`` returns a list commodities. """ RESOURCE_NAME = "entities/commodities" def __init__(self, client: APIClient): self.client = client._entities_client() self.metadata = client.metadata
[docs] def get(self): """Retrieves list of commodites as a pandas.DataFrame""" return pb_list_to_pandas(self.client.list_commodities(metadata=self.metadata).commodities)
[docs]class Segments: """ The ``Segments`` returns a list segments. """ RESOURCE_NAME = "entities/segments" def __init__(self, client: APIClient): self.client = client._entities_client() self.metadata = client.metadata
[docs] def get(self): """Retrieves list of segments as a pandas.DataFrame""" return pb_list_to_pandas(self.client.list_segments(metadata=self.metadata).segments)