Class: Sophos::Client
- Defined in:
- lib/sophos/client.rb,
lib/sophos/client/common.rb,
lib/sophos/client/helper.rb,
lib/sophos/client/partner.rb,
lib/sophos/client/endpoint.rb
Overview
Generate generic api methods
Direct Known Subclasses
Defined Under Namespace
Modules: Common, Endpoint, Helper, Partner
Constant Summary
Constants included from Configuration
Sophos::Configuration::DEFAULT_ENDPOINT, Sophos::Configuration::DEFAULT_ID_ENDPOINT, Sophos::Configuration::DEFAULT_PAGE_SIZE, Sophos::Configuration::DEFAULT_PAGINATION, Sophos::Configuration::DEFAULT_UA, Sophos::Configuration::VALID_OPTIONS_KEYS
Instance Method Summary collapse
-
#client(tenant) ⇒ TenantClient
get client to access api host for given tenant.
-
#tenant_client(api_host, tenant_id) ⇒ TenantClient
get teannt client to access api host for given tenant id.
Methods included from Helper
common_url, def_api_call, endpoint_url, partner_url, sanitize, url
Methods included from Partner
#admin_role_assignment, #admin_role_assignments, #billing_usage, #permission_sets
Methods inherited from API
Methods included from Authentication
Methods included from Configuration
Constructor Details
This class inherits a constructor from Sophos::API
Instance Method Details
#client(tenant) ⇒ TenantClient
get client to access api host for given tenant
14 15 16 |
# File 'lib/sophos/client.rb', line 14 def client(tenant) tenant_client(tenant.apiHost, tenant.id) if tenant end |
#tenant_client(api_host, tenant_id) ⇒ TenantClient
get teannt client to access api host for given tenant id
20 21 22 23 24 25 26 27 28 |
# File 'lib/sophos/client.rb', line 20 def tenant_client( api_host, tenant_id ) # create client and copy access_token and set default headers TenantClient.new(self.config.merge({ access_token: access_token, endpoint: api_host, tenant_id: tenant_id, connection_options: { headers: { 'X-Tenant-ID': tenant_id } } })) end |