Module: ActiveZuora::Amend

Extended by:
ActiveSupport::Concern
Defined in:
lib/active_zuora/amend.rb

Instance Method Summary collapse

Instance Method Details

#amendObject


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/active_zuora/amend.rb', line 17

def amend
  self.result = self.class.connection.request(:amend) do |soap|
    soap.body do |xml| 
      build_xml(xml, soap, 
        :namespace => soap.namespace,
        :element_name => :requests,
        :force_type => true)
    end
  end[:amend_response][:results]
  if result[:success]
    [result[:amendment_ids]].flatten.compact.each_with_index do |id, i|
      amendments[i].id = id
    end
    clear_changed_attributes
    true
  else
    add_zuora_errors(result[:errors])
    false
  end
end

#amend!Object


38
39
40
# File 'lib/active_zuora/amend.rb', line 38

def amend!
  raise "Could not amend: #{errors.full_messages.join ', '}" unless amend
end