Class: CC::Service::Slack

Inherits:
CC::Service show all
Includes:
QualityHelper
Defined in:
lib/cc/services/slack.rb

Defined Under Namespace

Classes: Config

Constant Summary

Constants inherited from CC::Service

ABSTRACT_SLUGS, ALL_EVENTS, ConfigurationError, Error

Constants included from Helper

Helper::GREEN_HEX, Helper::RED_HEX

Constants included from HTTP

HTTP::REDIRECT_CODES

Instance Attribute Summary

Attributes inherited from CC::Service

#config, #event, #payload

Instance Method Summary collapse

Methods included from QualityHelper

#constant_basename, #constant_name, #improved?, #previous_rating, #previous_remediation_cost, #quality_title, #rating, #remediation_cost, #with_article

Methods inherited from CC::Service

by_slug, inherited, #initialize, load_services, #receive, services, slug

Methods included from Helper

#changed, #color, #compare_url, #details_url, #emoji, #hex_color, #improved?, #repo_name

Methods included from HTTP

#ca_file, #formatted_post_response, #http, #http_method, #raw_get, #raw_post, #service_get, #service_post, #service_post_with_redirects

Constructor Details

This class inherits a constructor from CC::Service

Instance Method Details

#receive_coverageObject



29
30
31
# File 'lib/cc/services/slack.rb', line 29

def receive_coverage
  speak(formatter.format_coverage, hex_color)
end

#receive_snapshotObject



25
26
27
# File 'lib/cc/services/slack.rb', line 25

def receive_snapshot
  send_snapshot_to_slack(CC::Formatters::SnapshotFormatter::Base.new(payload))
end

#receive_testObject



17
18
19
20
21
22
23
# File 'lib/cc/services/slack.rb', line 17

def receive_test
  # payloads for test receivers include the weekly quality report.
  send_snapshot_to_slack(CC::Formatters::SnapshotFormatter::Sample.new(payload))
  speak(formatter.format_test).merge(
    message: "Test message sent"
  )
end

#receive_vulnerabilityObject



33
34
35
# File 'lib/cc/services/slack.rb', line 33

def receive_vulnerability
  speak(formatter.format_vulnerability)
end