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

57 lines
1.1 KiB
Ruby
Raw Normal View History

2012-11-19 13:14:05 -05:00
# == Schema Information
#
# Table name: services
#
2012-11-20 07:19:55 -05:00
# 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)
2013-06-19 08:40:33 -04:00
# subdomain :string(255)
# room :string(255)
2012-11-19 13:14:05 -05:00
#
2013-05-22 09:58:44 -04:00
# To add new service you should build a class inherited from Service
# and implement a set of methods
2012-11-19 13:14:05 -05:00
class Service < ActiveRecord::Base
2012-11-19 14:34:05 -05:00
attr_accessible :title, :token, :type, :active
2012-11-19 13:14:05 -05:00
belongs_to :project
has_one :service_hook
validates :project_id, presence: true
2013-01-03 02:52:14 -05:00
def activated?
active
end
2013-05-22 09:58:44 -04:00
def title
# implement inside child
2013-05-22 09:58:44 -04:00
end
def description
# implement inside child
2013-05-22 09:58:44 -04:00
end
def to_param
# implement inside child
2013-05-22 09:58:44 -04:00
end
def fields
# implement inside child
2013-05-22 09:58:44 -04:00
[]
end
def execute
# implement inside child
end
def can_test?
!project.empty_repo?
end
2012-11-19 13:14:05 -05:00
end