iab-BrokerAdapters 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/kerrylondon.rb +20 -3
  2. metadata +3 -2
data/lib/kerrylondon.rb CHANGED
@@ -4,6 +4,10 @@ require 'hpricot'
4
4
 
5
5
  class Kerrylondon
6
6
 
7
+ def Kerrylondon.mapping
8
+ {"Turnover" => "estturnover","ManualWages" => "plwageroll0"}
9
+ end
10
+
7
11
  def Kerrylondon.defaultData
8
12
  {'SOF'=>'STATEMENT',
9
13
  'AgreetoSOF'=>1,
@@ -178,7 +182,7 @@ class Kerrylondon
178
182
  end
179
183
 
180
184
  def Kerrylondon.findPremium(data)
181
- results = ""
185
+ results = "<PremiumQuoteBreakdown>"
182
186
 
183
187
  doc = Hpricot(data)
184
188
  divs = doc.search("//td[@class='infoBoxContents']")
@@ -191,15 +195,28 @@ class Kerrylondon
191
195
  name = e.inner_html
192
196
  next
193
197
  end
194
- results << "#{name.gsub("<b>","").gsub("</b>","")} = #{e.inner_html.gsub("<b>","").gsub("</b>","").gsub("&pound;","")} GBP\n"
198
+ fieldName = "#{name.gsub("<b>","").gsub("</b>","")}"
199
+ case fieldName
200
+ when "Premium" then
201
+ fieldName = "Amount"
202
+ when "IPT" then
203
+ fieldName = "IPTAmount"
204
+ when "TOTAL PAYABLE" then
205
+ fieldName = "GrossAmount"
206
+ when "Documentation Fee" then
207
+ fieldName = "DocumentationFee"
208
+ end
209
+ fieldValue = "#{e.inner_html.gsub("<b>","").gsub("</b>","").gsub("&pound;","")}"
210
+ results << "<#{fieldName}>#{fieldValue}</#{fieldName}>"
195
211
  end
196
212
  else
197
213
  #referral?
198
214
  divs = doc.search("//td[@class='infoBoxContents2']")
199
215
  divs.each do |e|
200
- results << "#{e.inner_html}\n"
216
+ results << "<GrossAmount>#{e.inner_html}</GrossAmount>"
201
217
  end
202
218
  end
219
+ results << "</PremiumQuoteBreakdown>"
203
220
 
204
221
  results
205
222
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iab-BrokerAdapters
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gary Mawdsley
@@ -44,6 +44,7 @@ files:
44
44
  - lib/kerrylondon.rb
45
45
  has_rdoc: true
46
46
  homepage: http://github.com/iab/BrokerAdapters
47
+ licenses:
47
48
  post_install_message:
48
49
  rdoc_options:
49
50
  - --inline-source
@@ -65,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
65
66
  requirements: []
66
67
 
67
68
  rubyforge_project: BrokerAdapters
68
- rubygems_version: 1.2.0
69
+ rubygems_version: 1.3.5
69
70
  signing_key:
70
71
  specification_version: 2
71
72
  summary: BrokerAdapters provides a mechanism for obtaining rates via supplier web sites and xml gateways