Module: Vng::Config

Included in:
Vng
Defined in:
lib/vng/config.rb

Overview

Provides methods to read and write global configuration settings.

A typical usage is to set the Security Token for the API calls.

Examples:

Set the Security Token for the API client:

Vng.configure do |config|
  config.security_token = 'ABCDEFGHIJ1234567890'
end

Instance Method Summary collapse

Instance Method Details

#configurationVng::Models::Configuration

Returns the global Models::Configuration object.

While this method can be used to read and write configuration settings, it is easier to use #configure Vng.configure}.

Examples:

Vng.configuration.security_token = 'ABCDEFGHIJ1234567890'

Returns:

  • (Vng::Models::Configuration)

    The global configuration.



37
38
39
# File 'lib/vng/config.rb', line 37

def configuration
  @configuration ||= Vng::Configuration.new
end

#configure {|Vng::Models::Configuration| ... } ⇒ Object

Yields the global configuration to the given block.

Examples:

Vng.configure do |config|
  config.security_token = 'ABCDEFGHIJ1234567890'
end

Yields:

  • (Vng::Models::Configuration)

    The global configuration.



24
25
26
# File 'lib/vng/config.rb', line 24

def configure
  yield configuration if block_given?
end