Module: MxdTracker::Mxd

Defined in:
lib/mxd_tracker/mxd.rb

Constant Summary collapse

BASE_URL =
"http://www.homedirectusa.com/hdusaoms/trackShipmentBy"

Class Method Summary collapse

Class Method Details

.attribute_information(tracking_hash) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/mxd_tracker/mxd.rb', line 12

def self.attribute_information(tracking_hash)
  raise "No ZipCode" if missing_key_attributes(tracking_hash)
  zip_code = tracking_hash[:zip_code]
  info = {}
  info[:tracking_attribute] = get_tracking_attribute(tracking_hash)
  value = tracking_hash[info[:tracking_attribute]]
  info[:path] = construct_path(info[:tracking_attribute], value, zip_code)
  info
end

.shipment_status(tracking_hash = {}) ⇒ Object



6
7
8
9
10
# File 'lib/mxd_tracker/mxd.rb', line 6

def self.shipment_status(tracking_hash={})
  attribute_info = attribute_information(tracking_hash)
  path = attribute_info[:path]
  MxdTracker::Scraper.get_status(path, tracking_hash[:zip_code])
end