Class: FbGraph::Album

Inherits:
Node
  • Object
show all
Includes:
Connections::Comments, Connections::Likes, Connections::Likes::Likable, Connections::Photos, Connections::Picture
Defined in:
lib/fb_graph/album.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#access_token, #endpoint, #identifier, #raw_attributes

Instance Method Summary collapse

Methods included from Connections::Picture

#picture

Methods included from Connections::Likes::Likable

#like!, #unlike!

Methods included from Connections::Likes

#likes

Methods included from Connections::Comments

#comment!, #comments, #reply!

Methods included from Connections::Photos

#photo!, #photos

Methods inherited from Node

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

Methods included from Comparison

#==

Constructor Details

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



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

def initialize(identifier, attributes = {})
  super
  @from = if (from = attributes[:from])
    if from[:category]
      Page.new(from[:id], from)
    else
      User.new(from[:id], from)
    end
  end
  @name = attributes[:name]
  # NOTE:
  # for some reason, facebook uses different parameter names.
  # "description" in GET & "message" in POST
  @description = attributes[:description] || attributes[:message]
  @location    = attributes[:location]
  @link        = attributes[:link]
  @privacy     = attributes[:privacy]
  @count       = attributes[:count]
  @type        = attributes[:type]

  @cover_photo = if attributes[:cover_photo]
    Photo.new(attributes[:cover_photo])
  end
  @created_time = if attributes[:created_time]
    Time.parse(attributes[:created_time]).utc
  end
  @updated_time = if attributes[:updated_time]
    Time.parse(attributes[:updated_time]).utc
  end

  # cached connection
  cache_collection attributes, :comments
end

Instance Attribute Details

#countObject

Returns the value of attribute count



9
10
11
# File 'lib/fb_graph/album.rb', line 9

def count
  @count
end

#cover_photoObject

Returns the value of attribute cover_photo



9
10
11
# File 'lib/fb_graph/album.rb', line 9

def cover_photo
  @cover_photo
end

#created_timeObject

Returns the value of attribute created_time



9
10
11
# File 'lib/fb_graph/album.rb', line 9

def created_time
  @created_time
end

#descriptionObject

Returns the value of attribute description



9
10
11
# File 'lib/fb_graph/album.rb', line 9

def description
  @description
end

#fromObject

Returns the value of attribute from



9
10
11
# File 'lib/fb_graph/album.rb', line 9

def from
  @from
end

Returns the value of attribute link



9
10
11
# File 'lib/fb_graph/album.rb', line 9

def link
  @link
end

#locationObject

Returns the value of attribute location



9
10
11
# File 'lib/fb_graph/album.rb', line 9

def location
  @location
end

#nameObject

Returns the value of attribute name



9
10
11
# File 'lib/fb_graph/album.rb', line 9

def name
  @name
end

#privacyObject

Returns the value of attribute privacy



9
10
11
# File 'lib/fb_graph/album.rb', line 9

def privacy
  @privacy
end

#typeObject

Returns the value of attribute type



9
10
11
# File 'lib/fb_graph/album.rb', line 9

def type
  @type
end

#updated_timeObject

Returns the value of attribute updated_time



9
10
11
# File 'lib/fb_graph/album.rb', line 9

def updated_time
  @updated_time
end

Instance Method Details

#picture_with_access_token(options_or_size = {}) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/fb_graph/album.rb', line 45

def picture_with_access_token(options_or_size = {})
  response = picture_without_access_token options_or_size
  if response.is_a?(FbGraph::Picture)
    response
  else
    _endpoint_ = URI.parse response
    if self.access_token
      _endpoint_.query = [_endpoint_.query, {:access_token => self.access_token.to_s}.to_query].compact.join('&')
    end
    _endpoint_.to_s
  end
end