2013-12-17 05:42:40 -05:00
|
|
|
# == 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
|
2014-04-09 08:05:03 -04:00
|
|
|
# created_at :datetime
|
|
|
|
# updated_at :datetime
|
2013-12-17 05:42:40 -05:00
|
|
|
# active :boolean default(FALSE), not null
|
|
|
|
# project_url :string(255)
|
|
|
|
# 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)
|
2013-12-17 05:42:40 -05:00
|
|
|
#
|
|
|
|
|
|
|
|
class EmailsOnPushService < Service
|
|
|
|
attr_accessible :recipients
|
|
|
|
|
|
|
|
validates :recipients, presence: true, if: :activated?
|
|
|
|
|
|
|
|
def title
|
|
|
|
'Emails on push'
|
|
|
|
end
|
|
|
|
|
|
|
|
def description
|
2013-12-17 09:31:12 -05:00
|
|
|
'Email the commits and diff of each push to a list of recipients.'
|
2013-12-17 05:42:40 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def to_param
|
|
|
|
'emails_on_push'
|
|
|
|
end
|
|
|
|
|
2013-12-17 07:45:55 -05:00
|
|
|
def execute(push_data)
|
2013-12-18 06:42:12 -05:00
|
|
|
EmailsOnPushWorker.perform_async(project_id, recipients, push_data)
|
2013-12-17 05:42:40 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def fields
|
|
|
|
[
|
2013-12-17 05:58:44 -05:00
|
|
|
{ type: 'textarea', name: 'recipients', placeholder: 'Emails separated by whitespace' },
|
2013-12-17 05:42:40 -05:00
|
|
|
]
|
|
|
|
end
|
|
|
|
end
|