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

- (Album) initialize(identifier, attributes = {})



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

- (Object) count

Returns the value of attribute count



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

def count
  @count
end

- (Object) cover_photo

Returns the value of attribute cover_photo



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

def cover_photo
  @cover_photo
end

- (Object) created_time

Returns the value of attribute created_time



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

def created_time
  @created_time
end

- (Object) description

Returns the value of attribute description



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

def description
  @description
end

- (Object) from

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

- (Object) location

Returns the value of attribute location



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

def location
  @location
end

- (Object) name

Returns the value of attribute name



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

def name
  @name
end

- (Object) privacy

Returns the value of attribute privacy



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

def privacy
  @privacy
end

- (Object) type

Returns the value of attribute type



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

def type
  @type
end

- (Object) updated_time

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

- (Object) picture_with_access_token(options_or_size = {})



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