Class Api
Comprobo\Verify\Api is the public API for the Verify SDK. All public methods should be considered
normal operation of the SDK.
It is possible to retrieve individual objects and make calls directly to different services although
this should not be a requirement for normal usage.
USAGE:
$env = 'local' // 'staging' or 'production'
$verify = Comprobo\Verify\Api::create($env);
$verify->authenticate($key, $secret);
...
Methods summary
public static
Comprobo\Verify\Api
|
#
create( string $env = 'local', array $config = [] )
Bootstrap the Verify API. Custom configuration options are currently not supported.
Bootstrap the Verify API. Custom configuration options are currently not supported.
Parameters
- $env
- 'local', 'staging' or 'production'
- $config
- additional configuration options
Returns
|
public
|
#
__construct( Comprobo\Verify\Factory $factory )
Used by the factory itself. If you happen to need to instantiate the API this way then you can.
Used by the factory itself. If you happen to need to instantiate the API this way then you can.
Parameters
|
public
string
|
#
javascriptPath( )
Helper method to provide javascript asset location.
Helper method to provide javascript asset location.
Returns
string path to JavaScript file for inclusion where Verify is to be used
|
public
boolean
|
#
authenticate( $key, $secret )
Use your application key and secret
to set JWT token and organisation ID
in the current API context
Use your application key and secret
to set JWT token and organisation ID
in the current API context
After this is called, you may continue to use the rest of the API
methods provided here.
Parameters
- $key
- string
- $secret
- string
Returns
boolean true
|
public
string
|
#
link( string $templateId, string $monitorableId, string $friendlyName, array $customFields = [] )
Clones the selected template to create an assignable Workflow instance.
Any custom fields provided are persisted at this stage and may not be changed.
Clones the selected template to create an assignable Workflow instance.
Any custom fields provided are persisted at this stage and may not be changed.
Parameters
- $templateId
- uuid4 template workflow ID as returned by the listTemplates call
- $monitorableId
- local ID for the monitorable resource. e.g. course ID or quiz ID.
- $friendlyName
- provide a friendly name that will appear for this in the reporting tools
- $customFields
Any merge fields defined by the template can be set here.
They cannot be changed once the monitoring task has been started for any user.
Returns
string uuid4 the workflow ID
|
public
array
|
#
templates( )
List the available templates for monitoring, used for configuration
List the available templates for monitoring, used for configuration
Returns
array available templates to clone
|
public
array
|
#
begin( string $userId, string $monitorableId )
Provides a user access token and internal IDs for booting the Verify JavaScript SDK.
Provides a user access token and internal IDs for booting the Verify JavaScript SDK.
Once this has been called against a linked template,
that template cannot be modified but may be replaced by a new call to link
Parameters
- $userId
- your local user ID
- $monitorableId
- your local monitorable ID
Returns
array relevant configuration to pass to the browser for beginning monitoring
See
self::link for where to set a monitorable ID
|