Sha256: 8cb6549fa1cd35ba2154da312812564d53b24e129ae6764158623d6f06dd2992

Contents?: true

Size: 1.01 KB

Versions: 30

Compression:

Stored size: 1.01 KB

Contents

module ActiveMerchant #:nodoc:
    
  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

30 entries across 30 versions & 4 rubygems

Version Path
active_shipping-0.12.4 lib/active_shipping/shipping/response.rb
active_shipping-0.12.3 lib/active_shipping/shipping/response.rb
active_shipping-0.12.2 lib/active_shipping/shipping/response.rb
active_shipping-0.12.1 lib/active_shipping/shipping/response.rb
active_shipping-0.12.0 lib/active_shipping/shipping/response.rb
active_shipping-0.11.2 lib/active_shipping/shipping/response.rb
active_shipping-0.11.1 lib/active_shipping/shipping/response.rb
active_shipping-0.11.0 lib/active_shipping/shipping/response.rb
active_shipping-0.10.1 lib/active_shipping/shipping/response.rb
active_shipping-0.10.0 lib/active_shipping/shipping/response.rb
active_shipping-0.9.15 lib/active_shipping/shipping/response.rb
kschadeck-active_shipping-0.9.15 lib/active_shipping/shipping/response.rb
active_shipping-0.9.14 lib/active_shipping/shipping/response.rb
rclements_active_shipping-0.9.15 lib/active_shipping/shipping/response.rb
rclements_active_shipping-0.9.14 lib/active_shipping/shipping/response.rb
rclements_active_shipping-0.9.13 lib/active_shipping/shipping/response.rb
benhutton-active_shipping-0.9.13 lib/active_shipping/shipping/response.rb
active_shipping-0.9.13 lib/active_shipping/shipping/response.rb
active_shipping-0.9.12 lib/active_shipping/shipping/response.rb
active_shipping-0.9.11 lib/active_shipping/shipping/response.rb