diff options
author | Carlos Paramio <hola@carlosparamio.com> | 2013-11-21 16:18:02 +0400 |
---|---|---|
committer | Carlos Paramio <hola@carlosparamio.com> | 2013-11-21 16:18:02 +0400 |
commit | 4db87f7c4bd46983c1aad8ed7cc7338ca7bbf72e (patch) | |
tree | ed2d258afa5b25bca4e7647a9b5f4ebb4ea6c115 /app | |
parent | 4525fc840547358a270671ff107c3e4967679442 (diff) |
Integration with Assembla
Diffstat (limited to 'app')
-rw-r--r-- | app/models/assembla_service.rb | 45 | ||||
-rw-r--r-- | app/models/project.rb | 3 |
2 files changed, 47 insertions, 1 deletions
diff --git a/app/models/assembla_service.rb b/app/models/assembla_service.rb new file mode 100644 index 00000000000..66ecf394784 --- /dev/null +++ b/app/models/assembla_service.rb @@ -0,0 +1,45 @@ +# == Schema Information +# +# Table name: services +# +# id :integer not null, primary key +# type :string(255) +# title :string(255) +# token :string(255) +# project_id :integer not null +# created_at :datetime not null +# updated_at :datetime not null +# active :boolean default(FALSE), not null +# project_url :string(255) +# subdomain :string(255) +# room :string(255) +# + +class AssemblaService < Service + include HTTParty + + 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 + [ + { type: 'text', name: 'token', placeholder: '' } + ] + end + + def execute(push) + url = "https://atlas.assembla.com/spaces/ouposp/github_tool?secret_key=#{token}" + AssemblaService.post(url, body: { payload: push }.to_json, headers: { 'Content-Type' => 'application/json' }) + end +end diff --git a/app/models/project.rb b/app/models/project.rb index e255f13c42d..eab7c14d6c6 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -50,6 +50,7 @@ class Project < ActiveRecord::Base has_one :pivotaltracker_service, dependent: :destroy has_one :hipchat_service, dependent: :destroy has_one :flowdock_service, dependent: :destroy + has_one :assembla_service, dependent: :destroy has_one :forked_project_link, dependent: :destroy, foreign_key: "forked_to_project_id" has_one :forked_from_project, through: :forked_project_link @@ -224,7 +225,7 @@ class Project < ActiveRecord::Base end def available_services_names - %w(gitlab_ci campfire hipchat pivotaltracker flowdock) + %w(gitlab_ci campfire hipchat pivotaltracker flowdock assembla) end def gitlab_ci? |