Module: TaskMapper::Provider::Common::ClassMethods

Defined in:
lib/taskmapper/common.rb

Instance Method Summary collapse

Instance Method Details

#create(*options) ⇒ Object

Create a something. Basically, a .new and .save in the same call. The default method assumes it is passed a single hash with attribute information



9
10
11
12
13
14
15
16
17
# File 'lib/taskmapper/common.rb', line 9

def create(*options)
  if self::API.is_a? Class
    something = self::API.new(*options)
    something.save
    self.new something
  else
    raise TaskMapper::Exception.new("#{self.name}::#{this_method} method must be implemented by the provider")
  end
end