Class: Vng::Configuration
- Inherits:
-
Object
- Object
- Vng::Configuration
- Defined in:
- lib/vng/configuration.rb
Overview
Provides an object to store global configuration settings.
This class is typically not used directly, but by calling Vng.configure, which creates and updates a single instance of Models::Configuration.
An alternative way to set global configuration settings is by storing them in the following environment variables:
-
VNG_HOST
to store the host for the Vonigo API -
VNG_USERNAME
to store the username for the Vonigo API -
VNG_PASSWORD
to store the password for the Vonigo API
In case both methods are used together, Vng.configure takes precedence.
Instance Attribute Summary collapse
-
#host ⇒ String
The URI host for the API calls.
-
#mock ⇒ Boolean
Whether to mock the HTTP calls to Vonigo.
-
#password ⇒ String
The password for the API calls.
-
#security_token ⇒ String
The Security Token for the API calls.
-
#username ⇒ String
The username for the API calls.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
Initialize the global configuration settings, using the values of the specified following environment variables by default.
Constructor Details
#initialize ⇒ Configuration
Initialize the global configuration settings, using the values of the specified following environment variables by default.
48 49 50 51 52 53 |
# File 'lib/vng/configuration.rb', line 48 def initialize @host = ENV['VNG_HOST'] @username = ENV['VNG_USERNAME'] @password = ENV['VNG_PASSWORD'] @mock = ENV['VNG_MOCK'] == '1' end |
Instance Attribute Details
#host ⇒ String
Returns the URI host for the API calls.
35 36 37 |
# File 'lib/vng/configuration.rb', line 35 def host @host end |
#mock ⇒ Boolean
Returns whether to mock the HTTP calls to Vonigo.
44 45 46 |
# File 'lib/vng/configuration.rb', line 44 def mock @mock end |
#password ⇒ String
Returns the password for the API calls.
41 42 43 |
# File 'lib/vng/configuration.rb', line 41 def password @password end |
#security_token ⇒ String
Returns the Security Token for the API calls.
32 33 34 |
# File 'lib/vng/configuration.rb', line 32 def security_token @security_token end |
#username ⇒ String
Returns the username for the API calls.
38 39 40 |
# File 'lib/vng/configuration.rb', line 38 def username @username end |