class Seko::Dispatch

Public Class Methods

line_items(response) click to toggle source
# File lib/seko/dispatch.rb, line 4
def self.line_items(response)
  response.root_response["List"]["DispatchLineItem"]
end
parse(response) click to toggle source

returns array of GUIDs

# File lib/seko/dispatch.rb, line 9
def self.parse(response)
  dispatches = line_items(response)
  # API is flawed and returns an array if multiple dispatches
  if dispatches.is_a?(Array)
    dispatches.collect { |h| h["GUID"] }
  else
    # and a singular object otherwise
    # so we wrap it as an array
    Array(dispatches["GUID"])
  end
end