Module: Sophos

Extended by:
Configuration, WrAPI::RespondTo
Defined in:
lib/sophos_central_api.rb,
lib/sophos/api.rb,
lib/sophos/error.rb,
lib/sophos/client.rb,
lib/sophos/version.rb,
lib/sophos/pagination.rb,
lib/sophos/client/common.rb,
lib/sophos/client/helper.rb,
lib/sophos/configuration.rb,
lib/sophos/authentication.rb,
lib/sophos/client/partner.rb,
lib/sophos/client/endpoint.rb

Overview

Main module to interact with the Sophos API. This module provides access to the Sophos client, which handles API calls and manages configurations.

Examples:

Initialize a Sophos client:

client = Sophos.client(
  client_id: 'your_client_id',
  client_secret: 'your_client_secret'
)

Defined Under Namespace

Modules: Authentication, Configuration, RequestPagination Classes: API, AuthenticationError, Client, ConfigurationError, SophosError, TenantClient

Constant Summary collapse

VERSION =
'0.2.4'

Constants included from Configuration

Configuration::DEFAULT_ENDPOINT, Configuration::DEFAULT_ID_ENDPOINT, Configuration::DEFAULT_PAGE_SIZE, Configuration::DEFAULT_PAGINATION, Configuration::DEFAULT_RATE_LIMIT, Configuration::DEFAULT_RATE_PERIOD, Configuration::DEFAULT_USER_AGENT, Configuration::VALID_OPTIONS_KEYS

Class Method Summary collapse

Methods included from Configuration

extended, options, reset

Class Method Details

.client(options = {}) ⇒ Sophos::Client

Initializes and returns a new instance of the Sophos client.

Examples:

Create a client with default settings:

Sophos.client

Create a client with custom options:

Sophos.client(client_id: 'abc123', client_secret: 'xyz789')

Parameters:

  • options (Hash) (defaults to: {})

    A hash of options to configure the client. Supported options include:

    • :client_id [String] - Your Sophos API client ID.
    • :client_secret [String] - Your Sophos API client secret.
    • :endpoint [String] - The base URL for the API (default: Sophos Central endpoint).

Returns:

  • (Sophos::Client)

    An instance of the Sophos client with the provided configuration.



36
37
38
# File 'lib/sophos_central_api.rb', line 36

def self.client(options = {})
  Sophos::Client.new({rate_limit: Configuration::DEFAULT_RATE_LIMIT, rate_period: Configuration::DEFAULT_RATE_PERIOD}.merge(options))
end