Class: FbGraph2::TokenMetadata

Inherits:
Node
  • Object
show all
Defined in:
lib/fb_graph2/token_metadata.rb

Instance Attribute Summary

Attributes inherited from Node

#access_token, #id

Instance Method Summary collapse

Methods inherited from Node

#authenticate, #destroy, #edge, #edges, #update

Methods included from AttributeAssigner

#assign

Constructor Details

#initialize(attributes = {}) ⇒ TokenMetadata

Returns a new instance of TokenMetadata.



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/fb_graph2/token_metadata.rb', line 11

def initialize(attributes = {})
  super :debug_token, attributes
  if app_id
    self.app = App.new app_id
  end
  if user_id
    self.user = User.new user_id
  end
  if profile_id
    self.page = Page.new profile_id
  end
end

Instance Method Details

#app_token?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/fb_graph2/token_metadata.rb', line 33

def app_token?
  app.present? && user.blank? && page.blank?
end

#fetch(params = {}, options = {}) ⇒ Object



24
25
26
27
# File 'lib/fb_graph2/token_metadata.rb', line 24

def fetch(params = {}, options = {})
  attributes = get params, options
  self.class.new(attributes[:data]).authenticate access_token
end

#page_token?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/fb_graph2/token_metadata.rb', line 41

def page_token?
  app.present? && user.present? && page.present?
end

#user_token?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/fb_graph2/token_metadata.rb', line 37

def user_token?
  app.present? && user.present? && page.blank?
end

#valid?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/fb_graph2/token_metadata.rb', line 29

def valid?
  !!is_valid
end