Class: WarrantyCheck::FUJITSU
Instance Attribute Summary
Attributes inherited from BaseVendor
#dom, #html, #warranties
Instance Method Summary
collapse
Methods inherited from BaseVendor
#initialize, #uri, #url
Instance Method Details
#check ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/vendors/fujitsu_vendor.rb', line 17
def check
@warranties = []
table = dom.search("table").to_a[3]
return unless table.search("tr").to_a.count == 4
td1 = table.search("tr").to_a[1].search("td").to_a[1].text.strip
td2 = table.search("tr").to_a[2].search("td").to_a[1].text.strip
td3 = table.search("tr").to_a[3].search("td").to_a[1].text.strip
return if td1 =~ /^Error/
expiration_date = Time.strptime(td3, "%d/%m/%Y")
warranty = {
:description => sprintf("%s - %s", td1, td2),
:expired => (expiration_date < Time.now ? true : false),
:expire_date => expiration_date
}
@warranties << warranty
end
|
#http_method ⇒ Object
13
14
15
|
# File 'lib/vendors/fujitsu_vendor.rb', line 13
def http_method
:post
end
|
#service_base_url ⇒ Object
5
6
7
|
# File 'lib/vendors/fujitsu_vendor.rb', line 5
def service_base_url
"http://sali.uk.ts.fujitsu.com"
end
|
#service_uri ⇒ Object
9
10
11
|
# File 'lib/vendors/fujitsu_vendor.rb', line 9
def service_uri
"/ServiceEntitlement/service.asp?snr=%s&x=0&y=0&command=search"
end
|