class MC2P::CRUObjectItem

Object item that allows retrieve, create and change 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 142
def initialize(json_dict, resource)
  @save_mixin = SaveObjectItemMixin.new(json_dict, resource)
  super(json_dict, resource)
end

Public Instance Methods

_change() click to toggle source

Creates the object item with the json_dict data

# File lib/base.rb, line 156
def _change
  @save_mixin.json_dict = @json_dict
  @save_mixin._deleted = @_deleted
  @save_mixin._change
  @json_dict = @save_mixin.json_dict
end
_create() click to toggle source

Creates the object item with the json_dict data

# File lib/base.rb, line 148
def _create
  @save_mixin.json_dict = @json_dict
  @save_mixin._deleted = @_deleted
  @save_mixin._create
  @json_dict = @save_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 164
def save
  @save_mixin.json_dict = @json_dict
  @save_mixin._deleted = @_deleted
  @save_mixin.save
  @json_dict = @save_mixin.json_dict
end