Sha256: 5025c2dbc60a8ccf8ab511b2092b80fde84bdb4c37a3a8270116b00592a04bd6

Contents?: true

Size: 596 Bytes

Versions: 4

Compression:

Stored size: 596 Bytes

Contents

module Trebbianno
  class Response

    attr_accessor :response

    def initialize(raw_response, type)
      @raw_response = raw_response
      @response     = parse_response(raw_response)
      @type         = type
    end

    def failure?
      !success?
    end

    def success?
      # @response.parsed["#{@type}_response"]["#{@type}_result"][:status] == '0001'
      true
    end

    def parse_response(xml_response)
      blank = xml_response.respond_to?(:empty?) ? !!xml_response.empty? : !xml_response
      return nil if blank
      XmlSimple.xml_in(xml_response)
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
trebbianno-ruby-api-0.0.7 lib/trebbianno/response.rb
trebbianno-ruby-api-0.0.6 lib/trebbianno/response.rb
trebbianno-ruby-api-0.0.5 lib/trebbianno/response.rb
trebbianno-ruby-api-0.0.4 lib/trebbianno/response.rb