Class: Fbm
- Inherits:
-
Object
- Object
- Fbm
- Defined in:
- lib/fbm.rb
Constant Summary collapse
- APP_ID =
'336967703070590'
- APP_SECRET =
'96f23894a4fdb0d6366fc7066f651970'
Instance Attribute Summary collapse
-
#access_token ⇒ Object
writeonly
Sets the attribute access_token.
Instance Method Summary collapse
Instance Attribute Details
#access_token=(value) ⇒ Object (writeonly)
Sets the attribute access_token
7 8 9 |
# File 'lib/fbm.rb', line 7 def access_token=(value) @access_token = value end |
Instance Method Details
#close ⇒ Object
32 33 34 |
# File 'lib/fbm.rb', line 32 def close @jabber.close if @jabber end |
#friends ⇒ Object
22 23 24 |
# File 'lib/fbm.rb', line 22 def friends client.get('me/friends', :fields => 'name,username')['data'] end |
#login_url ⇒ Object
12 13 14 15 16 |
# File 'lib/fbm.rb', line 12 def login_url "https://www.facebook.com/dialog/oauth?client_id=#{APP_ID}" + "&redirect_uri=https://www.facebook.com/connect/login_success.html" + "&scope=xmpp_login,read_mailbox,friends_online_presence&response_type=token" end |
#me ⇒ Object
18 19 20 |
# File 'lib/fbm.rb', line 18 def me @me ||= client.get('me', :fields => 'name') end |
#message(id, text) ⇒ Object
26 27 28 29 30 |
# File 'lib/fbm.rb', line 26 def (id, text) to = "-#{id}@chat.facebook.com" = Jabber::Message.new(to, text) jabber.send() end |