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
|
2014-04-09 08:05:03 -04:00
|
|
|
# created_at :datetime
|
|
|
|
# updated_at :datetime
|
2012-11-20 07:19:55 -05:00
|
|
|
# active :boolean default(FALSE), not null
|
|
|
|
# project_url :string(255)
|
2013-06-19 08:40:33 -04:00
|
|
|
# subdomain :string(255)
|
|
|
|
# room :string(255)
|
2014-04-09 08:05:03 -04:00
|
|
|
# recipients :text
|
2014-02-18 18:09:16 -05:00
|
|
|
# api_key :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
|
2014-02-26 03:41:44 -05:00
|
|
|
default_value_for :active, false
|
|
|
|
|
2014-02-18 18:09:16 -05:00
|
|
|
attr_accessible :title, :token, :type, :active, :api_key
|
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
|
|
|
|
2014-05-28 04:35:43 -04:00
|
|
|
def category
|
|
|
|
:common
|
|
|
|
end
|
|
|
|
|
2013-05-22 09:58:44 -04:00
|
|
|
def title
|
2013-05-22 10:59:43 -04:00
|
|
|
# implement inside child
|
2013-05-22 09:58:44 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def description
|
2013-05-22 10:59:43 -04:00
|
|
|
# implement inside child
|
2013-05-22 09:58:44 -04:00
|
|
|
end
|
|
|
|
|
2014-05-28 04:35:43 -04:00
|
|
|
def help
|
|
|
|
# implement inside child
|
|
|
|
end
|
|
|
|
|
2013-05-22 09:58:44 -04:00
|
|
|
def to_param
|
2013-05-22 10:59:43 -04:00
|
|
|
# implement inside child
|
2013-05-22 09:58:44 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def fields
|
2013-05-22 10:59:43 -04:00
|
|
|
# implement inside child
|
2013-05-22 09:58:44 -04:00
|
|
|
[]
|
|
|
|
end
|
2013-05-22 10:59:43 -04:00
|
|
|
|
|
|
|
def execute
|
|
|
|
# implement inside child
|
|
|
|
end
|
2013-08-09 14:14:02 -04:00
|
|
|
|
|
|
|
def can_test?
|
|
|
|
!project.empty_repo?
|
|
|
|
end
|
2012-11-19 13:14:05 -05:00
|
|
|
end
|