Module: ActiveZuora::Subscribe

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

Instance Method Summary collapse

Instance Method Details

#subscribeObject


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

def subscribe
  self.result = self.class.connection.request(:subscribe) do |soap|
    soap.body do |xml| 
      build_xml(xml, soap, 
        :namespace => soap.namespace,
        :element_name => :subscribes,
        :force_type => true)
    end
  end[:subscribe_response][:result]
  if result[:success]
    .id = result[:account_id]
    subscription_data.subscription.id = result[:subscription_id]
    clear_changed_attributes
    true
  else
    add_zuora_errors(result[:errors])
    false
  end
end

#subscribe!Object


37
38
39
# File 'lib/active_zuora/subscribe.rb', line 37

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