Class: FbGraph::Link

Inherits:
Node
  • Object
show all
Includes:
Connections::Comments
Defined in:
lib/fb_graph/link.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#access_token, #endpoint, #identifier

Instance Method Summary collapse

Methods included from Connections::Comments

#comment!, #comments, #like!, #unlike!

Methods inherited from Node

#connection, #destroy, fetch, #fetch

Methods included from Comparison

#==

Constructor Details

#initialize(identifier, attributes = {}) ⇒ Link

Returns a new instance of Link.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/fb_graph/link.rb', line 7

def initialize(identifier, attributes = {})
  super
  if (from = attributes[:from])
    @from = if from[:category]
      FbGraph::Page.new(from.delete(:id), from)
    else
      FbGraph::User.new(from.delete(:id), from)
    end
  end
  @name        = attributes[:name]
  @link        = attributes[:link]
  @caption     = attributes[:caption]
  @description = attributes[:description]
  @icon        = attributes[:icon]
  @picture     = attributes[:picture] # NOTE: this is external image, so isn't connection.
  @message     = attributes[:message]
  if attributes[:created_time]
    @created_time = Time.parse(attributes[:created_time]).utc
  end
end

Instance Attribute Details

#captionObject

Returns the value of attribute caption.



5
6
7
# File 'lib/fb_graph/link.rb', line 5

def caption
  @caption
end

#created_timeObject

Returns the value of attribute created_time.



5
6
7
# File 'lib/fb_graph/link.rb', line 5

def created_time
  @created_time
end

#descriptionObject

Returns the value of attribute description.



5
6
7
# File 'lib/fb_graph/link.rb', line 5

def description
  @description
end

#fromObject

Returns the value of attribute from.



5
6
7
# File 'lib/fb_graph/link.rb', line 5

def from
  @from
end

#iconObject

Returns the value of attribute icon.



5
6
7
# File 'lib/fb_graph/link.rb', line 5

def icon
  @icon
end

Returns the value of attribute link.



5
6
7
# File 'lib/fb_graph/link.rb', line 5

def link
  @link
end

#messageObject

Returns the value of attribute message.



5
6
7
# File 'lib/fb_graph/link.rb', line 5

def message
  @message
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/fb_graph/link.rb', line 5

def name
  @name
end

#pictureObject

Returns the value of attribute picture.



5
6
7
# File 'lib/fb_graph/link.rb', line 5

def picture
  @picture
end