Class: CC::Service::PivotalTracker

Inherits:
CC::Service show all
Defined in:
lib/cc/services/pivotal_tracker.rb

Defined Under Namespace

Classes: Config

Constant Summary collapse

BASE_URL =
"https://www.pivotaltracker.com/services/v3"

Constants inherited from CC::Service

ALL_EVENTS, ConfigurationError, Error

Constants included from Helper

Helper::GREEN_HEX, Helper::RED_HEX

Instance Attribute Summary

Attributes inherited from CC::Service

#config, #event, #payload

Instance Method Summary collapse

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, #http, #http_method, #raw_get, #raw_post, #service_get, #service_post

Constructor Details

This class inherits a constructor from CC::Service

Instance Method Details

#receive_issueObject



36
37
38
39
40
41
42
# File 'lib/cc/services/pivotal_tracker.rb', line 36

def receive_issue
  title = %{Fix "#{issue["check_name"]}" issue in #{constant_name}}

  body = [issue["description"], details_url].join("\n\n")

  create_story(title, body)
end

#receive_qualityObject



30
31
32
33
34
# File 'lib/cc/services/pivotal_tracker.rb', line 30

def receive_quality
  name = "Refactor #{constant_name} from #{rating} on Code Climate"

  create_story(name, details_url)
end

#receive_testObject



23
24
25
26
27
28
# File 'lib/cc/services/pivotal_tracker.rb', line 23

def receive_test
  result = create_story("Test ticket from Code Climate", "")
  result.merge(
    message: "Ticket <a href='#{result[:url]}'>#{result[:id]}</a> created."
  )
end

#receive_vulnerabilityObject



44
45
46
47
48
49
50
51
# File 'lib/cc/services/pivotal_tracker.rb', line 44

def receive_vulnerability
  formatter = CC::Formatters::TicketFormatter.new(self)

  create_story(
    formatter.format_vulnerability_title,
    formatter.format_vulnerability_body
  )
end