debian-mirror-gitlab/app/models/integrations/shimo.rb

36 lines
744 B
Ruby
Raw Normal View History

2021-12-11 22:18:48 +05:30
# frozen_string_literal: true
module Integrations
2022-06-21 17:19:12 +05:30
class Shimo < BaseThirdPartyWiki
2021-12-11 22:18:48 +05:30
validates :external_wiki_url, presence: true, public_url: true, if: :activated?
2022-08-13 15:12:31 +05:30
field :external_wiki_url,
title: -> { s_('Shimo|Shimo Workspace URL') },
required: true
2021-12-11 22:18:48 +05:30
def render?
valid? && activated?
end
def title
s_('Shimo|Shimo')
end
def description
s_('Shimo|Link to a Shimo Workspace from the sidebar.')
end
def self.to_param
'shimo'
end
# support for `test` method
def execute(_data)
2022-08-13 15:12:31 +05:30
response = Gitlab::HTTP.get(properties['external_wiki_url'], verify: true)
2021-12-11 22:18:48 +05:30
response.body if response.code == 200
rescue StandardError
nil
end
end
end