Sha256: 2a2e62156e60279b015f0eac49ad025d34695d6ed42af11dca771ffd898dcf73

Contents?: true

Size: 663 Bytes

Versions: 1

Compression:

Stored size: 663 Bytes

Contents

# works like ActiveMerchant::Billing::Response to maintain compatibility to
# active merchant gateways

module WirecardCheckoutPage
  class InitResponse

    def self.from_typhoeus_response(response)
      new(response.body, original_response: response)
    end

    def initialize(body, original_response: nil)
      @body = body
      @original_response = original_response
    end

    attr_reader :original_response

    attr_reader :body

    def params
      {
        payment_url: @original_response.headers['Location']
      }
    end

    def success?
      !!params[:payment_url]
    end

    def message
      @original_response.body
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wirecard_checkout_page-0.1.0 lib/wirecard_checkout_page/init_response.rb