Class: ExternalWikiService

Inherits:
Service
  • Object
show all
Includes:
HTTParty
Defined in:
app/models/project_services/external_wiki_service.rb

Overview

Schema Information

Table name: services

id                    :integer          not null, primary key
type                  :string
title                 :string
project_id            :integer
created_at            :datetime         not null
updated_at            :datetime         not null
active                :boolean          not null
properties            :text
template              :boolean          default(FALSE)
push_events           :boolean          default(TRUE)
issues_events         :boolean          default(TRUE)
merge_requests_events :boolean          default(TRUE)
tag_push_events       :boolean          default(TRUE)
note_events           :boolean          default(TRUE), not null
build_events          :boolean          default(FALSE), not null
category              :string           default("common"), not null
default               :boolean          default(FALSE)
wiki_page_events      :boolean          default(TRUE)

Instance Method Summary collapse

Methods inherited from Service

#activated?, #async_execute, available_services_names, boolean_accessor, #can_test?, #category, create_from_template, #help, #initialize_properties, #issue_tracker?, prop_accessor, #reset_updated_properties, #supported_events, #template?, #test, #updated_properties

Instance Method Details

#descriptionObject


36
37
38
# File 'app/models/project_services/external_wiki_service.rb', line 36

def description
  'Replaces the link to the internal wiki with a link to an external wiki.'
end

#execute(_data) ⇒ Object


50
51
52
53
54
55
# File 'app/models/project_services/external_wiki_service.rb', line 50

def execute(_data)
  @response = HTTParty.get(properties['external_wiki_url'], verify: true) rescue nil
  if @response !=200
    nil
  end
end

#fieldsObject


44
45
46
47
48
# File 'app/models/project_services/external_wiki_service.rb', line 44

def fields
  [
    { type: 'text', name: 'external_wiki_url', placeholder: 'The URL of the external Wiki' },
  ]
end

#titleObject


32
33
34
# File 'app/models/project_services/external_wiki_service.rb', line 32

def title
  'External Wiki'
end

#to_paramObject


40
41
42
# File 'app/models/project_services/external_wiki_service.rb', line 40

def to_param
  'external_wiki'
end