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

Instance Method Summary collapse

Methods inherited from Response

#fraud_review?, #test?

Constructor Details

#initializeMultiResponse

Returns a new instance of MultiResponse.



35
36
37
# File 'lib/active_merchant/billing/response.rb', line 35

def initialize
  @responses = []
end

Instance Attribute Details

#responsesObject (readonly)

Returns the value of attribute responses.



33
34
35
# File 'lib/active_merchant/billing/response.rb', line 33

def responses
  @responses
end

Instance Method Details

#<<(response) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/active_merchant/billing/response.rb', line 43

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

#processObject



39
40
41
# File 'lib/active_merchant/billing/response.rb', line 39

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

#success?Boolean

Returns:

  • (Boolean)


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

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