Class: MC2P::CreateObjectItemMixin
- Inherits:
-
ObjectItemMixin
- Object
- ObjectItemMixin
- MC2P::CreateObjectItemMixin
- Defined in:
- lib/mixins.rb
Overview
Allows create an object item
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from ObjectItemMixin
#_deleted, #json_dict, #resource
Instance Method Summary collapse
-
#_create ⇒ Object
Creates the object item with the json_dict data.
-
#save ⇒ Object
Executes the internal function _create if the object item don’t have id.
Methods inherited from ObjectItemMixin
#id_required_and_not_deleted, #initialize, #to_s
Constructor Details
This class inherits a constructor from MC2P::ObjectItemMixin
Instance Method Details
#_create ⇒ Object
Creates the object item with the json_dict data
55 56 57 58 59 60 |
# File 'lib/mixins.rb', line 55 def _create obj = @resource.create( @json_dict ) @json_dict = obj.json_dict end |
#save ⇒ Object
Executes the internal function _create if the object item don’t have id
63 64 65 |
# File 'lib/mixins.rb', line 63 def save _create unless @json_dict.fetch(@id_property, false) end |