Sha256: 48fa391820f2b949ecab4be7e9f3d71c68cd5efc73df89f5929bd0e01fc107bf

Contents?: true

Size: 585 Bytes

Versions: 2

Compression:

Stored size: 585 Bytes

Contents

module Carousel
  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?
      # FIXME: needs to give actual boolean parsed from response
      # @response.parsed["#{@type}_response"]["#{@type}_result"][:status] == '0001'
      true
    end

    def parse_response(xml_response)
      return nil if xml_response.blank?
      XmlSimple.xml_in(xml_response)
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
carousel-ruby-api-0.0.2 lib/carousel/response.rb
carousel-ruby-api-0.0.1 lib/carousel/response.rb