Sha256: 2e39e34b7e587113241d0c911136e965d8ee3f40f94478a38e14cde4aae8d938
Contents?: true
Size: 877 Bytes
Versions: 1
Compression:
Stored size: 877 Bytes
Contents
module Moiper class Response # @param body [String] the response body from Moip def initialize(body) @body = body end # Detects if the response was successfully # @return [Boolean] def success? parsed_body.css("Status").text == "Sucesso" end # @return [String, nil] the URL which the user should be redirected # to finish payment process or nil if the request was not successfully def checkout_url Moiper.api_entrypoint + "Instrucao.do?token=" + token if success? end # @return [String] the response token def token parsed_body.css("Token").text end # List the possible errors returned by Moip # @return [Array<String>] def errors parsed_body.css("Erro").map(&:text) end private def parsed_body @parsed_body ||= Nokogiri::XML(@body) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
moiper-0.1.2 | lib/moiper/response.rb |