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

37 lines
786 B
Ruby
Raw Normal View History

2013-11-21 07:18:02 -05:00
class AssemblaService < Service
include HTTParty
2014-09-07 20:54:18 -04:00
prop_accessor :token, :subdomain
2013-11-21 07:18:02 -05:00
validates :token, presence: true, if: :activated?
def title
'Assembla'
end
def description
'Project Management Software (Source Commits Endpoint)'
end
def to_param
'assembla'
end
def fields
[
2014-01-24 02:42:24 -05:00
{ type: 'text', name: 'token', placeholder: '' },
{ type: 'text', name: 'subdomain', placeholder: '' }
2013-11-21 07:18:02 -05:00
]
end
def supported_events
%w(push)
end
def execute(data)
return unless supported_events.include?(data[:object_kind])
2014-01-24 02:42:24 -05:00
url = "https://atlas.assembla.com/spaces/#{subdomain}/github_tool?secret_key=#{token}"
AssemblaService.post(url, body: { payload: data }.to_json, headers: { 'Content-Type' => 'application/json' })
2013-11-21 07:18:02 -05:00
end
end