Class: RatingEngineResolver

Inherits:
DslContext show all
Defined in:
lib/RatingEngineResolver.rb

Instance Method Summary collapse

Methods inherited from DslContext

bubble, execute, polish_text

Instance Method Details

#channel(name) ⇒ Object



84
85
86
# File 'lib/RatingEngineResolver.rb', line 84

def channel(name) 
    puts " say it has a #{name} channel"  
end

#dictionary(*args) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/RatingEngineResolver.rb', line 7

def dictionary(*args)
  xml = "<?xml version='1.0' encoding='UTF-8'?>"
  xml << "<PolMessage Type='TransactionRequestConfig' Version='1'>" if args[0] == "XML"
  xml << "<PolMessage Type='TransactionRequest' Version='1'>" if args[0] != "XML"
  xml << "<Dictionary DictType='#{args[0]}' DictName='#{args[1]}' DictId='#{args[2]}' DictVer='#{args[3]}'/>"
  xml << "<Transaction TranName='QuotationRequest' EffectiveDate='2007-04-30'/>" if args[0] == "XML"
  xml << "<Transaction TranName='QuoteDetail' EffectiveDate='17/7/2007'/>" if args[0] != "XML"
  xml << "<Schemes><Scheme Ref='#{args[4]}'/></Schemes>"
  @dictHeader=xml   
end

#getResultObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/RatingEngineResolver.rb', line 38

def getResult
  if (@ratingEngine == 'Mock') then
    closure = "lambda {|xml| "
    closure << "response = SBroker.GetMockRatingResponse('#{@mockFile}'); response"
    closure << "}"
    "#{closure}"
  else
    closure = "lambda {|xml| "
    closure << "keep_xml = xml;"
    if (@inboundTransform != nil) then
        closure << "xml = SBroker.ApplyTransform(xml,'#{@inboundTransform}',nil); "
    end
    closure << "msg = \""
    closure << @dictHeader
    closure << "<PolData Type='Request' Selection='#{@responseContent}'/>"
    closure << "<PolData Type='Input'>"
    closure << "\""
    closure << '+ xml +'
    closure << "\""
    closure << "</PolData></PolMessage>"
        #puts '----------\n';p msg;puts '====\n';p response;    
    closure << "\"; response = SBroker.InvokeRTE(msg);"
    closure << "if (partial) then premium = SBroker.ExtractSectionPremium(keep_xml,response);premium else response end"     
    closure << "}"
    "#{closure}"
  end
end

#product(name) ⇒ Object



66
67
68
# File 'lib/RatingEngineResolver.rb', line 66

def product(name)
    puts "say the product is #{name}"
end

#rating_engine(*args) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/RatingEngineResolver.rb', line 18

def rating_engine(*args)
  @ratingEngine = args[0]
  @responseContent = args[1]
  if (args[2] != nil) then
    @inboundTransform = args[2]
  else
    @inboundTransform = nil
  end
  if (args[3] != nil) then
    @outboundTransform = args[3]
  else
    @outboundTransform = nil
  end
  if (args[4] != nil) then
    @mockFile = args[4]
  else
    @mockFile = nil
  end    
end

#supported_channels(*args) ⇒ Object



70
71
72
73
74
75
# File 'lib/RatingEngineResolver.rb', line 70

def supported_channels(*args)
  puts "say supported channels are "
  args.each do |arg|
    puts "say "+arg
  end
end

#supported_processes(*args) ⇒ Object



77
78
79
80
81
82
# File 'lib/RatingEngineResolver.rb', line 77

def supported_processes(*args)
  puts "say supported processes are "
  args.each do |arg|
    puts "say "+arg
  end
end