Class: Parse::Pointer

Inherits:
Object
  • Object
show all
Defined in:
lib/parse/datatypes.rb

Overview

Pointer


Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Pointer

Returns a new instance of Pointer.



12
13
14
15
# File 'lib/parse/datatypes.rb', line 12

def initialize(data)
  @class_name       = data[Protocol::KEY_CLASS_NAME]
  @parse_object_id  = data[Protocol::KEY_OBJECT_ID]
end

Instance Attribute Details

#class_nameObject

Returns the value of attribute class_name.



10
11
12
# File 'lib/parse/datatypes.rb', line 10

def class_name
  @class_name
end

#parse_object_idObject

Returns the value of attribute parse_object_id.



9
10
11
# File 'lib/parse/datatypes.rb', line 9

def parse_object_id
  @parse_object_id
end

Instance Method Details

#getObject

Retrieve the Parse object referenced by this pointer.



26
27
28
# File 'lib/parse/datatypes.rb', line 26

def get
  Parse.get @class_name, @parse_object_id
end

#to_json(*a) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/parse/datatypes.rb', line 17

def to_json(*a)
  {
      Protocol::KEY_TYPE        => Protocol::TYPE_POINTER,
      Protocol::KEY_CLASS_NAME  => @class_name,
      Protocol::KEY_OBJECT_ID   => @parse_object_id
  }.to_json(*a)
end