gitlab-org--gitlab-foss/app/models/project_services/flowdock_service.rb

44 lines
946 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class FlowdockService < Service
2014-09-07 20:54:18 -04:00
prop_accessor :token
validates :token, presence: true, if: :activated?
def title
'Flowdock'
end
def description
'Flowdock is a collaboration web app for technical teams.'
end
def self.to_param
'flowdock'
end
def fields
[
{ type: 'text', name: 'token', placeholder: 'Flowdock Git source token', required: true }
]
end
def self.supported_events
%w(push)
end
2015-02-20 08:49:26 -05:00
def execute(data)
return unless supported_events.include?(data[:object_kind])
Flowdock::Git.post(
2015-02-20 08:49:26 -05:00
data[:ref],
data[:before],
data[:after],
token: token,
repo: project.repository,
repo_url: "#{Gitlab.config.gitlab.url}/#{project.full_path}",
commit_url: "#{Gitlab.config.gitlab.url}/#{project.full_path}/commit/%s",
diff_url: "#{Gitlab.config.gitlab.url}/#{project.full_path}/compare/%s...%s"
2015-12-14 21:53:52 -05:00
)
end
end