Class: FbGraph::Domain

Inherits:
Node
  • Object
show all
Includes:
Connections::Insights
Defined in:
lib/fb_graph/domain.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#access_token, #endpoint, #identifier, #raw_attributes

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Connections::Insights

#insights

Methods inherited from Node

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

Methods included from Comparison

#==

Constructor Details

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



7
8
9
10
# File 'lib/fb_graph/domain.rb', line 7

def initialize(identifier, attributes = {})
  super
  @name = attributes[:name]
end

Instance Attribute Details

#nameObject

Returns the value of attribute name



5
6
7
# File 'lib/fb_graph/domain.rb', line 5

def name
  @name
end

Class Method Details

.search(domains) ⇒ Object

NOTE:

Don't use Searchable here.
Domain search doesn't return paginatable array.


15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/fb_graph/domain.rb', line 15

def self.search(domains)
  fake_domain = 'fake.com'
  domains = Array(domains)
  unless domains.include?(fake_domain)
    @using_fake = true
    domains << fake_domain
  end
  results = Node.new(nil).send(:get, :domains => domains.join(','))
  results = results.map do |identifier, attributes|
    if @using_fake && attributes[:name] == fake_domain
      next
    end
    new(identifier, attributes)
  end
  results.compact
end