=== Ruby SDK Reference
==== Getting Started
Inside the `clients/ruby` of the installation is an SDK for Ruby 2+ applications.
To get started, just run `gem install helix-web-services-client-2016.1.0.gem` and you should have the Ruby client available to your ruby distribution.
You may need to install dependencies, which is beyond the scope of this documentation - we assume you are familiar and comfortable developing Ruby applications.
Typically, you'll create an instance of the `DefaultApi` and setup authentication for a particular user.
[source,ruby]
....
api = HelixWebServices::DefaultApi.new
api.api_client.config.scheme = 'https'
api.api_client.config.host = 'myhost.example.com'
# The default configuration of HWS uses a self-signed certificate, so you will likely
# need to disable SSL verification
api.api_client.config.verify_ssl = false
login_request = HelixWebServices::LoginRequest.new(:user => 'jdoe', :password => 'mypassword')
login_response = api.login_post(login_request)
# We generate an authentication key that is to be used as the Authorization header.
api.api_client.config.api_key['Authorization'] = login_response.ticket
# List depots on p4d 'myserver'
depots = api.servers_depots_get('myserver')
....
[[ruby-api-client]]
==== HelixWebServices::ApiClient Reference
The `ApiClient` is an attribute on the main API object you instantiate.
For example, you will create an instance of `DefaultApi`, and you will access the `ApiClient` via the `api_client` accessor of your `DefaultApi` object.
[source,ruby]
....
api = HelixWebServices::DefaultApi.new
api.api_client
....
.Accessors
[cols="3*", options="header"]
|===
| Name
| Type
| Description
| `config`
| `HelixWebServices::Configuration`
| See <<ruby-configuration>>.
| `default_headers`
| `Hash`
| Adds Request headers to be used in all HTTP requests (by default).
|===
[[ruby-configuration]]
==== HelixWebServices::Configuration Reference
For the Ruby SDK, the `Configuration` handle is accessed via the `config` accessor of the `ApiClient`, see <<ruby-api-client>>.
The Configuration handle is used to create common settings typically needed for most calls to the server.
.Accessors
[cols="3*", options="header"]
|===
| Name
| Type
| Description
| `api_key`
| `Hash`
| Defines API keys used with API Key authentication.
Use set the user specific authentication key via the `Authorization` key on this hash.
| `base_path`
| `String`
| Defines URL base path (defaults to `/api/HWS_VERSION`)
| `cert_file`
| `String`
| Client certificate file (for client certificate)
| `debugging`
| `Boolean`
| Set this to enable/disable debugging.
When enabled (set to true), HTTP request/response details will be logged with `logger.debug` (see the `logger` attribute).
| `host`
| `String`
| Defines URL host
| `key_file`
| `String`
| Client private key file (for client certificate)
| `scheme`
| `String`
| Defines URL scheme
| `ssl_ca_cert`
| `String`
| Set this to customize the certificate file to verify the peer.
See also: The `cainfo` option of Typhoeus, `--cert` option of libcurl.
| `timeout`
| `Integer`
| The time limit for HTTP request in seconds.
Default to 0 (never times out).
| `verify_ssl`
| `Boolean`
| Set this to false to skip verifying SSL certificate when calling API from https server.
Default to true.
|===
[[ruby-default-api]]
==== HelixWebServices::DefaultApi Reference
include::../ruby-default.adoc[]
[[ruby-alpha-api]]
==== HelixWebServices::AlphaApi Reference
include::../ruby-alpha.adoc[]
[[ruby-model]]
==== Ruby Models
include::../ruby-models.adoc[]