Class: RailsConnector::Configuration
- Inherits:
-
Object
- Object
- RailsConnector::Configuration
- Defined in:
- lib/rails_connector/configuration.rb
Constant Summary collapse
- DEFAULT_CA_FILE =
Default path of a CA certification file in PEM format.
File.('../../../config/ca-bundle.crt', __FILE__)
Class Attribute Summary collapse
-
.ca_file ⇒ Object
Gets path of a CA certification file in PEM format.
Class Method Summary collapse
-
.cache_path=(path) ⇒ Object
The
RailsConnector
makes heavy use of filesystem caching. -
.choose_homepage(&block) ⇒ Object
Configure a callback to be invoked when the rails connector delivers the homepage.
-
.cms_api_key ⇒ Object
API key configuration for CMS Rest API.
-
.cms_api_key=(value) ⇒ Object
Set API key configuration for CMS Rest API.
-
.cms_login ⇒ Object
Login configuration for CMS Rest API.
-
.cms_login=(value) ⇒ Object
Set login configuration for CMS Rest API.
-
.cms_url ⇒ Object
Url configuration for CMS Rest API.
-
.cms_url=(value) ⇒ Object
Set url configuration for CMS Rest API.
-
.content_service_api_key ⇒ Object
Configuration for Content Read Service API.
-
.content_service_api_key=(value) ⇒ Object
Set API key configuration for Content Read Service API.
-
.content_service_login ⇒ Object
Configuration for Content Read Service API.
-
.content_service_login=(value) ⇒ Object
Set login configuration for Content Read Service API.
-
.content_service_url ⇒ Object
Configuration for Content Read Service API.
-
.content_service_url=(value) ⇒ Object
Set url configuration for Content Read Service API.
-
.editing_auth(&block) ⇒ Object
Configure a callback to be invoked when the rails connector determines, if current visitor is permitted to edit content.
Class Attribute Details
.ca_file ⇒ Object
Gets path of a CA certification file in PEM format.
54 55 56 |
# File 'lib/rails_connector/configuration.rb', line 54 def ca_file @ca_file end |
Class Method Details
.cache_path=(path) ⇒ Object
The RailsConnector
makes heavy use of filesystem caching. Use this method to configure the directory that should be used to store cached data. By default, RAILS_ROOT/tmp/infopark_cache
will be used.
48 49 50 |
# File 'lib/rails_connector/configuration.rb', line 48 def cache_path=(path) CmsCacheStorage.backend_cache = ActiveSupport::Cache::FileStore.new(path) end |
.choose_homepage(&block) ⇒ Object
Configure a callback to be invoked when the rails connector delivers the homepage. The given callback will receive the rack env and must return an Obj to be used as the homepage. If no callback is configured, Obj.homepage will be used as the default.
157 158 159 |
# File 'lib/rails_connector/configuration.rb', line 157 def choose_homepage(&block) self.choose_homepage_callback = block end |
.cms_api_key ⇒ Object
API key configuration for CMS Rest API.
128 129 130 |
# File 'lib/rails_connector/configuration.rb', line 128 def cms_api_key cms_api.api_key end |
.cms_api_key=(value) ⇒ Object
Set API key configuration for CMS Rest API.
134 135 136 |
# File 'lib/rails_connector/configuration.rb', line 134 def cms_api_key=(value) cms_api.api_key = value end |
.cms_login ⇒ Object
Login configuration for CMS Rest API.
116 117 118 |
# File 'lib/rails_connector/configuration.rb', line 116 def cms_login cms_api.login end |
.cms_login=(value) ⇒ Object
Set login configuration for CMS Rest API.
122 123 124 |
# File 'lib/rails_connector/configuration.rb', line 122 def cms_login=(value) cms_api.login = value end |
.cms_url ⇒ Object
Url configuration for CMS Rest API.
104 105 106 |
# File 'lib/rails_connector/configuration.rb', line 104 def cms_url cms_api.url end |
.cms_url=(value) ⇒ Object
Set url configuration for CMS Rest API.
110 111 112 |
# File 'lib/rails_connector/configuration.rb', line 110 def cms_url=(value) cms_api.url = value end |
.content_service_api_key ⇒ Object
Configuration for Content Read Service API.
92 93 94 |
# File 'lib/rails_connector/configuration.rb', line 92 def content_service_api_key content_service.api_key end |
.content_service_api_key=(value) ⇒ Object
Set API key configuration for Content Read Service API.
98 99 100 |
# File 'lib/rails_connector/configuration.rb', line 98 def content_service_api_key=(value) content_service.api_key = value end |
.content_service_login ⇒ Object
Configuration for Content Read Service API.
80 81 82 |
# File 'lib/rails_connector/configuration.rb', line 80 def content_service_login content_service.login end |
.content_service_login=(value) ⇒ Object
Set login configuration for Content Read Service API.
86 87 88 |
# File 'lib/rails_connector/configuration.rb', line 86 def content_service_login=(value) content_service.login = value end |
.content_service_url ⇒ Object
Configuration for Content Read Service API.
68 69 70 |
# File 'lib/rails_connector/configuration.rb', line 68 def content_service_url content_service.url end |
.content_service_url=(value) ⇒ Object
Set url configuration for Content Read Service API.
74 75 76 |
# File 'lib/rails_connector/configuration.rb', line 74 def content_service_url=(value) content_service.url = value end |
.editing_auth(&block) ⇒ Object
Configure a callback to be invoked when the rails connector determines, if current visitor is permitted to edit content. Default is false
.
Example Usage:
RailsConnector::Configuation.editing_auth do |env|
request = Rack::Request.new(env)
# return truey if current visitor is permitted to edit content, falsy otherwise
end
28 29 30 31 32 33 34 |
# File 'lib/rails_connector/configuration.rb', line 28 def editing_auth(&block) if block.respond_to?(:arity) && block.arity == 1 self.editing_auth_callback = block else raise ArgumentError, 'editing_auth should have only one attribute!' end end |