Class: RenuoCmsRails::Config
- Inherits:
-
Object
- Object
- RenuoCmsRails::Config
- Defined in:
- lib/renuo_cms_rails/config.rb
Instance Attribute Summary collapse
-
#api_host ⇒ Object
writeonly
Sets the attribute api_host.
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#content_path_generator ⇒ Object
Returns the value of attribute content_path_generator.
-
#private_api_key ⇒ Object
Returns the value of attribute private_api_key.
Instance Method Summary collapse
- #api_host_with_protocol ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
26 27 28 29 30 31 |
# File 'lib/renuo_cms_rails/config.rb', line 26 def initialize self.api_host = ENV['RENUO_CMS_API_HOST'] self.api_key = ENV['RENUO_CMS_API_KEY'] self.private_api_key = ENV['RENUO_CMS_PRIVATE_API_KEY'] self.content_path_generator = ->(path) { "#{path}-#{I18n.locale}" } end |
Instance Attribute Details
#api_host=(value) ⇒ Object
Sets the attribute api_host
19 20 21 |
# File 'lib/renuo_cms_rails/config.rb', line 19 def api_host=(value) @api_host = value end |
#api_key ⇒ Object
Returns the value of attribute api_key.
22 23 24 |
# File 'lib/renuo_cms_rails/config.rb', line 22 def api_key @api_key end |
#content_path_generator ⇒ Object
Returns the value of attribute content_path_generator.
24 25 26 |
# File 'lib/renuo_cms_rails/config.rb', line 24 def content_path_generator @content_path_generator end |
#private_api_key ⇒ Object
Returns the value of attribute private_api_key.
23 24 25 |
# File 'lib/renuo_cms_rails/config.rb', line 23 def private_api_key @private_api_key end |
Instance Method Details
#api_host_with_protocol ⇒ Object
33 34 35 36 37 |
# File 'lib/renuo_cms_rails/config.rb', line 33 def api_host_with_protocol host = api_host return host if host.start_with?('https://', 'http://', '//') "https://#{host}" end |