Class: Integrations::SlackInteractions::IncidentManagement::IncidentModalClosedService

Inherits:
Object
  • Object
show all
Defined in:
app/services/integrations/slack_interactions/incident_management/incident_modal_closed_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ IncidentModalClosedService

Returns a new instance of IncidentModalClosedService.



7
8
9
# File 'app/services/integrations/slack_interactions/incident_management/incident_modal_closed_service.rb', line 7

def initialize(params)
  @params = params
end

Instance Method Details

#executeObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/services/integrations/slack_interactions/incident_management/incident_modal_closed_service.rb', line 11

def execute
  begin
    response = close_modal
  rescue *Gitlab::HTTP::HTTP_ERRORS => e
    return ServiceResponse
      .error(message: 'HTTP exception when calling Slack API')
      .track_exception(
        params: params,
        as: e.class
      )
  end

  return ServiceResponse.success if response['ok']

  ServiceResponse.error(
    message: _('Something went wrong while closing the incident form.'),
    payload: response
  ).track_exception(
    response: response.to_h,
    params: params
  )
end