Sha256: 61ba4da6bc0ce73d2c2f649387b0efb3daf61dbc9b8cc26bcdafe507962bb68a

Contents?: true

Size: 535 Bytes

Versions: 15

Compression:

Stored size: 535 Bytes

Contents

module CiviCrm
  module Actions
    module Create
      module ClassMethods
        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
      end

      def self.included(base)
        base.extend(ClassMethods)
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
civicrm-1.3.4 lib/civicrm/actions/create.rb
civicrm-1.3.3 lib/civicrm/actions/create.rb
civicrm-1.3.2 lib/civicrm/actions/create.rb
civicrm-1.3.1 lib/civicrm/actions/create.rb
civicrm-1.2.5 lib/civicrm/actions/create.rb
civicrm-1.2.2 lib/civicrm/actions/create.rb
civicrm-1.2.1 lib/civicrm/actions/create.rb
civicrm-1.2.0 lib/civicrm/actions/create.rb
civicrm-1.1.1 lib/civicrm/actions/create.rb
civicrm-1.1.0 lib/civicrm/actions/create.rb
civicrm-1.0.7 lib/civicrm/actions/create.rb
civicrm-1.0.6 lib/civicrm/actions/create.rb
civicrm-1.0.5 lib/civicrm/actions/create.rb
civicrm-1.0.4 lib/civicrm/actions/create.rb
civicrm-1.0.2 lib/civicrm/actions/create.rb