Class: ActiveMerchant::Billing::MultiResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/active_merchant/billing/response.rb

Instance Attribute Summary collapse

Attributes inherited from Response

#authorization, #avs_result, #cvv_result, #message, #params, #test

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Response

#fraud_review?, #test?

Constructor Details

#initializeMultiResponse

Returns a new instance of MultiResponse.



50
51
52
# File 'lib/active_merchant/billing/response.rb', line 50

def initialize
  @responses = []
end

Instance Attribute Details

#responsesObject (readonly)

Returns the value of attribute responses.



48
49
50
# File 'lib/active_merchant/billing/response.rb', line 48

def responses
  @responses
end

Class Method Details

.run(&block) ⇒ Object



44
45
46
# File 'lib/active_merchant/billing/response.rb', line 44

def self.run(&block)
  new.tap(&block)
end

Instance Method Details

#<<(response) ⇒ Object



58
59
60
61
62
63
64
# File 'lib/active_merchant/billing/response.rb', line 58

def <<(response)
  if response.is_a?(MultiResponse)
    response.responses.each{|r| @responses << r}
  else
    @responses << response
  end
end

#processObject



54
55
56
# File 'lib/active_merchant/billing/response.rb', line 54

def process
  self << yield if(responses.empty? || success?)
end

#success?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/active_merchant/billing/response.rb', line 66

def success?
  @responses.all?{|r| r.success?}
end