Sha256: b8103e0382052102a6bb1d6669f0bc08d145f2c1dcf2bbabdba338851be69ee3

Contents?: true

Size: 543 Bytes

Versions: 1

Compression:

Stored size: 543 Bytes

Contents

module Fpswax
  class Response
    attr_reader :request_id, :errors
    def initialize(xml)
      # parse any errors
      @errors = xml.css('Response Errors Error').map do |error|
        code = error.css('Code')[0].content
        message = error.css('Message')[0].content
        Fpswax::Error.new(code, message)
      end

      if @errors.empty?
        @request_id = xml.css('RequestId')[0].content
      else
        @request_id = xml.css('RequestID')[0].content
      end
    end

    def valid?
      @errors.empty?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dbalatero-fpswax-0.0.1 lib/fpswax/response.rb