Module: Packet::Entity::Persistence::ClassMethods

Defined in:
lib/packet/entity/persistence.rb

Instance Method Summary collapse

Instance Method Details

#create!(attributes = {}, client = nil) ⇒ Object



23
24
25
# File 'lib/packet/entity/persistence.rb', line 23

def create!(attributes = {}, client = nil)
  new(attributes, client).tap(&:save!)
end

#destroy!(id, client = nil) ⇒ Object



27
28
29
30
# File 'lib/packet/entity/persistence.rb', line 27

def destroy!(id, client = nil)
  (client || Packet.client).send("delete_#{resource_name}", id)
  true
end