Sha256: d67d38eb71973d6564ee4a5de8ef68a5318c124b54cb0148b2456209a5981006

Contents?: true

Size: 524 Bytes

Versions: 11

Compression:

Stored size: 524 Bytes

Contents

module Seko
  class Dispatch

    def self.line_items(response)
      response.root_response["List"]["DispatchLineItem"]
    end

    # returns array of GUIDs
    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

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
seko-0.0.11 lib/seko/dispatch.rb
seko-0.0.10 lib/seko/dispatch.rb
seko-0.0.9 lib/seko/dispatch.rb
seko-0.0.8 lib/seko/dispatch.rb
seko-0.0.7 lib/seko/dispatch.rb
seko-0.0.6 lib/seko/dispatch.rb
seko-0.0.5 lib/seko/dispatch.rb
seko-0.0.4 lib/seko/dispatch.rb
seko-0.0.3 lib/seko/dispatch.rb
seko-0.0.2 lib/seko/dispatch.rb
seko-0.0.1 lib/seko/dispatch.rb