Class: NgpVan::Configuration
- Inherits:
-
Object
- Object
- NgpVan::Configuration
- Defined in:
- lib/ngp_van/configuration.rb
Instance Attribute Summary collapse
-
#api_endpoint ⇒ String
The API Endpoint url.
-
#api_key ⇒ String?
The API Key acquired from NGP VAN.
-
#application_name ⇒ String?
The Application Name in the NGP VAN system.
-
#user_agent ⇒ String
The User-Agent sent to the API endpoint.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#inspect ⇒ String
Inspect the configuration object, masking private values.
-
#reset! ⇒ NgpVan::Configuration
(also: #setup)
Reset all configuration to default values.
Constructor Details
#initialize ⇒ Configuration
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_endpoint ⇒ String
The API Endpoint url. Which endpoint you should use is determined by which VAN client with which you’re working.
29 30 31 |
# File 'lib/ngp_van/configuration.rb', line 29 def api_endpoint @api_endpoint end |
#api_key ⇒ String?
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.
23 24 25 |
# File 'lib/ngp_van/configuration.rb', line 23 def api_key @api_key end |
#application_name ⇒ String?
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.
14 15 16 |
# File 'lib/ngp_van/configuration.rb', line 14 def application_name @application_name end |
#user_agent ⇒ String
The User-Agent sent to the API endpoint. This defaults to the gem name, suffixed with the current version number.
34 35 36 |
# File 'lib/ngp_van/configuration.rb', line 34 def user_agent @user_agent end |
Instance Method Details
#inspect ⇒ String
Inspect the configuration object, masking private values.
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 |