Class: TeamsConnector::Configuration
- Defined in:
- lib/teams_connector/configuration.rb
Constant Summary collapse
- DEFAULT_TEMPLATE_DIR =
%w[templates teams_connector].freeze
Instance Attribute Summary collapse
-
#always_use_default ⇒ Object
Returns the value of attribute always_use_default.
-
#channels ⇒ Object
Returns the value of attribute channels.
-
#color ⇒ Object
Returns the value of attribute color.
-
#default ⇒ Object
Returns the value of attribute default.
-
#method ⇒ Object
Returns the value of attribute method.
-
#template_dir ⇒ Object
Returns the value of attribute template_dir.
Instance Method Summary collapse
- #channel(name, url) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #load_from_rails_credentials ⇒ Object
Constructor Details
#initialize ⇒ Configuration
10 11 12 13 14 15 16 17 |
# File 'lib/teams_connector/configuration.rb', line 10 def initialize @default = nil @channels = {} @always_use_default = false @method = :direct @template_dir = DEFAULT_TEMPLATE_DIR @color = '3f95b5' end |
Instance Attribute Details
#always_use_default ⇒ Object
Returns the value of attribute always_use_default.
8 9 10 |
# File 'lib/teams_connector/configuration.rb', line 8 def always_use_default @always_use_default end |
#channels ⇒ Object
Returns the value of attribute channels.
8 9 10 |
# File 'lib/teams_connector/configuration.rb', line 8 def channels @channels end |
#color ⇒ Object
Returns the value of attribute color.
8 9 10 |
# File 'lib/teams_connector/configuration.rb', line 8 def color @color end |
#default ⇒ Object
Returns the value of attribute default.
7 8 9 |
# File 'lib/teams_connector/configuration.rb', line 7 def default @default end |
#method ⇒ Object
Returns the value of attribute method.
7 8 9 |
# File 'lib/teams_connector/configuration.rb', line 7 def method @method end |
#template_dir ⇒ Object
Returns the value of attribute template_dir.
8 9 10 |
# File 'lib/teams_connector/configuration.rb', line 8 def template_dir @template_dir end |
Instance Method Details
#channel(name, url) ⇒ Object
32 33 34 |
# File 'lib/teams_connector/configuration.rb', line 32 def channel(name, url) @channels[name] = url end |
#load_from_rails_credentials ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/teams_connector/configuration.rb', line 36 def load_from_rails_credentials raise 'This method is only available in Ruby on Rails.' unless defined? Rails webhook_urls = Rails.application.credentials.teams_connector! webhook_urls.each do |entry| channel(entry[0], entry[1]) end end |