Class: HermesAPI::WebTracking

Inherits:
ActiveResource::Base
  • Object
show all
Defined in:
lib/hermes_api/resources/web_tracking.rb

Constant Summary collapse

MAPPING =
{
  "715" => "pending_drop_off",
  "708" => "dropped_off",
  "690" => "dropped_off",
  "710" => "collected_by_courier",
  "688" => "collected_by_courier",
  "689" => "collected_by_courier",
  "711" => "collected_by_courier"
}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.find(barcode) ⇒ Object



29
30
31
32
33
34
# File 'lib/hermes_api/resources/web_tracking.rb', line 29

def self.find(barcode)
  uniqueId = format.decode(connection.get("#{prefix}/search/#{barcode}", headers).body).first
  return nil if uniqueId.nil?

  find_single("", params: {uniqueIds: uniqueId})
end

Instance Method Details

#load(attributes, remove_root = false, persisted = false) ⇒ Object



23
24
25
26
27
# File 'lib/hermes_api/resources/web_tracking.rb', line 23

def load(attributes, remove_root = false, persisted = false)
  attributes = attributes.dig("results", 0)
  attributes.deep_transform_keys! { |k| k.to_s.underscore }
  super
end