imified_party 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.markdown +16 -0
  2. data/lib/imified_party.rb +48 -0
  3. metadata +80 -0
@@ -0,0 +1,16 @@
1
+ IMified Party
2
+ ============
3
+
4
+ Wrapper for the IMified API, with real application authentication, using HTTParty.
5
+
6
+ About
7
+ -----
8
+
9
+ This piece of code uses HTTParty for its magic. All IMified methods should
10
+ be supported, but you may need to reference the IMified API docs to understand how they work.
11
+
12
+
13
+ Installation
14
+ ------------
15
+
16
+ gem install imified_party
@@ -0,0 +1,48 @@
1
+ require 'rubygems'
2
+ require 'httparty'
3
+ require 'pp'
4
+
5
+ IMIFIED_URL = "https://www.imified.com/api/bot/"
6
+
7
+ class Imified
8
+
9
+ include HTTParty
10
+ format :xml
11
+
12
+
13
+ def initialize(u, p, bot_key)
14
+ @auth = {:username => u, :password => p}
15
+ @options = {:basic_auth => @auth}
16
+ @bot_key = bot_key
17
+ end
18
+
19
+ def get_user(user_key)
20
+ @options.merge!(:query => {:apimethod => "getuser", :userkey => user_key, :botkey => @bot_key})
21
+ do_post
22
+ end
23
+
24
+ def get_all_users
25
+ @options.merge!(:query => {:apimethod => "getallusers", :botkey => @bot_key})
26
+ do_post
27
+ end
28
+
29
+ def send(msg, userkey)
30
+ @options.merge!(:query => {:apimethod=> "send", :msg => msg, :userkey => userkey, :botkey => @bot_key})
31
+ do_post
32
+ end
33
+
34
+ def update_status(msg, network)
35
+ # possible values for network are: Jabber, AIM, MSN, Yahoo, Gtalk, or Twitter
36
+ @options.merge!(:query => {:apimethod => "updateStatus", :network => network, :msg => msg, :botkey => @bot_key})
37
+ do_post
38
+ end
39
+
40
+
41
+ private
42
+
43
+ def do_post
44
+ @resp = self.class.post(IMIFIED_URL, @options)
45
+ @resp["rsp"]
46
+ end
47
+
48
+ end
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: imified_party
3
+ version: !ruby/object:Gem::Version
4
+ hash: 9
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ version: "0.1"
10
+ platform: ruby
11
+ authors:
12
+ - Shane Witbeck
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-02-07 00:00:00 -05:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: httparty
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ description:
35
+ email: shane@digitalsanctum.com
36
+ executables: []
37
+
38
+ extensions: []
39
+
40
+ extra_rdoc_files: []
41
+
42
+ files:
43
+ - README.markdown
44
+ - lib/imified_party.rb
45
+ has_rdoc: true
46
+ homepage: http://github.com/digitalsanctum/imified_party
47
+ licenses: []
48
+
49
+ post_install_message:
50
+ rdoc_options: []
51
+
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
62
+ version: "0"
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ hash: 3
69
+ segments:
70
+ - 0
71
+ version: "0"
72
+ requirements: []
73
+
74
+ rubyforge_project:
75
+ rubygems_version: 1.5.0
76
+ signing_key:
77
+ specification_version: 3
78
+ summary: Lightweight wrapper for IMified API using HTTParty
79
+ test_files: []
80
+