module Protip::Resource::Destroyable

Mixin for a resource that has an active ‘:destroy` action. Should be treated as private, and will be included automatically when appropriate.

Public Instance Methods

destroy() click to toggle source
# File lib/protip/resource/destroyable.rb, line 6
def destroy
  raise RuntimeError.new("Can't destroy a non-persisted object") if !persisted?
  self.message = self.class.client.request path: "#{self.class.base_path}/#{id}",
    method: Net::HTTP::Delete,
    message: nil,
    response_type: self.class.message
end