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.
60 61 62 63 64 65 |
# File 'lib/erp_integration/resources/persistence.rb', line 60 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.
44 45 46 |
# File 'lib/erp_integration/resources/persistence.rb', line 44 def persisted? !id.nil? end |
#update(attributes) ⇒ Boolean
Update an resource in the ERP.
51 52 53 54 55 56 |
# File 'lib/erp_integration/resources/persistence.rb', line 51 def update(attributes) attrs, = self.class.adapter.update(id, **attributes) assign_attributes(attrs) validate_with() end |