Commit cd51af1a authored by Tiago Botelho's avatar Tiago Botelho
Browse files

adds events to services api deserialization

parent 9a604212da4d
module ServicesHelper
def service_event_description(event)
case event
when "push"
when "push", "push_events"
"Event will be triggered by a push to the repository"
when "tag_push"
when "tag_push", "tag_push_events"
"Event will be triggered when a new tag is pushed to the repository"
when "note"
when "note", "note_events"
"Event will be triggered when someone adds a comment"
when "issue"
when "issue", "issue_events"
"Event will be triggered when an issue is created/updated/closed"
when "confidential_issue"
when "confidential_issue", "confidential_issue_events"
"Event will be triggered when a confidential issue is created/updated/closed"
when "merge_request"
when "merge_request", "merge_request_events"
"Event will be triggered when a merge request is created/updated/merged"
when "build"
when "build", "build_events"
"Event will be triggered when a build status changes"
when "wiki_page"
when "wiki_page", "wiki_page_events"
"Event will be triggered when a wiki page is created/updated"
when "commit"
when "commit", "commit_events"
"Event will be triggered when a commit is created/updated"
end
end
......
......@@ -25,7 +25,7 @@ def help
http://app.asana.com/-/account_api'
end
def to_param
def self.to_param
'asana'
end
......@@ -44,10 +44,14 @@ def fields
]
end
def supported_events
def self.supported_events
%w(push)
end
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
def client
@_client ||= begin
Asana::Client.new do |c|
......
......@@ -12,7 +12,7 @@ def description
'Project Management Software (Source Commits Endpoint)'
end
def to_param
def self.to_param
'assembla'
end
......@@ -23,10 +23,14 @@ def fields
]
end
def supported_events
def self.supported_events
%w(push)
end
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
def execute(data)
return unless supported_events.include?(data[:object_kind])
......
......@@ -40,7 +40,7 @@ def help
'You must set up automatic revision labeling and a repository trigger in Bamboo.'
end
def to_param
def self.to_param
'bamboo'
end
......@@ -56,7 +56,7 @@ def fields
]
end
def supported_events
def self.supported_events
%w(push)
end
......
......@@ -19,7 +19,15 @@ def description
end
end
def to_param
def self.to_param
'bugzilla'
end
def self.supported_events
%w()
end
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
end
......@@ -24,10 +24,14 @@ def compose_service_hook
hook.save
end
def supported_events
def self.supported_events
%w(push)
end
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
def execute(data)
return unless supported_events.include?(data[:object_kind])
......@@ -54,7 +58,7 @@ def description
'Continuous integration and deployments'
end
def to_param
def self.to_param
'buildkite'
end
......
......@@ -19,14 +19,18 @@ def description
'Email the builds status to a list of recipients.'
end
def to_param
def self.to_param
'builds_email'
end
def supported_events
def self.supported_events
%w(build)
end
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
def execute(push_data)
return unless supported_events.include?(push_data[:object_kind])
return unless should_build_be_notified?(push_data)
......
......@@ -12,7 +12,7 @@ def description
'Simple web-based real-time group chat'
end
def to_param
def self.to_param
'campfire'
end
......@@ -24,10 +24,14 @@ def fields
]
end
def supported_events
def self.supported_events
%w(push)
end
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
def execute(data)
return unless supported_events.include?(data[:object_kind])
......
......@@ -25,7 +25,7 @@ def can_test?
valid?
end
def supported_events
def self.supported_events
%w[push issue confidential_issue merge_request note tag_push
build pipeline wiki_page]
end
......
......@@ -13,8 +13,8 @@ def valid_token?(token)
ActiveSupport::SecurityUtils.variable_size_secure_compare(token, self.token)
end
def supported_events
[]
def self.supported_events
%w()
end
def can_test?
......
......@@ -8,10 +8,13 @@ def valid_token?(token)
self.respond_to?(:token) && self.token.present? && ActiveSupport::SecurityUtils.variable_size_secure_compare(token, self.token)
end
def supported_events
def self.supported_events
%w(push)
end
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
# Return complete url to build page
#
# Ex.
......
......@@ -23,7 +23,7 @@ def description
end
end
def to_param
def self.to_param
'custom_issue_tracker'
end
......@@ -36,4 +36,12 @@ def fields
{ type: 'text', name: 'new_issue_url', placeholder: 'New Issue url' }
]
end
def self.supported_events
%w()
end
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
end
......@@ -5,8 +5,8 @@
class DeploymentService < Service
default_value_for :category, 'deployment'
def supported_events
[]
def self.supported_events
%w()
end
def predefined_variables
......
......@@ -32,7 +32,7 @@ def allow_target_ci?
true
end
def supported_events
def self.supported_events
%w(push merge_request tag_push)
end
......@@ -87,7 +87,7 @@ def description
'Drone is a Continuous Integration platform built on Docker, written in Go'
end
def to_param
def self.to_param
'drone_ci'
end
......
......@@ -12,14 +12,18 @@ def description
'Email the commits and diff of each push to a list of recipients.'
end
def to_param
def self.to_param
'emails_on_push'
end
def supported_events
def self.supported_events
%w(push tag_push)
end
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
def execute(push_data)
return unless supported_events.include?(push_data[:object_kind])
......
......@@ -13,7 +13,7 @@ def description
'Replaces the link to the internal wiki with a link to an external wiki.'
end
def to_param
def self.to_param
'external_wiki'
end
......@@ -29,4 +29,12 @@ def execute(_data)
nil
end
end
def self.supported_events
%w()
end
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
end
......@@ -12,7 +12,7 @@ def description
'Flowdock is a collaboration web app for technical teams.'
end
def to_param
def self.to_param
'flowdock'
end
......@@ -22,10 +22,14 @@ def fields
]
end
def supported_events
def self.supported_events
%w(push)
end
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
def execute(data)
return unless supported_events.include?(data[:object_kind])
......
......@@ -12,7 +12,7 @@ def description
'Gemnasium monitors your project dependencies and alerts you about updates and security vulnerabilities.'
end
def to_param
def self.to_param
'gemnasium'
end
......@@ -23,10 +23,14 @@ def fields
]
end
def supported_events
def self.supported_events
%w(push)
end
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
def execute(data)
return unless supported_events.include?(data[:object_kind])
......
......@@ -7,7 +7,7 @@ class GitlabIssueTrackerService < IssueTrackerService
default_value_for :default, true
def to_param
def self.to_param
'gitlab'
end
......
......@@ -27,7 +27,7 @@ def description
'Private group chat and IM'
end
def to_param
def self.to_param
'hipchat'
end
......@@ -45,10 +45,14 @@ def fields
]
end
def supported_events
def self.supported_events
%w(push issue confidential_issue merge_request note tag_push build)
end
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
def execute(data)
return unless supported_events.include?(data[:object_kind])
message = create_message(data)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment