Class: Opium::Pointer

Inherits:
Object show all
Defined in:
lib/opium/extensions/pointer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Pointer

Returns a new instance of Pointer.



3
4
5
6
# File 'lib/opium/extensions/pointer.rb', line 3

def initialize( attributes = {} )
  self.class_name = attributes[:class_name] || attributes[:model_name] || (attributes[:class] || attributes[:model]).model_name
  self.id = attributes[:id]
end

Instance Attribute Details

#class_nameObject Also known as: model_name

Returns the value of attribute class_name.



8
9
10
# File 'lib/opium/extensions/pointer.rb', line 8

def class_name
  @class_name
end

#idObject

Returns the value of attribute id.



8
9
10
# File 'lib/opium/extensions/pointer.rb', line 8

def id
  @id
end

Instance Method Details

#to_parseObject



11
12
13
# File 'lib/opium/extensions/pointer.rb', line 11

def to_parse
  { __type: 'Pointer', className: class_name, objectId: id }.with_indifferent_access
end