Module: FbGraph::Connections::Tabs

Included in:
Page
Defined in:
lib/fb_graph/connections/tabs.rb

Instance Method Summary collapse

Instance Method Details

#tab!(options = {}) ⇒ Object


13
14
15
# File 'lib/fb_graph/connections/tabs.rb', line 13

def tab!(options = {})
  post options.merge(:connection => :tabs)
end

#tab?(application, options = {}) ⇒ Boolean


17
18
19
20
# File 'lib/fb_graph/connections/tabs.rb', line 17

def tab?(application, options = {})
  tab = self.connection :tabs, options.merge(:connection_scope => application.identifier)
  tab.present?
end

#tab_for_app(application, options = {}) ⇒ Object


22
23
24
25
26
27
28
# File 'lib/fb_graph/connections/tabs.rb', line 22

def tab_for_app(application, options = {})
  response = get options.merge(:connection => :tabs, :connection_scope => application.identifier)
  tab = response[:data].first
  Tab.new tab[:id], tab.merge(
    :access_token => options[:access_token] || self.access_token
  )
end

#tabs(options = {}) ⇒ Object


4
5
6
7
8
9
10
11
# File 'lib/fb_graph/connections/tabs.rb', line 4

def tabs(options = {})
  tabs = self.connection :tabs, options
  tabs.map! do |tab|
    Tab.new tab[:id], tab.merge(
      :access_token => options[:access_token] || self.access_token
    )
  end
end