Class: Jira::Requests::Base

Inherits:
Object
  • Object
show all
Defined in:
app/services/jira/requests/base.rb

Direct Known Subclasses

Projects::ListService

Constant Summary collapse

JIRA_API_VERSION =
2
JIRA_ERROR_JSON_SIZE_LIMIT =

Limit the size of the JSON error message we will attempt to parse, as the JSON is external input.

5_000
ERRORS =
{
  connection: [Errno::ECONNRESET, Errno::ECONNREFUSED],
  jira_ruby: JIRA::HTTPError,
  ssl: OpenSSL::SSL::SSLError,
  timeout: [Timeout::Error, Errno::ETIMEDOUT],
  uri: [URI::InvalidURIError, SocketError]
}.freeze
ALL_ERRORS =
ERRORS.values.flatten.freeze

Instance Method Summary collapse

Constructor Details

#initialize(jira_integration, params = {}) ⇒ Base

Returns a new instance of Base.



19
20
21
22
# File 'app/services/jira/requests/base.rb', line 19

def initialize(jira_integration, params = {})
  @project = jira_integration&.project
  @jira_integration = jira_integration
end

Instance Method Details

#executeObject



24
25
26
27
28
# File 'app/services/jira/requests/base.rb', line 24

def execute
  return ServiceResponse.error(message: _('Jira service not configured.')) unless jira_integration&.active?

  request
end