Class: FbGraph::AdConnectionObject

Inherits:
Node
  • Object
show all
Defined in:
lib/fb_graph/ad_connection_object.rb

Constant Summary

TYPES =
{
  :page => 1,
  :application => 2,
  :event => 3,
  :place => 6,
  :domain => 7
}
SUPPORTED_PLATFORM_TYPES =
{
  :web => 1,
  :canvas => 2,
  :mobile_web => 3,
  :iphone => 4,
  :ipad => 5,
  :android => 6
}

Instance Attribute Summary collapse

Attributes inherited from Node

#access_token, #endpoint, #identifier, #raw_attributes

Instance Method Summary collapse

Methods inherited from Node

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

Methods included from Comparison

#==

Constructor Details

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

Returns a new instance of AdConnectionObject



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/ad_connection_object.rb', line 22

def initialize(identifier, attributes = {})
  super

  %w(name url type tabs picture).each do |field|
    send("#{field}=", attributes[field.to_sym])
  end

  if self.type == TYPES[:application]
    %w(is_game og_actions og_namespace og_objects supported_platforms).each do |field|
      send("#{field}=", attributes[field.to_sym])
    end
  end

  self.object = if page?
    FbGraph::Page.new(identifier)
  elsif application?
    FbGraph::Application.new(identifier)
  elsif event?
    FbGraph::Event.new(identifier)
  elsif place?
    FbGraph::Place.new(identifier)
  elsif domain?
    FbGraph::Domain.new(identifier)
  end
end

Instance Attribute Details

#is_gameObject

Returns the value of attribute is_game



3
4
5
# File 'lib/fb_graph/ad_connection_object.rb', line 3

def is_game
  @is_game
end

#nameObject

Returns the value of attribute name



3
4
5
# File 'lib/fb_graph/ad_connection_object.rb', line 3

def name
  @name
end

#objectObject

Returns the value of attribute object



3
4
5
# File 'lib/fb_graph/ad_connection_object.rb', line 3

def object
  @object
end

#og_actionsObject

Returns the value of attribute og_actions



3
4
5
# File 'lib/fb_graph/ad_connection_object.rb', line 3

def og_actions
  @og_actions
end

#og_namespaceObject

Returns the value of attribute og_namespace



3
4
5
# File 'lib/fb_graph/ad_connection_object.rb', line 3

def og_namespace
  @og_namespace
end

#og_objectsObject

Returns the value of attribute og_objects



3
4
5
# File 'lib/fb_graph/ad_connection_object.rb', line 3

def og_objects
  @og_objects
end

#pictureObject

Returns the value of attribute picture



3
4
5
# File 'lib/fb_graph/ad_connection_object.rb', line 3

def picture
  @picture
end

#supported_platformsObject

Returns the value of attribute supported_platforms



3
4
5
# File 'lib/fb_graph/ad_connection_object.rb', line 3

def supported_platforms
  @supported_platforms
end

#tabsObject

Returns the value of attribute tabs



3
4
5
# File 'lib/fb_graph/ad_connection_object.rb', line 3

def tabs
  @tabs
end

#typeObject

Returns the value of attribute type



3
4
5
# File 'lib/fb_graph/ad_connection_object.rb', line 3

def type
  @type
end

#urlObject

Returns the value of attribute url



3
4
5
# File 'lib/fb_graph/ad_connection_object.rb', line 3

def url
  @url
end