Class: StatusClient

Inherits:
Object
  • Object
show all
Defined in:
lib/lockstep_sdk/clients/status.rb

Instance Method Summary collapse

Constructor Details

#initialize(lockstepsdk) ⇒ StatusClient

Initialize the StatusClient class with a lockstepsdk instance.

Parameters:

  • lockstepsdk (LockstepApi)

    The Lockstep API client object for this connection



22
23
24
# File 'lib/lockstep_sdk/clients/status.rb', line 22

def initialize(lockstepsdk)
    @lockstepsdk = lockstepsdk
end

Instance Method Details

#error_test(err:) ⇒ Object

Generates an error code that your program may use to test handling of common types of error conditions.

  • If you specify `?err=500`, you will receive a 500 internal server error. * If you specify `?err=timeout`, the API will stall for 90 seconds and then return 200 OK. Many network connections will drop after 60 seconds of no activity. * If you do not specify any of these errors, the API will return 200 OK.

The Error Test API allows you to test whether your client program is capable of handling certain types of error codes. Developers writing libraries may find it useful to create integration tests that verify that their code can correctly detect the difference between a validation error resulting in a 400 error code, a network timeout resulting in a broken network connection, and a server error resulting in a 500 error code. You may use the Error Test API to verify that your code is able to identify and handle these cases correctly.

Parameters:

  • err (string)

    The type of error test to execute. Supported error types: 500, timeout



41
42
43
44
45
# File 'lib/lockstep_sdk/clients/status.rb', line 41

def error_test(err:)
    path = "/api/v1/Status/testing"
    params = {:err => err}
    @lockstepsdk.request(:get, path, nil, params)
end

#pingObject

Verifies that your application can successfully call the Lockstep Platform API and returns a successful code regardless of your authentication status or permissions.

The Ping API can be used to verify that your app is working correctly. The Ping API will always return 200 OK. If you call this API and you receive a code other than 200 OK, you should check your network connectivity. A response code of anything other than 200 means that a routing issue or proxy issue may prevent your application from reaching the Lockstep API



30
31
32
33
# File 'lib/lockstep_sdk/clients/status.rb', line 30

def ping()
    path = "/api/v1/Status"
    @lockstepsdk.request(:get, path, nil, nil)
end