Module: Panda::Builders

Included in:
Base
Defined in:
lib/panda/modules/builders.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
# File 'lib/panda/modules/builders.rb', line 4

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

Instance Method Details

#createObject



33
34
35
36
37
38
# File 'lib/panda/modules/builders.rb', line 33

def create
  raise "Can't create attribute. Already have an id=#{attributes['id']}" if attributes['id']
  uri = replace_pattern_with_self_variables(self.class.many_path)
  response = connection.post(uri, attributes)
  load_and_reset(response)
end

#create!Object



40
41
42
# File 'lib/panda/modules/builders.rb', line 40

def create!
  create || raise(errors.last)
end