Sha256: aee143ab27321277efda6d8f5f4337b8afd10d887fcdd7c574278ca8a4290303

Contents?: true

Size: 482 Bytes

Versions: 3

Compression:

Stored size: 482 Bytes

Contents

module Moiper
  class Response
    def initialize(body)
      @body = body
    end

    def success?
      parsed_body.css("Status").text == "Sucesso"
    end

    def checkout_url
      Moiper.api_entrypoint + "Instrucao.do?token=" + token if success?
    end

    def token
      parsed_body.css("Token").text
    end

    def errors
      parsed_body.css("Erro").map(&:text)
    end

    private

    def parsed_body
      @parsed_body ||= Nokogiri::XML(@body)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
moiper-0.1.1 lib/moiper/response.rb
moiper-0.1.0 lib/moiper/response.rb
moiper-0.0.1 lib/moiper/response.rb