Module: CiviCrm::Actions::Create::ClassMethods

Defined in:
lib/civicrm/actions/create.rb

Instance Method Summary collapse

Instance Method Details

#create(attrs = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/civicrm/actions/create.rb', line 5

def create(attrs = {})
  params = {'entity' => entity_class_name, 'action' => 'create'}
  response = CiviCrm::Client.request(:post, params.merge(attrs))

  if response.first.nil?
    raise Error, "Couldn't create #{entity_class_name}"
  end

  Resource.build_from(response.first, params)
end