public function TripalDocService_v0_1::handleRequest

3.x TripalDocService_v0_1.inc public TripalDocService_v0_1::handleRequest()

Overrides TripalWebService::handleRequest

See also

TripalWebService::handleRequest()

File

tripal_ws/includes/TripalWebService/TripalDocService_v0_1.inc, line 48

Class

TripalDocService_v0_1

Code

public function handleRequest() {

  // Create the vocabulary resource.
  $this->resource->addContextItem('vocab', $this->getServicePath() . '#');
  $this->resource->addContextItem('apiDocumentation', 'hydra:apiDocumentation');
  $this->resource->addContextItem('supportedClass', 'hydra:supportedClass');
  $this->resource->setType('apiDocumentation');
  $this->resource->setID('doc/' . $this->getVersion());

  // Add the EntryPoint class.
  $this->addEntryPointClass();
  foreach ($this->documentation as $supported) {
    $this->resource->addProperty('supportedClass', $supported);
  }

  // Iterate through all of the web services and build their documentation
  foreach ($this->services as $service_class) {
    $service = new $service_class($this->base_path);
    $supported_classes = $service->getDocumentation();
    foreach ($supported_classes as $supported) {
      $this->resource->addProperty('supportedClass', $supported);
    }
  }
}