Module: BerkeleyLibrary::TIND::Config
- Extended by:
- Util::URIs
- Defined in:
- lib/berkeley_library/tind/config.rb
Constant Summary collapse
- ENV_TIND_API_KEY =
The environment variable from which to read the TIND API key.
'LIT_TIND_API_KEY'.freeze
- ENV_TIND_BASE_URL =
The root URL for the TIND installation
'LIT_TIND_BASE_URL'.freeze
- DEFAULT_TZID =
'America/Los_Angeles'.freeze
- DEFAULT_USER_AGENT =
"#{ModuleInfo::NAME} #{ModuleInfo::VERSION} (#{ModuleInfo::HOMEPAGE})".freeze
Class Attribute Summary collapse
-
.api_key ⇒ String?
Gets the TIND API key.
Class Method Summary collapse
- .base_uri ⇒ Object
- .base_uri=(value) ⇒ Object
- .blank?(v) ⇒ Boolean
- .timezone ⇒ Object
- .timezone=(value) ⇒ Object
- .user_agent ⇒ Object
- .user_agent=(value) ⇒ Object
Class Attribute Details
.api_key ⇒ String?
Gets the TIND API key.
28 29 30 |
# File 'lib/berkeley_library/tind/config.rb', line 28 def api_key @api_key ||= default_tind_api_key end |
Class Method Details
.base_uri ⇒ Object
32 33 34 |
# File 'lib/berkeley_library/tind/config.rb', line 32 def base_uri @base_uri ||= default_tind_base_uri end |
.base_uri=(value) ⇒ Object
36 37 38 |
# File 'lib/berkeley_library/tind/config.rb', line 36 def base_uri=(value) @base_uri = uri_or_nil(value) end |
.blank?(v) ⇒ Boolean
60 61 62 |
# File 'lib/berkeley_library/tind/config.rb', line 60 def blank?(v) v.nil? || v.to_s.strip.empty? end |
.timezone ⇒ Object
40 41 42 |
# File 'lib/berkeley_library/tind/config.rb', line 40 def timezone @timezone ||= default_timezone end |
.timezone=(value) ⇒ Object
44 45 46 47 48 |
# File 'lib/berkeley_library/tind/config.rb', line 44 def timezone=(value) raise ArgumentError, "Not a #{TZInfo::Timezone}" unless value.respond_to?(:utc_to_local) @timezone = value end |
.user_agent ⇒ Object
50 51 52 |
# File 'lib/berkeley_library/tind/config.rb', line 50 def user_agent @user_agent || DEFAULT_USER_AGENT end |
.user_agent=(value) ⇒ Object
54 55 56 57 58 |
# File 'lib/berkeley_library/tind/config.rb', line 54 def user_agent=(value) raise ArgumentError, 'TIND firewall rules require a user agent' if blank?(value) @user_agent = value end |