Class: FacebookFriends::Arvind
- Inherits:
-
Object
- Object
- FacebookFriends::Arvind
- Defined in:
- lib/facebook_friends.rb
Class Method Summary collapse
-
.count(token) ⇒ Object
Your code goes here…
- .feed(token) ⇒ Object
- .friends(token) ⇒ Object
- .user(token) ⇒ Object
Class Method Details
.count(token) ⇒ Object
Your code goes here…
7 8 9 10 11 12 13 14 |
# File 'lib/facebook_friends.rb', line 7 def self.count(token) response = Net::HTTP.get_response(URI("https://graph.facebook.com/v2.5/me/friends?access_token=#{token}&fields=about,email,gender,first_name,name,picture")) unless response.is_a?(Net::HTTPSuccess) return nil end json = ActiveSupport::JSON.decode(response.body) return json end |
.feed(token) ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/facebook_friends.rb', line 35 def self.feed(token) response = Net::HTTP.get_response(URI("https://graph.facebook.com/v2.5/me/feed?access_token=#{token}&fields=caption,description,icon,link,message,picture,admin_creator,name,source")) unless response.is_a?(Net::HTTPSuccess) return nil end json = ActiveSupport::JSON.decode(response.body) return json end |
.friends(token) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/facebook_friends.rb', line 16 def self.friends(token) response = Net::HTTP.get_response(URI("https://graph.facebook.com/v2.5/me/friends?access_token=#{token}&fields=about,email,gender,first_name,name,picture")) json = ActiveSupport::JSON.decode(response.body) # unless response.is_a?(Net::HTTPSuccess) # return nil # end return json end |
.user(token) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/facebook_friends.rb', line 26 def self.user(token) response = Net::HTTP.get_response(URI("https://graph.facebook.com/v2.5/me/?access_token=#{token}&fields=about,email,gender,first_name,name,picture")) unless response.is_a?(Net::HTTPSuccess) return nil end json = ActiveSupport::JSON.decode(response.body) return json end |