Module: ErpIntegration::Resources::Persistence
- Included in:
- ErpIntegration::Resource
- Defined in:
- lib/erp_integration/resources/persistence.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
-
#destroy(id) ⇒ Boolean
Destroy an resource in the ERP.
-
#persisted? ⇒ Boolean
Determines whether a ‘ErpIntegration::Resource` is considered to be persisted.
-
#update(attributes) ⇒ Boolean
Update an resource in the ERP.
Class Method Details
.included(base) ⇒ Object
6 7 8 |
# File 'lib/erp_integration/resources/persistence.rb', line 6 def self.included(base) base.extend ClassMethods end |
Instance Method Details
#destroy(id) ⇒ Boolean
Destroy an resource in the ERP.
41 42 43 44 45 46 |
# File 'lib/erp_integration/resources/persistence.rb', line 41 def destroy(id) attrs, = self.class.adapter.destroy(id) assign_attributes(attrs) validate_with() end |
#persisted? ⇒ Boolean
Determines whether a ‘ErpIntegration::Resource` is considered to be persisted.
25 26 27 |
# File 'lib/erp_integration/resources/persistence.rb', line 25 def persisted? !id.nil? end |
#update(attributes) ⇒ Boolean
Update an resource in the ERP.
32 33 34 35 36 37 |
# File 'lib/erp_integration/resources/persistence.rb', line 32 def update(attributes) attrs, = self.class.adapter.update(id, **attributes) assign_attributes(attrs) validate_with() end |