Class: TRMNL::API::Configuration::Loader
- Inherits:
-
Object
- Object
- TRMNL::API::Configuration::Loader
- Defined in:
- lib/trmnl/api/configuration/loader.rb
Overview
Loads configuration based on environment or falls back to defaults.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(model: Content, environment: ENV) ⇒ Loader
constructor
A new instance of Loader.
Constructor Details
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/trmnl/api/configuration/loader.rb', line 13 def call model[ content_type: environment.fetch("TRMNL_API_CONTENT_TYPE", "application/json"), timeout_connect: environment.fetch("TRMNL_API_TIMEOUT_CONNECT", 2).to_i, timeout_read: environment.fetch("TRMNL_API_TIMEOUT_READ", 10).to_i, timeout_write: environment.fetch("TRMNL_API_TIMEOUT_WRITE", 10).to_i, uri: environment.fetch("TRMNL_API_URI", "https://trmnl.com/api"), user_agent: "http.rb/#{HTTP::VERSION} (#{default_user_agent})" ] end |