Class: WarrantyCheck::IBM
Instance Attribute Summary
Attributes inherited from BaseVendor
#dom, #html, #warranties
Instance Method Summary
collapse
Methods inherited from BaseVendor
#http_method, #initialize, #uri, #url
Instance Method Details
#check ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/vendors/ibm_vendor.rb', line 13
def check
@warranties = []
table = dom.search("div table:nth-child(2)")
return if table.search("tr").to_a.count == 0
tds1 = table.search("tr").to_a[1].search("td")
tds2 = table.search("tr").to_a[5].search("td")
details_product_id = tds1[0].text.strip
details_type_model = tds1[2].text.strip
details_serial_number = tds1[4].text.strip
details_location = tds2[0].text.strip
details_expiration_date = Time.strptime(tds2[2].text.strip, "%Y-%m-%d")
warranty = {
:description => "",
:expired => (details_expiration_date < Time.now ? true : false),
:expire_date => details_expiration_date,
:details => {
:product_id => details_product_id ,
:type_model => details_type_model ,
:serial_number => details_serial_number ,
:location => details_location ,
:expiration_date => details_expiration_date,
}
}
@warranties << warranty
end
|
#service_base_url ⇒ Object
5
6
7
|
# File 'lib/vendors/ibm_vendor.rb', line 5
def service_base_url
"http://support.lenovo.com"
end
|
#service_uri ⇒ Object
9
10
11
|
# File 'lib/vendors/ibm_vendor.rb', line 9
def service_uri
"/templatedata/Web%%20Content/JSP/warrantyLookup.jsp?sysSerial=%s"
end
|