function tripal_get_web_services

3.x tripal_ws.api.inc tripal_get_web_services()

Retrieves a list of TripalWebService implementations.

The TripalWebService classes can be added by a site developer that wishes to create a new Tripal compatible web serivce. The class file should be placed in the [module]/includes/TripalWebService directory. Tripal will support any service as long as it is in this directory and extends the TripalWebService class.

Return value

A list of TripalWebService names.

Related topics

3 calls to tripal_get_web_services()
TripalDocService_v0_1::__construct in tripal_ws/includes/TripalWebService/TripalDocService_v0_1.inc
Constructor for the TripalDocService_v0_1 class.
tripal_ws_get_services in tripal_ws/tripal_ws.module
The callback function for all RESTful web services.
tripal_ws_list_services in tripal_ws/tripal_ws.module
Generates the list of services as the "home page" for Tripal web services.

File

tripal_ws/api/tripal_ws.api.inc, line 66
This file provides the Tripal Web Services API: a set of functions for interacting with the Tripal Web Services.

Code

function tripal_get_web_services() {
  $services = array();

  $modules = module_list(TRUE);
  foreach ($modules as $module) {
    // Find all of the files in the tripal_chado/includes/fields directory.
    $service_path = drupal_get_path('module', $module) . '/includes/TripalWebService';
    $service_files = file_scan_directory($service_path, '/.inc$/');
    // Iterate through the fields, include the file and run the info function.
    foreach ($service_files as $file) {
      $class = $file->name;
      module_load_include('inc', $module, 'includes/TripalWebService/' . $class);
      if (class_exists($class) and is_subclass_of($class, 'TripalWebService')) {
        $services[] = $class;
      }
    }
  }
  return $services;
}