class NgpVan::Configuration

Attributes

api_endpoint[RW]

The API Endpoint url. Which endpoint you should use is determined by which VAN client with which you're working. @note See developers.ngpvan.com/van-api#van-endpoints @return [String]

api_key[RW]

The API Key acquired from NGP VAN. The API Key resembles the concatenation of a GUID, a | and a 0 or 1 (e.g., bc7b6578-5619-4e8f-92ab-829208e1a511|1).

The `api_key` setting is used for authenticating requests.

@return [String, nil]

application_name[RW]

The Application Name in the NGP VAN system. A short string that identifies your application (e.g., acmeCrmProduct)

The `application_name` setting is used for authenticating requests.

@return [String, nil]

user_agent[RW]

The User-Agent sent to the API endpoint. This defaults to the gem name, suffixed with the current version number. @return [String]

Public Class Methods

new() click to toggle source
# File lib/ngp_van/configuration.rb, line 36
def initialize
  setup
end

Public Instance Methods

inspect() click to toggle source

Inspect the configuration object, masking private values. @return [String]

Calls superclass method
# File lib/ngp_van/configuration.rb, line 54
def inspect
  inspected = super

  if NgpVan.configuration.api_key
    filter_value!(inspected, NgpVan.configuration.api_key)
  end

  if NgpVan.configuration.application_name
    filter_value!(inspected, NgpVan.configuration.application_name)
  end

  inspected
end
reset!() click to toggle source

Reset all configuration to default values. @return [NgpVan::Configuration]

# File lib/ngp_van/configuration.rb, line 42
def reset!
  @application_name = NgpVan::Default.application_name
  @api_key = NgpVan::Default.api_key
  @api_endpoint = NgpVan::Default.api_endpoint
  @user_agent = NgpVan::Default.user_agent
  self
end
Also aliased as: setup
setup()
Alias for: reset!

Private Instance Methods

filter_value!(source, str) click to toggle source
# File lib/ngp_van/configuration.rb, line 70
def filter_value!(source, str)
  source.gsub!(str, '[FILTERED]')
end