Package restxclient :: Module restx_resource :: Class RestxResource
[hide private]
[frames] | no frames]

Class RestxResource

source code

object --+
         |
        RestxResource

Represents information about a resource on a RESTx server.

This representation can be used by clients to find out about component capabilities and also as a starting point to create new resources, by utilizing the get_resource_template() function.

Instance Methods [hide private]
 
__init__(self, server, rdesc)
Create a new resource representation in memomory.
source code
 
__str__(self)
Return a string representation of this resource.
source code
string
get_name(self)
Return the name of the resource.
source code
string
get_description(self)
Return the description of the resource.
source code
string
get_uri(self)
Return the URI of the resource.
source code
RestxServer
get_server(self)
Return the RestxServer object of the server on which this resource lives.
source code
dict of RestxAccessibleService
get_all_services(self)
Return all services defined for this resource.
source code
RestxAccessibleService
get_service(self, name)
Return one service of this resource.
source code
 
delete(self)
Delete the resource on the server.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Class Variables [hide private]
  __NAME_KEY = 'name'
  __DESC_KEY = 'desc'
  __URI_KEY = 'uri'
  __SERVICES_KEY = 'services'
  __server = None
  __name = None
  __description = None
  __uri = None
  __services = None
Properties [hide private]
string name
Return the name of the resource.
string description
Return the description of the resource.
string uri
Return the URI of the resource.
RestxServer server
Return the RestxServer object of the server on which this resource lives.

Inherited from object: __class__

Method Details [hide private]

__init__(self, server, rdesc)
(Constructor)

source code 

Create a new resource representation in memomory.

Parameters:
  • server (RestxServer) - The RESTx server on which the resource resides.
  • rdesc (dict) - Dictionary describing the server resource. This is the dictionary returned by the server when a reource URI is accessed.
Overrides: object.__init__

__str__(self)
(Informal representation operator)

source code 

Return a string representation of this resource.

Overrides: object.__str__

get_name(self)

source code 

Return the name of the resource.

Returns: string
Name of resource.

get_description(self)

source code 

Return the description of the resource.

Returns: string
Description of the resource.

get_uri(self)

source code 

Return the URI of the resource.

Returns: string
URI of the resource.

get_server(self)

source code 

Return the RestxServer object of the server on which this resource lives.

Returns: RestxServer
The server of this resource.

get_all_services(self)

source code 

Return all services defined for this resource.

Returns: dict of RestxAccessibleService
Dictionary of all services.

get_service(self, name)

source code 

Return one service of this resource.

Parameters:
  • name (string) - Name of the service.
Returns: RestxAccessibleService
Dictionary of service definition.

Property Details [hide private]

name

Return the name of the resource.

Get Method:
get_name(self) - Return the name of the resource.
Type:
string

description

Return the description of the resource.

Get Method:
get_description(self) - Return the description of the resource.
Type:
string

uri

Return the URI of the resource.

Get Method:
get_uri(self) - Return the URI of the resource.
Type:
string

server

Return the RestxServer object of the server on which this resource lives.

Get Method:
get_server(self) - Return the RestxServer object of the server on which this resource lives.
Type:
RestxServer