Class: FbGraph::Photo
- Includes:
- Connections::Comments, Connections::Likes, Connections::Picture, Connections::Tags, Connections::Tags::Taggable
- Defined in:
- lib/fb_graph/photo.rb
Instance Attribute Summary collapse
-
#created_time ⇒ Object
Returns the value of attribute created_time.
-
#from ⇒ Object
Returns the value of attribute from.
-
#height ⇒ Object
Returns the value of attribute height.
-
#icon ⇒ Object
Returns the value of attribute icon.
-
#images ⇒ Object
Returns the value of attribute images.
-
#link ⇒ Object
Returns the value of attribute link.
-
#name ⇒ Object
Returns the value of attribute name.
-
#position ⇒ Object
Returns the value of attribute position.
-
#source ⇒ Object
Returns the value of attribute source.
-
#updated_time ⇒ Object
Returns the value of attribute updated_time.
-
#width ⇒ Object
Returns the value of attribute width.
Attributes inherited from Node
#access_token, #endpoint, #identifier
Instance Method Summary collapse
-
#initialize(identifier, attributes = {}) ⇒ Photo
constructor
A new instance of Photo.
Methods included from Connections::Tags::Taggable
Methods included from Connections::Tags
Methods included from Connections::Picture
Methods included from Connections::Likes
Methods included from Connections::Comments
#comment!, #comments, #like!, #unlike!
Methods inherited from Node
#connection, #destroy, fetch, #fetch, #update
Methods included from Comparison
Constructor Details
#initialize(identifier, attributes = {}) ⇒ Photo
Returns a new instance of Photo.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/fb_graph/photo.rb', line 11 def initialize(identifier, attributes = {}) super if (from = attributes[:from]) @from = if from[:category] Page.new(from[:id], from) else User.new(from[:id], from) end end # NOTE: # for some reason, facebook uses different parameter names. # "name" in GET & "message" in POST @name = attributes[:name] || attributes[:message] @icon = attributes[:icon] @source = attributes[:source] @height = attributes[:height] @width = attributes[:width] @link = attributes[:link] @position = attributes[:position] @images = [] if attributes[:images] attributes[:images].each do |image| @images << Image.new(image) end end if attributes[:created_time] @created_time = Time.parse(attributes[:created_time]).utc end if attributes[:updated_time] @updated_time = Time.parse(attributes[:updated_time]).utc end # cached connection @_tags_ = Collection.new(attributes[:tags]) @_comments_ = Collection.new(attributes[:comments]) end |
Instance Attribute Details
#created_time ⇒ Object
Returns the value of attribute created_time.
9 10 11 |
# File 'lib/fb_graph/photo.rb', line 9 def created_time @created_time end |
#from ⇒ Object
Returns the value of attribute from.
9 10 11 |
# File 'lib/fb_graph/photo.rb', line 9 def from @from end |
#height ⇒ Object
Returns the value of attribute height.
9 10 11 |
# File 'lib/fb_graph/photo.rb', line 9 def height @height end |
#icon ⇒ Object
Returns the value of attribute icon.
9 10 11 |
# File 'lib/fb_graph/photo.rb', line 9 def icon @icon end |
#images ⇒ Object
Returns the value of attribute images.
9 10 11 |
# File 'lib/fb_graph/photo.rb', line 9 def images @images end |
#link ⇒ Object
Returns the value of attribute link.
9 10 11 |
# File 'lib/fb_graph/photo.rb', line 9 def link @link end |
#name ⇒ Object
Returns the value of attribute name.
9 10 11 |
# File 'lib/fb_graph/photo.rb', line 9 def name @name end |
#position ⇒ Object
Returns the value of attribute position.
9 10 11 |
# File 'lib/fb_graph/photo.rb', line 9 def position @position end |
#source ⇒ Object
Returns the value of attribute source.
9 10 11 |
# File 'lib/fb_graph/photo.rb', line 9 def source @source end |
#updated_time ⇒ Object
Returns the value of attribute updated_time.
9 10 11 |
# File 'lib/fb_graph/photo.rb', line 9 def updated_time @updated_time end |
#width ⇒ Object
Returns the value of attribute width.
9 10 11 |
# File 'lib/fb_graph/photo.rb', line 9 def width @width end |