class MC2P::CRObjectItem

Object item that allows retrieve and create an item

Public Class Methods

new(json_dict, resource) click to toggle source

Initializes an object item Params:

json_dict

Data of the object

resource

Resource used to delete, save, create or retrieve the object

Calls superclass method MC2P::ReadOnlyObjectItem::new
# File lib/base.rb, line 114
def initialize(json_dict, resource)
  @create_mixin = CreateObjectItemMixin.new(json_dict, resource)
  super(json_dict, resource)
end

Public Instance Methods

_create() click to toggle source

Creates the object item with the json_dict data

# File lib/base.rb, line 120
def _create
  @create_mixin.json_dict = @json_dict
  @create_mixin._deleted = @_deleted
  @create_mixin._create
  @json_dict = @create_mixin.json_dict
end
save() click to toggle source

Executes the internal function _create if the object item don't have id

# File lib/base.rb, line 128
def save
  @create_mixin.json_dict = @json_dict
  @create_mixin._deleted = @_deleted
  @create_mixin.save
  @json_dict = @create_mixin.json_dict
end