module Controls::Configurable

A module to hold configurable options to be used by other classes such as the {Controls} eigenclass or the {Controls::Client} class

Attributes

api_endpoint[RW]

@!attribute api_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls/api/1.0

@!attribute api_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls/api/1.0

@!attribute connection_options

@return [Hash] the current connection options (headers, etc.)

@!attribute default_media_type

@return [String] the default media type to send with requests. default: application/json

@!attribute middleware

@return [Faraday::Connection] the middleware used to send requests

@!attribute netrc

@return [Boolean] whether to use the netrc credentials to authentcicate with the **controls**insight API

@!attribute netrc_file

@return [String] the path of the .netrc file to look for credentials in. default: ~/.netrc

@!attribute user_agent

@return [String] the user agent to send with API requests. example: "controls/v1.0.0.beta (ruby; 2.0.0p247; [x86_64-darwin12.4.0]; Faraday v0.8.8)"

@!attribute username

@return [String] the username to use for authentication

@!attribute web_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls
api_version[RW]

@!attribute api_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls/api/1.0

@!attribute api_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls/api/1.0

@!attribute connection_options

@return [Hash] the current connection options (headers, etc.)

@!attribute default_media_type

@return [String] the default media type to send with requests. default: application/json

@!attribute middleware

@return [Faraday::Connection] the middleware used to send requests

@!attribute netrc

@return [Boolean] whether to use the netrc credentials to authentcicate with the **controls**insight API

@!attribute netrc_file

@return [String] the path of the .netrc file to look for credentials in. default: ~/.netrc

@!attribute user_agent

@return [String] the user agent to send with API requests. example: "controls/v1.0.0.beta (ruby; 2.0.0p247; [x86_64-darwin12.4.0]; Faraday v0.8.8)"

@!attribute username

@return [String] the username to use for authentication

@!attribute web_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls
connection_options[RW]

@!attribute api_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls/api/1.0

@!attribute api_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls/api/1.0

@!attribute connection_options

@return [Hash] the current connection options (headers, etc.)

@!attribute default_media_type

@return [String] the default media type to send with requests. default: application/json

@!attribute middleware

@return [Faraday::Connection] the middleware used to send requests

@!attribute netrc

@return [Boolean] whether to use the netrc credentials to authentcicate with the **controls**insight API

@!attribute netrc_file

@return [String] the path of the .netrc file to look for credentials in. default: ~/.netrc

@!attribute user_agent

@return [String] the user agent to send with API requests. example: "controls/v1.0.0.beta (ruby; 2.0.0p247; [x86_64-darwin12.4.0]; Faraday v0.8.8)"

@!attribute username

@return [String] the username to use for authentication

@!attribute web_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls
default_media_type[RW]

@!attribute api_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls/api/1.0

@!attribute api_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls/api/1.0

@!attribute connection_options

@return [Hash] the current connection options (headers, etc.)

@!attribute default_media_type

@return [String] the default media type to send with requests. default: application/json

@!attribute middleware

@return [Faraday::Connection] the middleware used to send requests

@!attribute netrc

@return [Boolean] whether to use the netrc credentials to authentcicate with the **controls**insight API

@!attribute netrc_file

@return [String] the path of the .netrc file to look for credentials in. default: ~/.netrc

@!attribute user_agent

@return [String] the user agent to send with API requests. example: "controls/v1.0.0.beta (ruby; 2.0.0p247; [x86_64-darwin12.4.0]; Faraday v0.8.8)"

@!attribute username

@return [String] the username to use for authentication

@!attribute web_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls
middleware[RW]

@!attribute api_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls/api/1.0

@!attribute api_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls/api/1.0

@!attribute connection_options

@return [Hash] the current connection options (headers, etc.)

@!attribute default_media_type

@return [String] the default media type to send with requests. default: application/json

@!attribute middleware

@return [Faraday::Connection] the middleware used to send requests

@!attribute netrc

@return [Boolean] whether to use the netrc credentials to authentcicate with the **controls**insight API

@!attribute netrc_file

@return [String] the path of the .netrc file to look for credentials in. default: ~/.netrc

@!attribute user_agent

@return [String] the user agent to send with API requests. example: "controls/v1.0.0.beta (ruby; 2.0.0p247; [x86_64-darwin12.4.0]; Faraday v0.8.8)"

@!attribute username

@return [String] the username to use for authentication

@!attribute web_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls
netrc[RW]

@!attribute api_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls/api/1.0

@!attribute api_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls/api/1.0

@!attribute connection_options

@return [Hash] the current connection options (headers, etc.)

@!attribute default_media_type

@return [String] the default media type to send with requests. default: application/json

@!attribute middleware

@return [Faraday::Connection] the middleware used to send requests

@!attribute netrc

@return [Boolean] whether to use the netrc credentials to authentcicate with the **controls**insight API

@!attribute netrc_file

@return [String] the path of the .netrc file to look for credentials in. default: ~/.netrc

@!attribute user_agent

