Class: Integrations::ExternalWiki

Inherits:
Integration show all
Defined in:
app/models/integrations/external_wiki.rb

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

Constants inherited from ApplicationRecord

ApplicationRecord::MAX_PLUCK

Constants included from ResetOnUnionError

ResetOnUnionError::MAX_RESET_PERIOD

Instance Attribute Summary

Attributes included from Importable

#imported, #importing

Class Method Summary collapse

Instance Method Summary collapse

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, 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, #show_active_box?, #supported_events, #supports_data_fields?, #test, #testable?, #to_database_hash, #to_param, #updated_properties

Methods included from Gitlab::Utils::Override

#extended, extensions, #included, #method_added, #override, #prepended, #queue_verification, verify!

Methods included from ResetSecretFields

#exposing_secrets_fields

Methods included from Loggable

#build_message, #log_error, #log_exception, #log_info, #logger

Methods inherited from ApplicationRecord

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

Methods included from SensitiveSerializableHash

#serializable_hash

Class Method Details

.supported_eventsObject



49
50
51
# File 'app/models/integrations/external_wiki.rb', line 49

def self.supported_events
  %w[]
end

.to_paramObject



22
23
24
# File 'app/models/integrations/external_wiki.rb', line 22

def self.to_param
  'external_wiki'
end

Instance Method Details

#descriptionObject



18
19
20
# File 'app/models/integrations/external_wiki.rb', line 18

def description
  s_('ExternalWikiService|Link to an external wiki from the sidebar.')
end

#execute(_data) ⇒ Object



42
43
44
45
46
47
# File 'app/models/integrations/external_wiki.rb', line 42

def execute(_data)
  response = Gitlab::HTTP.get(properties['external_wiki_url'], verify: true)
  response.body if response.code == 200
rescue StandardError
  nil
end

#helpObject



26
27
28
29
30
# File 'app/models/integrations/external_wiki.rb', line 26

def help
  docs_link = ActionController::Base.helpers.link_to _('Learn more.'), Rails.application.routes.url_helpers.help_page_url('user/project/wiki/index', anchor: 'link-an-external-wiki'), target: '_blank', rel: 'noopener noreferrer'

  s_('Link an external wiki from the project\'s sidebar. %{docs_link}').html_safe % { docs_link: docs_link.html_safe }
end

#sectionsObject



32
33
34
35
36
37
38
39
40
# File 'app/models/integrations/external_wiki.rb', line 32

def sections
  [
    {
      type: SECTION_TYPE_CONNECTION,
      title: s_('Integrations|Connection details'),
      description: help
    }
  ]
end

#titleObject



14
15
16
# File 'app/models/integrations/external_wiki.rb', line 14

def title
  s_('ExternalWikiService|External wiki')
end