Class: Socialshare::Facebook
- Inherits:
-
Object
- Object
- Socialshare::Facebook
- Defined in:
- lib/socialshare/facebook.rb
Instance Attribute Summary collapse
-
#fb_token ⇒ Object
Returns the value of attribute fb_token.
-
#fb_user ⇒ Object
Returns the value of attribute fb_user.
Instance Method Summary collapse
- #get_facebook_connections ⇒ Object
- #get_facebook_profile ⇒ Object
-
#initialize(options = {}) ⇒ Facebook
constructor
A new instance of Facebook.
- #post(text) ⇒ Object
- #share_picture(file_path) ⇒ Object
- #share_video(file_path) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Facebook
Returns a new instance of Facebook.
7 8 9 10 |
# File 'lib/socialshare/facebook.rb', line 7 def initialize( = {}) @fb_token = [:fb_token] @fb_user = get_fb_user([:fb_token]) end |
Instance Attribute Details
#fb_token ⇒ Object
Returns the value of attribute fb_token.
5 6 7 |
# File 'lib/socialshare/facebook.rb', line 5 def fb_token @fb_token end |
#fb_user ⇒ Object
Returns the value of attribute fb_user.
5 6 7 |
# File 'lib/socialshare/facebook.rb', line 5 def fb_user @fb_user end |
Instance Method Details
#get_facebook_connections ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/socialshare/facebook.rb', line 27 def get_facebook_connections begin self.fb_user.get_connections("me", "friends") rescue Exception => e return e end end |
#get_facebook_profile ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/socialshare/facebook.rb', line 19 def get_facebook_profile begin profile = self.fb_user.get_object("me") rescue Exception => e return e end end |
#post(text) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/socialshare/facebook.rb', line 11 def post(text) begin self.fb_user.put_wall_post(text) rescue Exception => e return e end end |
#share_picture(file_path) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/socialshare/facebook.rb', line 35 def share_picture(file_path) begin self.fb_user.put_picture(File.open(file_path)) rescue Exception => e return e end end |
#share_video(file_path) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/socialshare/facebook.rb', line 43 def share_video(file_path) begin self.fb_user.put_video(File.open(file_path)) rescue Exception => e return e end end |