Module: Giraffi::Config
- Included in:
- Giraffi
- Defined in:
- lib/giraffi/config.rb
Overview
Defines constants and methods related to configuration
Constant Summary collapse
- DEFAULT_REQUEST_HEADERS =
The HTTP request header if none is set
{ "User-Agent" => "Giraffi Ruby Gem #{Giraffi::Version}", "Accept" => "application/json", "Content-Type" => "application/json" }
- DEFAULT_ENDPOINT =
The basic endpoint if none is set
'https://papi.giraffi.jp'
- DEFAULT_MONITORINGDATA_ENDPOINT =
The endpoint for posting the monitoringdata if none is set
'https://okapi.giraffi.jp:3007'
- DEFAULT_APPLOGS_ENDPOINT =
The endpoint for posting the application logs if none is set
'https://lapi.giraffi.jp:3443'
- DEFAULT_APIKEY =
The APIKEY to allow you to use the Giraffi API if none is set
nil
- VALID_OPTIONS_KEYS =
An array of valid keys in the options hash when configuring a Giraffi::Client
[ :request_headers, :endpoint, :monitoringdata_endpoint, :applogs_endpoint, :apikey ]
Class Method Summary collapse
-
.extended(base) ⇒ Object
Set all configuration options to thier values when this module is extended.
Instance Method Summary collapse
-
#options ⇒ Object
Create a hash of options and thier values.
-
#reset ⇒ Object
Reset all configuration options to defaults.
Class Method Details
.extended(base) ⇒ Object
Set all configuration options to thier values when this module is extended
39 40 41 |
# File 'lib/giraffi/config.rb', line 39 def self.extended(base) base.reset end |
Instance Method Details
#options ⇒ Object
Create a hash of options and thier values
44 45 46 47 48 |
# File 'lib/giraffi/config.rb', line 44 def = {} VALID_OPTIONS_KEYS.each{|k| [k] = send(k)} end |
#reset ⇒ Object
Reset all configuration options to defaults
51 52 53 54 55 56 57 |
# File 'lib/giraffi/config.rb', line 51 def reset self.request_headers = DEFAULT_REQUEST_HEADERS self.endpoint = DEFAULT_ENDPOINT self.monitoringdata_endpoint = DEFAULT_MONITORINGDATA_ENDPOINT self.applogs_endpoint = DEFAULT_APPLOGS_ENDPOINT self.apikey = DEFAULT_APIKEY end |