Module: ApiRecord::Destroyable
- Extended by:
- ActiveSupport::Concern
- Includes:
- Base, Findable
- Included in:
- All
- Defined in:
- lib/api_record/destroyable.rb
Instance Method Summary
collapse
Methods included from Findable
#new_record?
Methods included from Base
#has_error?, #inspect, #validate!
Instance Method Details
#destroy ⇒ Object
9
10
11
12
13
14
15
16
17
|
# File 'lib/api_record/destroyable.rb', line 9
def destroy
request(:delete, "#{self.class.api_path}/#{id}")
if response.success?
true
else
handle_api_errors()
false
end
end
|
#destroy! ⇒ Object
19
20
21
22
23
24
25
26
|
# File 'lib/api_record/destroyable.rb', line 19
def destroy!
request(:delete, "#{self.class.api_path}/#{id}")
if response.success?
self
else
raise_api_exception()
end
end
|