Class: Mbeditor::RedmineService
- Inherits:
-
Object
- Object
- Mbeditor::RedmineService
- Defined in:
- app/services/mbeditor/redmine_service.rb
Overview
Fetches a Redmine issue via the REST API.
Only usable when Mbeditor.configuration.redmine_enabled is true.
Returns:
{
"id" => Integer,
"title" => String,
"description" => String,
"status" => String,
"author" => String,
"notes" => Array<String>
}
Constant Summary collapse
- TIMEOUT_SECONDS =
5
Instance Attribute Summary collapse
-
#issue_id ⇒ Object
readonly
Returns the value of attribute issue_id.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(issue_id:) ⇒ RedmineService
constructor
A new instance of RedmineService.
Constructor Details
#initialize(issue_id:) ⇒ RedmineService
Returns a new instance of RedmineService.
34 35 36 |
# File 'app/services/mbeditor/redmine_service.rb', line 34 def initialize(issue_id:) @issue_id = issue_id.to_s end |
Instance Attribute Details
#issue_id ⇒ Object (readonly)
Returns the value of attribute issue_id.
32 33 34 |
# File 'app/services/mbeditor/redmine_service.rb', line 32 def issue_id @issue_id end |
Instance Method Details
#call ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'app/services/mbeditor/redmine_service.rb', line 38 def call raise RedmineDisabledError unless Mbeditor.configuration.redmine_enabled config = Mbeditor.configuration raise RedmineConfigError, "redmine_url is not configured" if config.redmine_url.blank? raise RedmineConfigError, "redmine_api_key is not configured" if config.redmine_api_key.blank? fetch_issue(config.redmine_url, config.redmine_api_key) end |