class IbmCase
Attributes
branch_id[RW]
country_code[RW]
country_name[RW]
id[R]
phm[R]
rcms[R]
type[R]
Public Class Methods
new(case_id)
click to toggle source
# File lib/ibm_case.rb, line 14 def initialize(case_id) id = case_id.gsub(',', '.') @id = id self.decode() end
Public Instance Methods
decode()
click to toggle source
-rcms transfer is for a RCMS problem
-id references a RCMS id, provided by IBM support format: rrrrrrr.ccc r: RCMS number c: country code
# File lib/ibm_case.rb, line 47 def decode() if match = %r{^(\w{3})(\w{7})$}.match(@id) #website ID format @country_code = match[1] @rcms = match[2] @type = 'rcms' elsif match2 = %r{^(\w{7})\.(\w{3})$}.match(@id) @rcms = match2[1] @country_code = match2[2] @type = 'rcms' elsif match = %r{^(\w{5})\.(\w{3})\.(\w{3})$}.match(@id) @phm = match[1] @branch_id = match[2] @country_code = match[3] @type = 'pmr' elsif match = %r{^(\w{5})$}.match(@id) @phm = match[1] @type = 'pmr' else pp @id raise 'wrong id, it is not rcms or pmr' end end
id_nice()
click to toggle source
# File lib/ibm_case.rb, line 92 def id_nice self.validate if (@type == 'rcms') return @rcms + '.' + @country_code elsif (@type == 'pmr') return @phm + '.' + @branch_id + '.' + @country_code end end
pmr?()
click to toggle source
# File lib/ibm_case.rb, line 27 def pmr? return true if self.type == 'rcms' false end
project?()
click to toggle source
# File lib/ibm_case.rb, line 32 def project? return true if self.type == 'project' false end
rcms?()
click to toggle source
# File lib/ibm_case.rb, line 22 def rcms? return true if self.type == 'rcms' false end
to_ibmsdduu()
click to toggle source
# File lib/ibm_case.rb, line 103 def to_ibmsdduu self.validate '-' + @type + " -id=" + self.id_nice end
validate()
click to toggle source
# File lib/ibm_case.rb, line 72 def validate unless @type == 'pmr' or @type == 'rcms' or @type == 'project' raise 'wrong type' end if @type == 'pmr' raise 'not setup phm' if @phm.nil? raise 'not setup branch_id' if @branch_id.nil? raise 'not setup country_code' if @country_code.nil? end if @type == 'rcms' raise 'not setup rcms' if @rcms.nil? raise 'not setup country_code' if @country_code.nil? end end