I'm creating a Guzzle client using a service description. Each operation in the service description contains a URI. The REST endpoint I'm accessing requires an authorization header that is made by sticking together a public key and the uri of the endpoint and then creating an md5 from the resulting string. This is used as the authorization value.
I don't know how to get the uri value from the service description after instantiating the client.
I'm creating the Guzzle client like this:
class RestClient extends Client
public static function factory($config = array())
// The following values are required when creating the client
$required = array(
$path = drupal_get_path('module', 'junkrest');
// Merge in default settings and validate the config
$config = Collection::fromConfig($config, $required);
// Create a new client
$client = new self($config->get('base_url'), $config);
// Set the service description
$client->setDescription(ServiceDescription::factory($path . '/config/services.json'));
$authstring = md5($public_key, 'the uri value from an operation in the services.json file');
'Authentication' => $authstring));
The services.json file contains this:
"description": "Custom REST API client",
"summary": "Returns an array of franchises."
"summary": "Returns an array of reviews."
How can I access the 'uri' value in GetFranchiseList so that I can use it to create $authstring?
The client has a service description object that contains operations. The operations contain getter methods for the various properties as well as each parameter used as input.