Class: Imified

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/imified_party.rb

Instance Method Summary collapse

Constructor Details

#initialize(u, p, bot_key) ⇒ Imified

Returns a new instance of Imified.



13
14
15
16
17
# File 'lib/imified_party.rb', line 13

def initialize(u, p, bot_key)
  @auth    = {:username => u, :password => p}
  @options = {:basic_auth => @auth}
  @bot_key = bot_key
end

Instance Method Details

#get_all_usersObject



24
25
26
27
# File 'lib/imified_party.rb', line 24

def get_all_users
  @options.merge!(:query => {:apimethod => "getallusers", :botkey => @bot_key})
  do_post
end

#get_user(user_key) ⇒ Object



19
20
21
22
# File 'lib/imified_party.rb', line 19

def get_user(user_key)
  @options.merge!(:query => {:apimethod => "getuser", :userkey => user_key, :botkey => @bot_key})
  do_post
end

#send(msg, userkey) ⇒ Object



29
30
31
32
# File 'lib/imified_party.rb', line 29

def send(msg, userkey)
  @options.merge!(:query => {:apimethod=> "send", :msg => msg, :userkey => userkey, :botkey => @bot_key})
  do_post
end

#update_status(msg, network) ⇒ Object



34
35
36
37
38
# File 'lib/imified_party.rb', line 34

def update_status(msg, network)
  # possible values for network are: Jabber, AIM, MSN, Yahoo, Gtalk, or Twitter
  @options.merge!(:query => {:apimethod => "updateStatus", :network => network, :msg => msg, :botkey => @bot_key})
  do_post
end