Class: WarrantyCheck::DELL

Inherits:
BaseVendor show all
Defined in:
lib/vendors/dell_vendor.rb

Instance Attribute Summary

Attributes inherited from BaseVendor

#dom, #html, #warranties

Instance Method Summary collapse

Methods inherited from BaseVendor

#http_method, #initialize, #uri, #url

Constructor Details

This class inherits a constructor from WarrantyCheck::BaseVendor

Instance Method Details

#checkObject



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
# File 'lib/vendors/dell_vendor.rb', line 13

def check
  @warranties = []
  
  table = dom.search("table.contract_table")
  table.search("tr")[1..-1].to_a.each do |elem|
    tds = elem.search("td")

    details_description = tds[0].text.strip
    details_provider    = tds[1].text.strip
    details_start_date  = Time.strptime(tds[2].text.strip, "%m/%d/%Y")
    details_end_date    = Time.strptime(tds[3].text.strip, "%m/%d/%Y")
    details_days_left   = tds[4].text.strip.to_i
    
    warranty = {
      :description => "#{details_description} (#{details_provider})",
      :expired => (details_days_left == 0 ? true : false),
      :expire_date => details_end_date,
      
      :details => {
        :description => details_description,
        :provider    => details_provider   ,
        :start_date  => details_start_date ,
        :end_date    => details_end_date   ,
        :days_left   => details_days_left  
      }
    }
    
    @warranties << warranty
  end
end

#service_base_urlObject



5
6
7
# File 'lib/vendors/dell_vendor.rb', line 5

def service_base_url
  "http://support.dell.com"
end

#service_uriObject



9
10
11
# File 'lib/vendors/dell_vendor.rb', line 9

def service_uri
  "/support/topics/global.aspx/support/my_systems_info/details?c=us&cs=08&l=en&s=pub&servicetag=%s"
end