Package restxclient :: Module restx_service :: Class RestxAccessibleService
[hide private]
[frames] | no frames]

Class RestxAccessibleService

source code

  object --+    
           |    
RestxService --+
               |
              RestxAccessibleService

Represents information about a service of a RESTx resource, ready to be accessed.

This representation can be used by clients to find out about service capabilities and also to access the service methods of the resource.

Instance Methods [hide private]
 
__init__(self, resource, name, sdesc)
Create a new accessible service instance.
source code
RestxAccessibleService
set(self, name, value)
Specify a parameter value for the service method.
source code
RestxAccessibleService
set_params(self, param_dict)
Set the parameters for the service method specified in the dictionary.
source code
RestxAccessibleService
set_input(self, buf)
Specify an input buffer that's to be sent in the request to the service method.
source code
tuple
access(self, method=None)
Sends the service request to the server.
source code

Inherited from RestxService: __str__, get_all_parameters, get_description, get_name, get_parameter, get_positional_param_names, get_uri

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

Class Variables [hide private]
  __param_vals = None
  __input_buf = None
  __resource = None
Properties [hide private]
  input
  params

Inherited from RestxService: description, name, uri

Inherited from object: __class__

Method Details [hide private]

__init__(self, resource, name, sdesc)
(Constructor)

source code 

Create a new accessible service instance.

Parameters:
  • resource (RestxResource) - The resource to which this service belongs.
  • name (string) - Name of this service.
  • sdesc (dict) - Dictionary describing the service. This is the dictionary returned by the server when a component or resource is accessed.
Overrides: object.__init__

set(self, name, value)

source code 

Specify a parameter value for the service method.

The string representation of the 'value' object is stored. This parameter value will be passed on the URL command line.

Parameters:
  • name (string) - Name of the parameter.
  • value (Any type for which we can use str()) - The value for the parameter.
Returns: RestxAccessibleService
Reference to ourselves, so that set() calls can be chained

set_params(self, param_dict)

source code 

Set the parameters for the service method specified in the dictionary.

The string representations of each parameter value are stored.

Parameters:
  • param_dict (dict) - Dictionary with name/value pairs.
Returns: RestxAccessibleService
Reference to ourselves, so that set() calls can be chained

set_input(self, buf)

source code 

Specify an input buffer that's to be sent in the request to the service method.

Parameters:
  • buf (string) - Content for the message body.
Returns: RestxAccessibleService
Reference to ourselves, so that set() calls can be chained

access(self, method=None)

source code 

Sends the service request to the server.

Parameters:
  • method (string) - The HTTP request method. If an input was set then this defaults to POST. If the caller requests anything but PUT or POST with a set input then an exception is raised. If no input was specified then method defaults to GET.
Returns: tuple
A status, data tuple for the server's response.

Property Details [hide private]

input

Set Method:
set_input(self, buf) - Specify an input buffer that's to be sent in the request to the service method.

params

Set Method:
set_params(self, param_dict) - Set the parameters for the service method specified in the dictionary.