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

45 lines
1006 B
Ruby
Raw Normal View History

2013-11-21 12:18:02 +00:00
# == Schema Information
#
# Table name: services
#
2014-10-09 15:22:20 +00:00
# id :integer not null, primary key
# type :string(255)
# title :string(255)
# project_id :integer not null
# created_at :datetime
# updated_at :datetime
# active :boolean default(FALSE), not null
# properties :text
2013-11-21 12:18:02 +00:00
#
class AssemblaService < Service
include HTTParty
2014-09-08 00:54:18 +00:00
prop_accessor :token, :subdomain
2013-11-21 12:18:02 +00: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 07:42:24 +00:00
{ type: 'text', name: 'token', placeholder: '' },
{ type: 'text', name: 'subdomain', placeholder: '' }
2013-11-21 12:18:02 +00:00
]
end
def execute(push)
2014-01-24 07:42:24 +00:00
url = "https://atlas.assembla.com/spaces/#{subdomain}/github_tool?secret_key=#{token}"
2013-11-21 12:18:02 +00:00
AssemblaService.post(url, body: { payload: push }.to_json, headers: { 'Content-Type' => 'application/json' })
end
end