Module: ErpIntegration::Resources::Persistence::ClassMethods

Defined in:
lib/erp_integration/resources/persistence.rb

Instance Method Summary collapse

Instance Method Details

#create(attributes) ⇒ ErpIntegration::Resource

Creates a new resource in the ERP.

Parameters:

  • attributes (Hash)

    A list of attributes for the new resource.

Returns:



14
15
16
17
18
19
20
# File 'lib/erp_integration/resources/persistence.rb', line 14

def create(attributes)
  attrs, error_messages = adapter.create(**attributes)

  new_resource = new(attrs)
  new_resource.validate_with(error_messages)
  new_resource
end