Class: IssueScheduler::Config
- Inherits:
-
Object
- Object
- IssueScheduler::Config
- Defined in:
- lib/issue_scheduler/config.rb
Overview
Manage the configuration for the YCA EOL Dashboard program
Instance Method Summary collapse
-
#auth_type ⇒ 'basic', 'oauth'
The authentication type to use when authenticating with Jira.
-
#context_path ⇒ String
The context path to append to the Jira server URL.
-
#initialize(config_hash) ⇒ Config
constructor
Create a new Config object from a given YAML config.
-
#issue_templates ⇒ String
The glob pattern to use to find issue files.
-
#load_issue_templates ⇒ void
Load the issue templates from the configured glob pattern(s) in issue_templates.
-
#password ⇒ String
The password to use when authenticating with Jira.
-
#site ⇒ String
The URL of the Jira server.
-
#to_h ⇒ Hash
The config in the form of a Hash.
-
#to_jira_options ⇒ Hash
Creates an options hash suitable to pass to Jira::Client.new.
-
#username ⇒ String
The username to use when authenticating with Jira.
Constructor Details
#initialize(config_hash) ⇒ Config
Create a new Config object from a given YAML config
18 19 20 21 22 |
# File 'lib/issue_scheduler/config.rb', line 18 def initialize(config_hash) @config = DEFAULT_VALUES.merge(config_hash) assert_no_unexpected_keys(config) assert_all_values_are_non_nil(config) end |
Instance Method Details
#auth_type ⇒ 'basic', 'oauth'
The authentication type to use when authenticating with Jira
95 96 97 |
# File 'lib/issue_scheduler/config.rb', line 95 def auth_type config[:auth_type] end |
#context_path ⇒ String
The context path to append to the Jira server URL
80 81 82 |
# File 'lib/issue_scheduler/config.rb', line 80 def context_path config[:context_path] end |
#issue_templates ⇒ String
The glob pattern to use to find issue files
115 116 117 |
# File 'lib/issue_scheduler/config.rb', line 115 def issue_templates config[:issue_templates] end |
#load_issue_templates ⇒ void
This method returns an undefined value.
Load the issue templates from the configured glob pattern(s) in issue_templates
134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/issue_scheduler/config.rb', line 134 def load_issue_templates Dir[*Array(issue_templates)].each do |file| template_hash = { name: file, **IssueScheduler.load_yaml(file) } template = IssueScheduler::IssueTemplate.new(template_hash) if template.valid? template.save else warn "Skipping invalid issue template #{file}: #{template.errors..join(', ')}" end end end |
#password ⇒ String
The password to use when authenticating with Jira
50 51 52 |
# File 'lib/issue_scheduler/config.rb', line 50 def password config[:password] end |
#site ⇒ String
The URL of the Jira server
65 66 67 |
# File 'lib/issue_scheduler/config.rb', line 65 def site config[:site] end |
#to_h ⇒ Hash
The config in the form of a Hash
161 162 163 |
# File 'lib/issue_scheduler/config.rb', line 161 def to_h config end |
#to_jira_options ⇒ Hash
Creates an options hash suitable to pass to Jira::Client.new
186 187 188 |
# File 'lib/issue_scheduler/config.rb', line 186 def config.slice(:username, :password, :site, :context_path, :auth_type) end |
#username ⇒ String
The username to use when authenticating with Jira
35 36 37 |
# File 'lib/issue_scheduler/config.rb', line 35 def username config[:username] end |