Class: FbGraph::OpenGraph::Object

Inherits:
Node
  • Object
show all
Defined in:
lib/fb_graph/open_graph/object.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#access_token, #endpoint, #identifier

Instance Method Summary collapse

Methods inherited from Node

#connection, #destroy, fetch, #fetch, #update

Methods included from Comparison

#==

Constructor Details

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

Returns a new instance of Object.



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

def initialize(identifier, attributes = {})
  super
  @raw_attributes = attributes
  [:type, :url, :title, :description, :site_name].each do |key|
    self.send "#{key}=", attributes[key]
  end
  if application = attributes[:application]
    @application = Application.new(application[:id], application)
  end
  @images = []
  if attributes[:image]
    attributes[:image].each do |image|
      @images << image[:url]
    end
  end
  @image = @images.first
  if attributes[:updated_time]
    @updated_time = Time.parse attributes[:updated_time]
  end
end

Instance Attribute Details

#applicationObject

Returns the value of attribute application.



4
5
6
# File 'lib/fb_graph/open_graph/object.rb', line 4

def application
  @application
end

#descriptionObject

Returns the value of attribute description.



4
5
6
# File 'lib/fb_graph/open_graph/object.rb', line 4

def description
  @description
end

#imageObject

Returns the value of attribute image.



4
5
6
# File 'lib/fb_graph/open_graph/object.rb', line 4

def image
  @image
end

#imagesObject

Returns the value of attribute images.



4
5
6
# File 'lib/fb_graph/open_graph/object.rb', line 4

def images
  @images
end

#raw_attributesObject

Returns the value of attribute raw_attributes.



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

def raw_attributes
  @raw_attributes
end

#site_nameObject

Returns the value of attribute site_name.



4
5
6
# File 'lib/fb_graph/open_graph/object.rb', line 4

def site_name
  @site_name
end

#titleObject

Returns the value of attribute title.



4
5
6
# File 'lib/fb_graph/open_graph/object.rb', line 4

def title
  @title
end

#typeObject

Returns the value of attribute type.



4
5
6
# File 'lib/fb_graph/open_graph/object.rb', line 4

def type
  @type
end

#updated_timeObject

Returns the value of attribute updated_time.



4
5
6
# File 'lib/fb_graph/open_graph/object.rb', line 4

def updated_time
  @updated_time
end

#urlObject

Returns the value of attribute url.



4
5
6
# File 'lib/fb_graph/open_graph/object.rb', line 4

def url
  @url
end