Class: Integrations::SquashTm
Constant Summary
Constants inherited
from Integration
Integration::BASE_CLASSES, Integration::DEV_INTEGRATION_NAMES, Integration::INTEGRATION_NAMES, Integration::PROJECT_SPECIFIC_INTEGRATION_NAMES, Integration::SECTION_TYPE_CONFIGURATION, Integration::SECTION_TYPE_CONNECTION, Integration::SECTION_TYPE_TRIGGER, Integration::SNOWPLOW_EVENT_ACTION, Integration::SNOWPLOW_EVENT_LABEL, Integration::UnknownType
ApplicationRecord::MAX_PLUCK
ResetOnUnionError::MAX_RESET_PERIOD
Instance Attribute Summary
Attributes included from Importable
#imported, #importing
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from HasWebHook
#execute_web_hook!, #hook_ssl_verification, #update_web_hook!
Methods inherited from Integration
#activate_disabled_reason, #activated?, #api_field_names, #async_execute, #attributes, available_integration_names, available_integration_types, boolean_accessor, build_from_integration, #category, #chat?, #ci?, #configurable_events, create_from_active_default_integrations, default_integration, #default_test_event, dev_integration_names, #dup, #editable?, #event_channel_names, event_description, event_names, #event_names, field, #fields, fields, find_or_initialize_all_non_project_specific, find_or_initialize_non_project_specific_integration, #form_fields, #group_level?, #inheritable?, inherited_descendants_from_self_or_ancestors_from, #initialize_properties, instance_exists_for?, #instance_level?, integration_name_to_model, integration_name_to_type, integration_names, #json_fields, #operating?, #parent, #project_level?, project_specific_integration_names, prop_accessor, #properties=, #reencrypt_properties, #reset_updated_properties, #secret_fields, #sections, #show_active_box?, #supported_events, #supports_data_fields?, #testable?, #to_database_hash, #to_param, #updated_properties
#extended, extensions, #included, #method_added, #override, #prepended, #queue_verification, verify!
#exposing_secrets_fields
Methods included from Loggable
#build_message, #log_error, #log_exception, #log_info, #logger
cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
#serializable_hash
Class Method Details
.default_test_event ⇒ Object
55
56
57
|
# File 'app/models/integrations/squash_tm.rb', line 55
def self.default_test_event
'issue'
end
|
.supported_events ⇒ Object
47
48
49
|
# File 'app/models/integrations/squash_tm.rb', line 47
def self.supported_events
%w[issue confidential_issue]
end
|
.to_param ⇒ Object
51
52
53
|
# File 'app/models/integrations/squash_tm.rb', line 51
def self.to_param
'squash_tm'
end
|
Instance Method Details
#description ⇒ Object
29
30
31
|
# File 'app/models/integrations/squash_tm.rb', line 29
def description
s_("SquashTmIntegration|Update Squash TM requirements when GitLab issues are modified.")
end
|
#execute(data) ⇒ Object
59
60
61
62
63
|
# File 'app/models/integrations/squash_tm.rb', line 59
def execute(data)
return unless supported_events.include?(data[:object_kind])
execute_web_hook!(data, "#{data[:object_kind]} Hook")
end
|
#help ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'app/models/integrations/squash_tm.rb', line 33
def help
docs_link = ActionController::Base.helpers.link_to(
_('Learn more.'),
Rails.application.routes.url_helpers.help_page_url('user/project/integrations/squash_tm'),
target: '_blank',
rel: 'noopener noreferrer'
)
Kernel.format(
s_('SquashTmIntegration|Update Squash TM requirements when GitLab issues are modified. %{docs_link}'),
{ docs_link: docs_link.html_safe }
).html_safe
end
|
#hook_url ⇒ Object
74
75
76
|
# File 'app/models/integrations/squash_tm.rb', line 74
def hook_url
format("#{url}%s", ('?token={token}' unless token.blank?))
end
|
#test(data) ⇒ Object
65
66
67
68
69
70
71
|
# File 'app/models/integrations/squash_tm.rb', line 65
def test(data)
result = execute_web_hook!(data, "Test Configuration Hook")
{ success: result.payload[:http_status] == 200, result: result.message }
rescue StandardError => error
{ success: false, result: error.message }
end
|
#title ⇒ Object
25
26
27
|
# File 'app/models/integrations/squash_tm.rb', line 25
def title
'Squash TM'
end
|
#url_variables ⇒ Object
78
79
80
|
# File 'app/models/integrations/squash_tm.rb', line 78
def url_variables
{ 'token' => token }.compact
end
|