Class: ActiveProject::Resources::PersistableResource
- Inherits:
-
BaseResource
- Object
- BaseResource
- ActiveProject::Resources::PersistableResource
- Defined in:
- lib/active_project/resources/persistable_resource.rb
Instance Attribute Summary
Attributes inherited from BaseResource
#adapter, #attributes, #raw_data
Instance Method Summary collapse
- #delete ⇒ Object (also: #destroy)
-
#persisted? ⇒ Boolean
Indicates if the resource has been persisted (typically by checking for an ID).
-
#save ⇒ Object
These are now expected to be implemented by concrete subclasses like Issue and Comment, or this class could provide a template that calls conventionally named adapter methods.
- #update(attributes) ⇒ Object
Methods inherited from BaseResource
def_members, #initialize, #inspect, members, #method_missing, #respond_to_missing?, #to_h
Constructor Details
This class inherits a constructor from ActiveProject::Resources::BaseResource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ActiveProject::Resources::BaseResource
Instance Method Details
#delete ⇒ Object Also known as: destroy
22 23 24 |
# File 'lib/active_project/resources/persistable_resource.rb', line 22 def delete raise NotImplementedError, "#{self.class.name} must implement #delete" end |
#persisted? ⇒ Boolean
Indicates if the resource has been persisted (typically by checking for an ID)
7 8 9 |
# File 'lib/active_project/resources/persistable_resource.rb', line 7 def persisted? !id.nil? # Assumes an 'id' member end |
#save ⇒ Object
These are now expected to be implemented by concrete subclasses like Issue and Comment, or this class could provide a template that calls conventionally named adapter methods.
14 15 16 |
# File 'lib/active_project/resources/persistable_resource.rb', line 14 def save raise NotImplementedError, "#{self.class.name} must implement #save" end |
#update(attributes) ⇒ Object
18 19 20 |
# File 'lib/active_project/resources/persistable_resource.rb', line 18 def update(attributes) raise NotImplementedError, "#{self.class.name} must implement #update" end |