Class: FbGraph::Photo
- Inherits:
-
Node
- Object
- Node
- FbGraph::Photo
- Includes:
- Connections::Comments, Connections::Likes, Connections::Likes::Likable, Connections::Picture, Connections::Tags, Connections::Tags::Taggable
- Defined in:
- lib/fb_graph/photo.rb
Direct Known Subclasses
Instance Attribute Summary (collapse)
-
- (Object) created_time
Returns the value of attribute created_time.
-
- (Object) from
Returns the value of attribute from.
-
- (Object) height
Returns the value of attribute height.
-
- (Object) icon
Returns the value of attribute icon.
-
- (Object) images
Returns the value of attribute images.
-
- (Object) link
Returns the value of attribute link.
-
- (Object) name
Returns the value of attribute name.
-
- (Object) position
Returns the value of attribute position.
-
- (Object) source
Returns the value of attribute source.
-
- (Object) updated_time
Returns the value of attribute updated_time.
-
- (Object) width
Returns the value of attribute width.
Attributes inherited from Node
#access_token, #endpoint, #identifier, #raw_attributes
Instance Method Summary (collapse)
-
- (Photo) initialize(identifier, attributes = {})
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::Likable
Methods included from Connections::Likes
Methods included from Connections::Comments
Methods inherited from Node
#connection, #destroy, fetch, #fetch, #update
Methods included from Comparison
Constructor Details
- (Photo) initialize(identifier, attributes = {})
A new instance of Photo
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 12 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 cache_collections attributes, :comments, :likes, :tags end |
Instance Attribute Details
- (Object) created_time
Returns the value of attribute created_time
10 11 12 |
# File 'lib/fb_graph/photo.rb', line 10 def created_time @created_time end |
- (Object) from
Returns the value of attribute from
10 11 12 |
# File 'lib/fb_graph/photo.rb', line 10 def from @from end |
- (Object) height
Returns the value of attribute height
10 11 12 |
# File 'lib/fb_graph/photo.rb', line 10 def height @height end |
- (Object) icon
Returns the value of attribute icon
10 11 12 |
# File 'lib/fb_graph/photo.rb', line 10 def icon @icon end |
- (Object) images
Returns the value of attribute images
10 11 12 |
# File 'lib/fb_graph/photo.rb', line 10 def images @images end |
- (Object) link
Returns the value of attribute link
10 11 12 |
# File 'lib/fb_graph/photo.rb', line 10 def link @link end |
- (Object) name
Returns the value of attribute name
10 11 12 |
# File 'lib/fb_graph/photo.rb', line 10 def name @name end |
- (Object) position
Returns the value of attribute position
10 11 12 |
# File 'lib/fb_graph/photo.rb', line 10 def position @position end |
- (Object) source
Returns the value of attribute source
10 11 12 |
# File 'lib/fb_graph/photo.rb', line 10 def source @source end |
- (Object) updated_time
Returns the value of attribute updated_time
10 11 12 |
# File 'lib/fb_graph/photo.rb', line 10 def updated_time @updated_time end |
- (Object) width
Returns the value of attribute width
10 11 12 |
# File 'lib/fb_graph/photo.rb', line 10 def width @width end |