Class: FbGraph::Application

Instance Attribute Summary collapse

Attributes inherited from Node

#access_token, #endpoint, #identifier

Instance Method Summary collapse

Methods included from Connections::Videos

#videos

Methods included from Connections::TestUsers

#test_user!, #test_users

Methods included from Connections::Tagged

#tagged

Methods included from Connections::Subscriptions

#subscribe!, #subscriptions, #unsubscribe!

Methods included from Connections::Statuses

#statuses

Methods included from Connections::Posts

#posts

Methods included from Connections::Picture

#picture

Methods included from Connections::Photos

#photo!, #photos

Methods included from Connections::Payments

#payments

Methods included from Connections::Notes

#note!, #notes

Methods included from Connections::Links

#link!, #links

Methods included from Connections::Insights

#insights

Methods included from Connections::Feed

#feed, #feed!

Methods included from Connections::Events

#event!, #events

Methods included from Connections::Albums

#album!, #albums

Methods inherited from Node

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

Methods included from Comparison

#==

Constructor Details

#initialize(client_id, attributes = {}) ⇒ Application

Returns a new instance of Application.



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

def initialize(client_id, attributes = {})
  super
  @name         = attributes[:name]
  @description  = attributes[:description]
  @category     = attributes[:category]
  @link         = attributes[:link]
  @secret       = attributes[:secret]
end

Instance Attribute Details

#categoryObject

Returns the value of attribute category.



19
20
21
# File 'lib/fb_graph/application.rb', line 19

def category
  @category
end

#descriptionObject

Returns the value of attribute description.



19
20
21
# File 'lib/fb_graph/application.rb', line 19

def description
  @description
end

Returns the value of attribute link.



19
20
21
# File 'lib/fb_graph/application.rb', line 19

def link
  @link
end

#nameObject

Returns the value of attribute name.



19
20
21
# File 'lib/fb_graph/application.rb', line 19

def name
  @name
end

#secretObject

Returns the value of attribute secret.



19
20
21
# File 'lib/fb_graph/application.rb', line 19

def secret
  @secret
end

Instance Method Details

#get_access_token(secret = nil) ⇒ Object



30
31
32
33
34
35
36
37
38
39
# File 'lib/fb_graph/application.rb', line 30

def get_access_token(secret = nil)
  self.secret ||= secret
  auth = Auth.new(self.identifier, self.secret)
  response_string = auth.client.request(:post, auth.client.access_token_url, {
    :client_id => self.identifier,
    :client_secret => self.secret,
    :type => 'client_cred'
  })
  self.access_token = response_string.split('=').last
end