Class: NgpVan::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/ngp_van/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



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

def initialize
  setup
end

Instance Attribute Details

#api_endpointString

The API Endpoint url. Which endpoint you should use is determined by which VAN client with which you’re working.

Returns:

  • (String)


29
30
31
# File 'lib/ngp_van/configuration.rb', line 29

def api_endpoint
  @api_endpoint
end

#api_keyString?

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.

Returns:

  • (String, nil)


23
24
25
# File 'lib/ngp_van/configuration.rb', line 23

def api_key
  @api_key
end

#application_nameString?

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.

Returns:

  • (String, nil)


14
15
16
# File 'lib/ngp_van/configuration.rb', line 14

def application_name
  @application_name
end

#user_agentString

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

Returns:

  • (String)


34
35
36
# File 'lib/ngp_van/configuration.rb', line 34

def user_agent
  @user_agent
end

Instance Method Details

#inspectString

Inspect the configuration object, masking private values.

Returns:

  • (String)


54
55
56
57
58
59
60
61
62
63
64
65
66
# 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!NgpVan::Configuration Also known as: setup

Reset all configuration to default values.



42
43
44
45
46
47
48
# 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