Class: Decidim::BulletinBoard::Settings
- Inherits:
-
Object
- Object
- Decidim::BulletinBoard::Settings
- Defined in:
- lib/decidim/bulletin_board/settings.rb
Overview
The Bulletin Board settings class
Instance Attribute Summary collapse
-
#authority_api_key ⇒ Object
readonly
Returns the value of attribute authority_api_key.
-
#authority_name ⇒ Object
readonly
Returns the value of attribute authority_name.
-
#authority_private_key ⇒ Object
readonly
Returns the value of attribute authority_private_key.
-
#bulletin_board_public_key ⇒ Object
readonly
Returns the value of attribute bulletin_board_public_key.
-
#bulletin_board_server ⇒ Object
readonly
Returns the value of attribute bulletin_board_server.
-
#number_of_trustees ⇒ Object
readonly
Returns the value of attribute number_of_trustees.
-
#quorum ⇒ Object
readonly
Returns the value of attribute quorum.
-
#scheme_name ⇒ Object
readonly
Returns the value of attribute scheme_name.
Instance Method Summary collapse
- #authority_public_key ⇒ Object
- #authority_slug ⇒ Object
- #bulletin_board_public_key_rsa ⇒ Object
- #configured? ⇒ Boolean
-
#initialize(config) ⇒ Settings
constructor
A new instance of Settings.
Constructor Details
#initialize(config) ⇒ Settings
Returns a new instance of Settings.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/decidim/bulletin_board/settings.rb', line 7 def initialize(config) @bulletin_board_server = config.bulletin_board_server.presence @bulletin_board_public_key = config.bulletin_board_public_key.presence @authority_api_key = config..presence @authority_name = config..presence @authority_private_key = JwkUtils.import_private_key(config.) if config..present? @scheme_name = config.scheme_name.presence @number_of_trustees = config.number_of_trustees.presence @quorum = config.quorum.presence || number_of_trustees end |
Instance Attribute Details
#authority_api_key ⇒ Object (readonly)
Returns the value of attribute authority_api_key.
24 25 26 |
# File 'lib/decidim/bulletin_board/settings.rb', line 24 def @authority_api_key end |
#authority_name ⇒ Object (readonly)
Returns the value of attribute authority_name.
24 25 26 |
# File 'lib/decidim/bulletin_board/settings.rb', line 24 def @authority_name end |
#authority_private_key ⇒ Object (readonly)
Returns the value of attribute authority_private_key.
24 25 26 |
# File 'lib/decidim/bulletin_board/settings.rb', line 24 def @authority_private_key end |
#bulletin_board_public_key ⇒ Object (readonly)
Returns the value of attribute bulletin_board_public_key.
24 25 26 |
# File 'lib/decidim/bulletin_board/settings.rb', line 24 def bulletin_board_public_key @bulletin_board_public_key end |
#bulletin_board_server ⇒ Object (readonly)
Returns the value of attribute bulletin_board_server.
24 25 26 |
# File 'lib/decidim/bulletin_board/settings.rb', line 24 def bulletin_board_server @bulletin_board_server end |
#number_of_trustees ⇒ Object (readonly)
Returns the value of attribute number_of_trustees.
24 25 26 |
# File 'lib/decidim/bulletin_board/settings.rb', line 24 def number_of_trustees @number_of_trustees end |
#quorum ⇒ Object (readonly)
Returns the value of attribute quorum.
24 25 26 |
# File 'lib/decidim/bulletin_board/settings.rb', line 24 def quorum @quorum end |
#scheme_name ⇒ Object (readonly)
Returns the value of attribute scheme_name.
24 25 26 |
# File 'lib/decidim/bulletin_board/settings.rb', line 24 def scheme_name @scheme_name end |
Instance Method Details
#authority_public_key ⇒ Object
36 37 38 |
# File 'lib/decidim/bulletin_board/settings.rb', line 36 def @authority_public_key ||= &.export end |
#authority_slug ⇒ Object
32 33 34 |
# File 'lib/decidim/bulletin_board/settings.rb', line 32 def @authority_slug ||= .parameterize end |
#bulletin_board_public_key_rsa ⇒ Object
28 29 30 |
# File 'lib/decidim/bulletin_board/settings.rb', line 28 def bulletin_board_public_key_rsa @bulletin_board_public_key_rsa ||= JWT::JWK::RSA.import(bulletin_board_public_key).public_key end |
#configured? ⇒ Boolean
20 21 22 |
# File 'lib/decidim/bulletin_board/settings.rb', line 20 def configured? bulletin_board_server && bulletin_board_public_key && && && && scheme_name && number_of_trustees end |