class MC2P::ObjectItemMixin
Basic info of the object item
Attributes
_deleted[RW]
json_dict[RW]
resource[RW]
Public Class Methods
new(json_dict, resource, id_property = 'id')
click to toggle source
# File lib/mixins.rb, line 9 def initialize(json_dict, resource, id_property = 'id') @json_dict = json_dict @resource = resource @_deleted = nil @id_property = id_property end
Public Instance Methods
id_required_and_not_deleted()
click to toggle source
# File lib/mixins.rb, line 16 def id_required_and_not_deleted raise BadUseError('Object don\'t have ID') unless @json_dict.fetch(@id_property, false) raise BadUseError('Object deleted') if @_deleted end
to_s()
click to toggle source
Returns: Name of the object and content
# File lib/mixins.rb, line 23 def to_s "#{self.class.name} #{@json_dict}" end