service.rb 1.0 KB
Newer Older
1 2 3 4
# == Schema Information
#
# Table name: services
#
D
Dmitriy Zaporozhets 已提交
5 6 7 8 9 10 11 12 13
#  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)
D
Dmitriy Zaporozhets 已提交
14 15
#  subdomain   :string(255)
#  room        :string(255)
16 17
#

18 19
# To add new service you should build a class inherited from Service
# and implement a set of methods
20
class Service < ActiveRecord::Base
D
Dmitriy Zaporozhets 已提交
21
  attr_accessible :title, :token, :type, :active
22 23 24 25 26

  belongs_to :project
  has_one :service_hook

  validates :project_id, presence: true
27 28 29 30

  def activated?
    active
  end
31 32

  def title
33
    # implement inside child
34 35 36
  end

  def description
37
    # implement inside child
38 39 40
  end

  def to_param
41
    # implement inside child
42 43 44
  end

  def fields
45
    # implement inside child
46 47
    []
  end
48 49 50 51

  def execute
    # implement inside child
  end
52
end