Class: Fbm

Inherits:
Object
  • Object
show all
Defined in:
lib/fbm.rb

Constant Summary collapse

APP_ID =
'336967703070590'
APP_SECRET =
'96f23894a4fdb0d6366fc7066f651970'

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#access_token=(value) ⇒ Object (writeonly)

Sets the attribute access_token

Parameters:

  • value

    the value to set the attribute access_token to.



7
8
9
# File 'lib/fbm.rb', line 7

def access_token=(value)
  @access_token = value
end

Instance Method Details

#closeObject



32
33
34
# File 'lib/fbm.rb', line 32

def close
  @jabber.close if @jabber
end

#friendsObject



22
23
24
# File 'lib/fbm.rb', line 22

def friends
  client.get('me/friends', :fields => 'name,username')['data']
end

#login_urlObject



12
13
14
15
16
# File 'lib/fbm.rb', line 12

def 
  "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

#meObject



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 message(id, text)
  to = "-#{id}@chat.facebook.com"
  message = Jabber::Message.new(to, text)
  jabber.send(message)
end