Method: FbGraph::Video#initialize

Defined in:
lib/fb_graph/video.rb

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

Returns a new instance of Video.



10
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
# File 'lib/fb_graph/video.rb', line 10

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
  @tags = []
  if attributes[:tags]
    Collection.new(attributes[:tags]).each do |tag|
      @tags << Tag.new(tag)
    end
  end
  @name        = attributes[:name]
  @description = attributes[:description]
  @embed_html  = attributes[:embed_html]
  @icon        = attributes[:icon]
  @source      = attributes[:source]
  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
end