Class: Hookers::Changelog::Matchers::ServiceNowMatcher

Inherits:
Matcher
  • Object
show all
Defined in:
lib/hookers/changelog/matchers.rb

Constant Summary

Constants inherited from Matcher

Matcher::SUBPATTERN

Instance Attribute Summary

Attributes inherited from Matcher

#commit, #number

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Matcher

blocks_of, #initialize, #to_affected

Constructor Details

This class inherits a constructor from Hookers::Changelog::Matchers::Matcher

Class Method Details

.scan(commit) ⇒ Object



52
53
54
# File 'lib/hookers/changelog/matchers.rb', line 52

def self.scan(commit)
  blocks_of(commit, /(INC|PRB|TICKET|CHG)(\d+)/).map { |e| new(commit, *e) }
end

Instance Method Details

#identifierObject



66
67
68
# File 'lib/hookers/changelog/matchers.rb', line 66

def identifier
  "#{@type}#{number}"
end

#typeObject



62
63
64
# File 'lib/hookers/changelog/matchers.rb', line 62

def type
  {"chg" => "CHANGE"}.fetch(@type.to_s.downcase, @type.to_s)
end

#uriObject



56
57
58
59
60
# File 'lib/hookers/changelog/matchers.rb', line 56

def uri
  uris = {"chg" => "change_request_list", "inc" => "incident_list", "prb" => "problem_list"}

  "https://lwprod.service-now.com/nav_to.do?uri=#{uris.fetch(@type.to_s.downcase)}.do?sysparm_query=number%3D#{identifier}"
end