@return [String] the user agent to send with API requests. example: "controls/v1.0.0.beta (ruby; 2.0.0p247; [x86_64-darwin12.4.0]; Faraday v0.8.8)"

@!attribute username

@return [String] the username to use for authentication

@!attribute web_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls
netrc_file[RW]

@!attribute api_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls/api/1.0

@!attribute api_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls/api/1.0

@!attribute connection_options

@return [Hash] the current connection options (headers, etc.)

@!attribute default_media_type

@return [String] the default media type to send with requests. default: application/json

@!attribute middleware

@return [Faraday::Connection] the middleware used to send requests

@!attribute netrc

@return [Boolean] whether to use the netrc credentials to authentcicate with the **controls**insight API

@!attribute netrc_file

@return [String] the path of the .netrc file to look for credentials in. default: ~/.netrc

@!attribute user_agent

@return [String] the user agent to send with API requests. example: "controls/v1.0.0.beta (ruby; 2.0.0p247; [x86_64-darwin12.4.0]; Faraday v0.8.8)"

@!attribute username

@return [String] the username to use for authentication

@!attribute web_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls
password[W]

@!attribute [w] password

@return [String] the password specified on login
user_agent[RW]

@!attribute api_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls/api/1.0

@!attribute api_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls/api/1.0

@!attribute connection_options

@return [Hash] the current connection options (headers, etc.)

@!attribute default_media_type

@return [String] the default media type to send with requests. default: application/json

@!attribute middleware

@return [Faraday::Connection] the middleware used to send requests

@!attribute netrc

@return [Boolean] whether to use the netrc credentials to authentcicate with the **controls**insight API

@!attribute netrc_file

@return [String] the path of the .netrc file to look for credentials in. default: ~/.netrc

@!attribute user_agent

@return [String] the user agent to send with API requests. example: "controls/v1.0.0.beta (ruby; 2.0.0p247; [x86_64-darwin12.4.0]; Faraday v0.8.8)"

@!attribute username

@return [String] the username to use for authentication

@!attribute web_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls
username[RW]

@!attribute api_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls/api/1.0

@!attribute api_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls/api/1.0

@!attribute connection_options

@return [Hash] the current connection options (headers, etc.)

@!attribute default_media_type

@return [String] the default media type to send with requests. default: application/json

@!attribute middleware

@return [Faraday::Connection] the middleware used to send requests

@!attribute netrc

@return [Boolean] whether to use the netrc credentials to authentcicate with the **controls**insight API

@!attribute netrc_file

@return [String] the path of the .netrc file to look for credentials in. default: ~/.netrc

@!attribute user_agent

@return [String] the user agent to send with API requests. example: "controls/v1.0.0.beta (ruby; 2.0.0p247; [x86_64-darwin12.4.0]; Faraday v0.8.8)"

@!attribute username

@return [String] the username to use for authentication

@!attribute web_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls
web_endpoint[RW]

@!attribute api_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls/api/1.0

@!attribute api_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls/api/1.0

@!attribute connection_options

@return [Hash] the current connection options (headers, etc.)

@!attribute default_media_type

@return [String] the default media type to send with requests. default: application/json

@!attribute middleware

@return [Faraday::Connection] the middleware used to send requests

@!attribute netrc

@return [Boolean] whether to use the netrc credentials to authentcicate with the **controls**insight API

@!attribute netrc_file

@return [String] the path of the .netrc file to look for credentials in. default: ~/.netrc

@!attribute user_agent

@return [String] the user agent to send with API requests. example: "controls/v1.0.0.beta (ruby; 2.0.0p247; [x86_64-darwin12.4.0]; Faraday v0.8.8)"

@!attribute username

@return [String] the username to use for authentication

@!attribute web_endpoint

@return [String] the endpoint to connect to. default: https://nexpose.local:3780/insight/controls

Public Class Methods

keys() click to toggle source

@return [Array<Symbol>] a list of configurable keys

# File lib/controls/configurable.rb, line 35
def keys
  @keys ||= [
    :api_endpoint,
    :api_version,
    :connection_options,
    :default_media_type,
    :middleware,
    :netrc,
    :netrc_file,
    :password,
    :user_agent,
    :username,
    :web_endpoint
  ]
end

Public Instance Methods

configure() { |self| ... } click to toggle source

@yield [self]

# File lib/controls/configurable.rb, line 53
def configure
  yield self
end
netrc?() click to toggle source
# File lib/controls/configurable.rb, line 57
def netrc?
  !!@netrc
end
setup() click to toggle source

Configures {Controls::Configurable} to use options found in {Controls::Default}

@return [self]

# File lib/controls/configurable.rb, line 65
def setup
  Controls::Configurable.keys.each do |key|
    instance_variable_set(:"@#{key}", Controls::Default.options[key])
  end

  self
end

Private Instance Methods

options() click to toggle source

@return [Hash] a hash representation of the options mapping key names to

their instance variable counterpart's value
# File lib/controls/configurable.rb, line 80
def options
  Hash[Controls::Configurable.keys.map { |key| [key, instance_variable_get(:"@#{key}")] }]
end