gitlab-org--gitlab-foss/app/models/service.rb

67 lines
1.1 KiB
Ruby
Raw Normal View History

2012-11-19 18:14:05 +00:00
# == Schema Information
#
# Table name: services
#
2012-11-20 12:19:55 +00:00
# id :integer not null, primary key
# type :string(255)
# title :string(255)
# token :string(255)
# project_id :integer not null
# created_at :datetime
# updated_at :datetime
2012-11-20 12:19:55 +00:00
# active :boolean default(FALSE), not null
# project_url :string(255)
2013-06-19 12:40:33 +00:00
# subdomain :string(255)
# room :string(255)
# recipients :text
# api_key :string(255)
2012-11-19 18:14:05 +00:00
#
2013-05-22 13:58:44 +00:00
# To add new service you should build a class inherited from Service
# and implement a set of methods
2012-11-19 18:14:05 +00:00
class Service < ActiveRecord::Base
default_value_for :active, false
2012-11-19 18:14:05 +00:00
belongs_to :project
has_one :service_hook
validates :project_id, presence: true
2013-01-03 07:52:14 +00:00
def activated?
active
end
2013-05-22 13:58:44 +00:00
def category
:common
end
2013-05-22 13:58:44 +00:00
def title
# implement inside child
2013-05-22 13:58:44 +00:00
end
def description
# implement inside child
2013-05-22 13:58:44 +00:00
end
def help
# implement inside child
end
2013-05-22 13:58:44 +00:00
def to_param
# implement inside child
2013-05-22 13:58:44 +00:00
end
def fields
# implement inside child
2013-05-22 13:58:44 +00:00
[]
end
def execute
# implement inside child
end
def can_test?
!project.empty_repo?
end
2012-11-19 18:14:05 +00:00
end