Sha256: cb5ecfa84326419fd98aa1ed12bac1e5b4aa69b913c83eb89e8b609e49dee896

Contents?: true

Size: 1.07 KB

Versions: 11

Compression:

Stored size: 1.07 KB

Contents

module ActiveMerchant #:nodoc:
  
  class ActiveMerchantError < StandardError #:nodoc:
  end
  
  module Shipping #:nodoc:
    
    class Error < ActiveMerchant::ActiveMerchantError
    end
    
    class ResponseError < Error
      attr_reader :response
      
      def initialize(response = nil)
        if response.is_a? Response
          super(response.message)
          @response = response
        else
          super(response)
        end
      end      
    end
    
    class Response
      
      attr_reader :params
      attr_reader :message
      attr_reader :test
      attr_reader :xml
      attr_reader :request
        
      def initialize(success, message, params = {}, options = {})
        @success, @message, @params = success, message, params.stringify_keys
        @test = options[:test] || false
        @xml = options[:xml]
        @request = options[:request]
        raise ResponseError.new(self) unless success
      end
    
      def success?
        @success ? true : false
      end

      def test?
        @test ? true : false
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
bcarpenter-active_shipping-0.0.2 lib/active_shipping/shipping/response.rb
bcarpenter-active_shipping-0.0.5 lib/active_shipping/shipping/response.rb
bcarpenter-active_shipping-0.0.6 lib/active_shipping/shipping/response.rb
bcarpenter-active_shipping-0.0.7 lib/active_shipping/shipping/response.rb
active_shipping-0.1.4 lib/active_shipping/shipping/response.rb
active_shipping-0.1.3 lib/active_shipping/shipping/response.rb
active_shipping-0.1.2 lib/active_shipping/shipping/response.rb
active_shipping-0.1.1 lib/active_shipping/shipping/response.rb
active_shipping-0.1.0 lib/active_shipping/shipping/response.rb
active_shipping-0.0.2 lib/active_shipping/shipping/response.rb
active_shipping-0.0.1 lib/active_shipping/shipping/response.rb