Module: Sophos::Configuration
Overview
Configuration module for setting API-related options and defaults.
This module extends WrAPI::Configuration and defines additional constants,
default values, and methods to handle the configuration of the Sophos API wrapper.
Constant Summary collapse
- VALID_OPTIONS_KEYS =
Additional valid configuration keys for [Sophos::API].
(WrAPI::Configuration::VALID_OPTIONS_KEYS + i[ partner_id tenant_id id_endpoint ])
- DEFAULT_ENDPOINT =
Default settings
'https://api.central.sophos.com'- DEFAULT_ID_ENDPOINT =
'https://id.sophos.com'- DEFAULT_USER_AGENT =
"Sophos Ruby API wrapper #{Sophos::VERSION}"- DEFAULT_PAGINATION =
Sophos::RequestPagination::PagesPagination
- DEFAULT_PAGE_SIZE =
100- DEFAULT_RATE_LIMIT =
100- DEFAULT_RATE_PERIOD =
60
Class Method Summary collapse
-
.extended(base) ⇒ Object
Initialize configuration defaults when this module is extended.
Instance Method Summary collapse
-
#options ⇒ Hash
Returns the current configuration as a hash of key-value pairs.
-
#reset ⇒ Object
Resets all configuration options to their default values.
Class Method Details
.extended(base) ⇒ Object
Initialize configuration defaults when this module is extended.
32 33 34 |
# File 'lib/sophos/configuration.rb', line 32 def self.extended(base) base.reset end |
Instance Method Details
#options ⇒ Hash
Returns the current configuration as a hash of key-value pairs.
39 40 41 42 43 |
# File 'lib/sophos/configuration.rb', line 39 def VALID_OPTIONS_KEYS.each_with_object({}) do |key, option| option[key] = send(key) end end |
#reset ⇒ Object
Resets all configuration options to their default values.
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/sophos/configuration.rb', line 46 def reset super self.partner_id = nil self.tenant_id = nil self.endpoint = DEFAULT_ENDPOINT self.id_endpoint = DEFAULT_ID_ENDPOINT self.user_agent = DEFAULT_USER_AGENT self.page_size = DEFAULT_PAGE_SIZE self.pagination_class = DEFAULT_PAGINATION self.rate_limit = DEFAULT_RATE_LIMIT self.rate_period = DEFAULT_RATE_PERIOD end |