Sha256: 7fc4bc6f44dfb9b2f0e8f3d45a388620894de5355818c124a8c42cac69d8056d

Contents?: true

Size: 445 Bytes

Versions: 9

Compression:

Stored size: 445 Bytes

Contents

module Kosher
  class Algorithm
    def initialize(response)
      raise ResponseNotValidError unless response.valid?

      @response = response
    end

    def items
      @response.map('Item') do |item|
        Item.build(item)
      end
    end

    def errors
      @response.errors.map do |error|
        error['Message'].scan(/[0-9A-Z]{10}/).first rescue nil
      end.compact
    end

    def response
      @response
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
kosher-0.1.12 lib/kosher/algorithm.rb
kosher-0.1.11 lib/kosher/algorithm.rb
kosher-0.1.10 lib/kosher/algorithm.rb
kosher-0.1.9 lib/kosher/algorithm.rb
kosher-0.1.8 lib/kosher/algorithm.rb
kosher-0.1.7 lib/kosher/algorithm.rb
kosher-0.1.6 lib/kosher/algorithm.rb
kosher-0.1.5 lib/kosher/algorithm.rb
kosher-0.1.4 lib/kosher/algorithm.rb