safubot 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. data/.gitignore +5 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE.md +19 -0
  4. data/README.md +43 -0
  5. data/Rakefile +1 -0
  6. data/doc/Gemfile.html +119 -0
  7. data/doc/Object.html +171 -0
  8. data/doc/Rakefile.html +117 -0
  9. data/doc/Safubot.html +173 -0
  10. data/doc/Safubot/Bot.html +827 -0
  11. data/doc/Safubot/Evented.html +346 -0
  12. data/doc/Safubot/KnownUser.html +344 -0
  13. data/doc/Safubot/Log.html +254 -0
  14. data/doc/Safubot/Query.html +217 -0
  15. data/doc/Safubot/Request.html +201 -0
  16. data/doc/Safubot/Response.html +174 -0
  17. data/doc/Safubot/Test.html +244 -0
  18. data/doc/Safubot/Twitter.html +153 -0
  19. data/doc/Safubot/Twitter/Bot.html +591 -0
  20. data/doc/Safubot/Twitter/DirectMessage.html +327 -0
  21. data/doc/Safubot/Twitter/Tweet.html +522 -0
  22. data/doc/Safubot/XMPP.html +153 -0
  23. data/doc/Safubot/XMPP/Bot.html +403 -0
  24. data/doc/Safubot/XMPP/Message.html +298 -0
  25. data/doc/created.rid +14 -0
  26. data/doc/foo_rb.html +115 -0
  27. data/doc/images/add.png +0 -0
  28. data/doc/images/brick.png +0 -0
  29. data/doc/images/brick_link.png +0 -0
  30. data/doc/images/bug.png +0 -0
  31. data/doc/images/bullet_black.png +0 -0
  32. data/doc/images/bullet_toggle_minus.png +0 -0
  33. data/doc/images/bullet_toggle_plus.png +0 -0
  34. data/doc/images/date.png +0 -0
  35. data/doc/images/delete.png +0 -0
  36. data/doc/images/find.png +0 -0
  37. data/doc/images/loadingAnimation.gif +0 -0
  38. data/doc/images/macFFBgHack.png +0 -0
  39. data/doc/images/package.png +0 -0
  40. data/doc/images/page_green.png +0 -0
  41. data/doc/images/page_white_text.png +0 -0
  42. data/doc/images/page_white_width.png +0 -0
  43. data/doc/images/plugin.png +0 -0
  44. data/doc/images/ruby.png +0 -0
  45. data/doc/images/tag_blue.png +0 -0
  46. data/doc/images/tag_green.png +0 -0
  47. data/doc/images/transparent.png +0 -0
  48. data/doc/images/wrench.png +0 -0
  49. data/doc/images/wrench_orange.png +0 -0
  50. data/doc/images/zoom.png +0 -0
  51. data/doc/index.html +112 -0
  52. data/doc/js/darkfish.js +153 -0
  53. data/doc/js/jquery.js +18 -0
  54. data/doc/js/navigation.js +142 -0
  55. data/doc/js/search.js +94 -0
  56. data/doc/js/search_index.js +1 -0
  57. data/doc/js/searcher.js +228 -0
  58. data/doc/lib/safubot/bot_rb.html +115 -0
  59. data/doc/lib/safubot/evented_rb.html +115 -0
  60. data/doc/lib/safubot/known_user_rb.html +115 -0
  61. data/doc/lib/safubot/log_rb.html +115 -0
  62. data/doc/lib/safubot/safubot_rb.html +115 -0
  63. data/doc/lib/safubot/spec/bot_spec_rb.html +115 -0
  64. data/doc/lib/safubot/spec/twitter_spec_rb.html +137 -0
  65. data/doc/lib/safubot/test_helper_rb.html +115 -0
  66. data/doc/lib/safubot/twitter_rb.html +115 -0
  67. data/doc/lib/safubot/version_rb.html +115 -0
  68. data/doc/lib/safubot/xmpp_rb.html +115 -0
  69. data/doc/lib/safubot_rb.html +115 -0
  70. data/doc/rdoc.css +543 -0
  71. data/doc/table_of_contents.html +224 -0
  72. data/lib/safubot.rb +20 -0
  73. data/lib/safubot/bot.rb +177 -0
  74. data/lib/safubot/evented.rb +52 -0
  75. data/lib/safubot/known_user.rb +27 -0
  76. data/lib/safubot/log.rb +21 -0
  77. data/lib/safubot/test_helper.rb +62 -0
  78. data/lib/safubot/twitter.rb +279 -0
  79. data/lib/safubot/version.rb +3 -0
  80. data/lib/safubot/xmpp.rb +144 -0
  81. data/safubot.gemspec +32 -0
  82. data/spec/fixtures/twitter/direct_message +1 -0
  83. data/spec/fixtures/twitter/tweet +1 -0
  84. data/spec/fixtures/xmpp/message +3 -0
  85. data/spec/helper.rb +12 -0
  86. data/spec/safubot/bot_spec.rb +41 -0
  87. data/spec/safubot/evented_spec.rb +45 -0
  88. data/spec/safubot/known_user_spec.rb +22 -0
  89. data/spec/safubot/twitter_spec.rb +60 -0
  90. data/spec/safubot/xmpp_spec.rb +35 -0
  91. metadata +260 -0
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ .*.swp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in safubot.gemspec
4
+ gemspec
data/LICENSE.md ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (C) 2011 by Jaiden Mispy
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # safubot - an evented chatbot framework for Ruby
2
+
3
+ ## <a name="installation">Installation</a>
4
+
5
+ ## <a name="documentation">Documentation</a>
6
+
7
+ ## <a name="example">Example Usage</a>
8
+ require 'safubot'
9
+
10
+ class NiftyBot < Safubot::Bot
11
+ def initialize
12
+ super(:database => "niftybot")
13
+
14
+ enable_twitter({
15
+ :username => "niftybot",
16
+ :consumer_key => CONSUMER_KEY,
17
+ :consumer_secret => CONSUMER_SECRET,
18
+ :oauth_token => OAUTH_TOKEN,
19
+ :oauth_token_secret => OAUTH_TOKEN_SECRET
20
+ })
21
+
22
+ enable_xmpp({
23
+ :jid => "niftybot@jabber.org/niftyhost",
24
+ :password => JABBER_PASSWORD
25
+ })
26
+
27
+ on(:request) do |req|
28
+ if req.text.match /nifty/i
29
+ respond req, "Yep, I'm a nifty bot! :3"
30
+ else
31
+ raise ArgumentError, "This isn't nifty at all! :("
32
+ end
33
+ end
34
+
35
+ on(:request_error) do |req, e|
36
+ respond req, "#{e}"
37
+ end
38
+ end
39
+ end
40
+
41
+ # You can run this from inside another EventMachine loop if
42
+ # you don't want it to block indefinitely.
43
+ NiftyBot.new.run
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/doc/Gemfile.html ADDED
@@ -0,0 +1,119 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>Gemfile</title>
8
+
9
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "./";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
+
22
+
23
+ <body class="file">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="./index.html">Home</a>
28
+ <a href="./table_of_contents.html#classes">Classes</a>
29
+ <a href="./table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+ <div id="project-metadata">
47
+ <nav id="fileindex-section" class="section project-section">
48
+ <h3 class="section-header">Pages</h3>
49
+
50
+ <ul>
51
+
52
+ <li class="file"><a href="./Gemfile.html">Gemfile</a>
53
+
54
+ <li class="file"><a href="./Rakefile.html">Rakefile</a>
55
+
56
+ </ul>
57
+ </nav>
58
+
59
+ <nav id="classindex-section" class="section project-section">
60
+ <h3 class="section-header">Class and Module Index</h3>
61
+
62
+ <ul class="link-list">
63
+
64
+ <li><a href="./Safubot.html">Safubot</a>
65
+
66
+ <li><a href="./Safubot/Bot.html">Safubot::Bot</a>
67
+
68
+ <li><a href="./Safubot/Evented.html">Safubot::Evented</a>
69
+
70
+ <li><a href="./Safubot/KnownUser.html">Safubot::KnownUser</a>
71
+
72
+ <li><a href="./Safubot/Log.html">Safubot::Log</a>
73
+
74
+ <li><a href="./Safubot/Query.html">Safubot::Query</a>
75
+
76
+ <li><a href="./Safubot/Request.html">Safubot::Request</a>
77
+
78
+ <li><a href="./Safubot/Response.html">Safubot::Response</a>
79
+
80
+ <li><a href="./Safubot/Test.html">Safubot::Test</a>
81
+
82
+ <li><a href="./Safubot/Twitter.html">Safubot::Twitter</a>
83
+
84
+ <li><a href="./Safubot/Twitter/Bot.html">Safubot::Twitter::Bot</a>
85
+
86
+ <li><a href="./Safubot/Twitter/DirectMessage.html">Safubot::Twitter::DirectMessage</a>
87
+
88
+ <li><a href="./Safubot/Twitter/Tweet.html">Safubot::Twitter::Tweet</a>
89
+
90
+ <li><a href="./Safubot/XMPP.html">Safubot::XMPP</a>
91
+
92
+ <li><a href="./Safubot/XMPP/Bot.html">Safubot::XMPP::Bot</a>
93
+
94
+ <li><a href="./Safubot/XMPP/Message.html">Safubot::XMPP::Message</a>
95
+
96
+ <li><a href="./Object.html">Object</a>
97
+
98
+ </ul>
99
+ </nav>
100
+
101
+ </div>
102
+ </nav>
103
+
104
+ <div id="documentation" class="description">
105
+
106
+ <p>source “<a href="http://rubygems.org">rubygems.org</a>”</p>
107
+
108
+ <p># Specify your gem’s dependencies in safubot.gemspec gemspec</p>
109
+
110
+ </div>
111
+
112
+
113
+
114
+ <footer id="validator-badges">
115
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
116
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.11.
117
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
118
+ </footer>
119
+
data/doc/Object.html ADDED
@@ -0,0 +1,171 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>Class: Object</title>
8
+
9
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "./";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
+
22
+
23
+ <body id="top" class="class">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="./index.html">Home</a>
28
+ <a href="./table_of_contents.html#classes">Classes</a>
29
+ <a href="./table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+ <div id="file-metadata">
47
+ <nav id="file-list-section" class="section">
48
+ <h3 class="section-header">Defined In</h3>
49
+ <ul>
50
+ <li>lib/safubot/spec/bot_spec.rb
51
+ </ul>
52
+ </nav>
53
+
54
+
55
+ </div>
56
+
57
+ <div id="class-metadata">
58
+
59
+ <nav id="parent-class-section" class="section">
60
+ <h3 class="section-header">Parent</h3>
61
+
62
+ <p class="link">BasicObject
63
+
64
+ </nav>
65
+
66
+ <!-- Included Modules -->
67
+ <nav id="includes-section" class="section">
68
+ <h3 class="section-header">Included Modules</h3>
69
+
70
+ <ul class="link-list">
71
+
72
+
73
+ <li><a class="include" href="Safubot.html">Safubot</a>
74
+
75
+
76
+ </ul>
77
+ </nav>
78
+
79
+
80
+ </div>
81
+
82
+ <div id="project-metadata">
83
+ <nav id="fileindex-section" class="section project-section">
84
+ <h3 class="section-header">Pages</h3>
85
+
86
+ <ul>
87
+
88
+ <li class="file"><a href="./Gemfile.html">Gemfile</a>
89
+
90
+ <li class="file"><a href="./Rakefile.html">Rakefile</a>
91
+
92
+ </ul>
93
+ </nav>
94
+
95
+ <nav id="classindex-section" class="section project-section">
96
+ <h3 class="section-header">Class and Module Index</h3>
97
+
98
+ <ul class="link-list">
99
+
100
+ <li><a href="./Safubot.html">Safubot</a>
101
+
102
+ <li><a href="./Safubot/Bot.html">Safubot::Bot</a>
103
+
104
+ <li><a href="./Safubot/Evented.html">Safubot::Evented</a>
105
+
106
+ <li><a href="./Safubot/KnownUser.html">Safubot::KnownUser</a>
107
+
108
+ <li><a href="./Safubot/Log.html">Safubot::Log</a>
109
+
110
+ <li><a href="./Safubot/Query.html">Safubot::Query</a>
111
+
112
+ <li><a href="./Safubot/Request.html">Safubot::Request</a>
113
+
114
+ <li><a href="./Safubot/Response.html">Safubot::Response</a>
115
+
116
+ <li><a href="./Safubot/Test.html">Safubot::Test</a>
117
+
118
+ <li><a href="./Safubot/Twitter.html">Safubot::Twitter</a>
119
+
120
+ <li><a href="./Safubot/Twitter/Bot.html">Safubot::Twitter::Bot</a>
121
+
122
+ <li><a href="./Safubot/Twitter/DirectMessage.html">Safubot::Twitter::DirectMessage</a>
123
+
124
+ <li><a href="./Safubot/Twitter/Tweet.html">Safubot::Twitter::Tweet</a>
125
+
126
+ <li><a href="./Safubot/XMPP.html">Safubot::XMPP</a>
127
+
128
+ <li><a href="./Safubot/XMPP/Bot.html">Safubot::XMPP::Bot</a>
129
+
130
+ <li><a href="./Safubot/XMPP/Message.html">Safubot::XMPP::Message</a>
131
+
132
+ <li><a href="./Object.html">Object</a>
133
+
134
+ </ul>
135
+ </nav>
136
+
137
+ </div>
138
+ </nav>
139
+
140
+ <div id="documentation">
141
+ <h1 class="class">class Object</h1>
142
+
143
+ <div id="description" class="description">
144
+
145
+ </div><!-- description -->
146
+
147
+
148
+
149
+
150
+ <section id="5Buntitled-5D" class="documentation-section">
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+ <!-- Methods -->
160
+
161
+ </section><!-- 5Buntitled-5D -->
162
+
163
+ </div><!-- documentation -->
164
+
165
+
166
+ <footer id="validator-badges">
167
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
168
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.11.
169
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
170
+ </footer>
171
+
data/doc/Rakefile.html ADDED
@@ -0,0 +1,117 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>Gemfile</title>
8
+
9
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "./";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
+
22
+
23
+ <body class="file">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="./index.html">Home</a>
28
+ <a href="./table_of_contents.html#classes">Classes</a>
29
+ <a href="./table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+ <div id="project-metadata">
47
+ <nav id="fileindex-section" class="section project-section">
48
+ <h3 class="section-header">Pages</h3>
49
+
50
+ <ul>
51
+
52
+ <li class="file"><a href="./Gemfile.html">Gemfile</a>
53
+
54
+ <li class="file"><a href="./Rakefile.html">Rakefile</a>
55
+
56
+ </ul>
57
+ </nav>
58
+
59
+ <nav id="classindex-section" class="section project-section">
60
+ <h3 class="section-header">Class and Module Index</h3>
61
+
62
+ <ul class="link-list">
63
+
64
+ <li><a href="./Safubot.html">Safubot</a>
65
+
66
+ <li><a href="./Safubot/Bot.html">Safubot::Bot</a>
67
+
68
+ <li><a href="./Safubot/Evented.html">Safubot::Evented</a>
69
+
70
+ <li><a href="./Safubot/KnownUser.html">Safubot::KnownUser</a>
71
+
72
+ <li><a href="./Safubot/Log.html">Safubot::Log</a>
73
+
74
+ <li><a href="./Safubot/Query.html">Safubot::Query</a>
75
+
76
+ <li><a href="./Safubot/Request.html">Safubot::Request</a>
77
+
78
+ <li><a href="./Safubot/Response.html">Safubot::Response</a>
79
+
80
+ <li><a href="./Safubot/Test.html">Safubot::Test</a>
81
+
82
+ <li><a href="./Safubot/Twitter.html">Safubot::Twitter</a>
83
+
84
+ <li><a href="./Safubot/Twitter/Bot.html">Safubot::Twitter::Bot</a>
85
+
86
+ <li><a href="./Safubot/Twitter/DirectMessage.html">Safubot::Twitter::DirectMessage</a>
87
+
88
+ <li><a href="./Safubot/Twitter/Tweet.html">Safubot::Twitter::Tweet</a>
89
+
90
+ <li><a href="./Safubot/XMPP.html">Safubot::XMPP</a>
91
+
92
+ <li><a href="./Safubot/XMPP/Bot.html">Safubot::XMPP::Bot</a>
93
+
94
+ <li><a href="./Safubot/XMPP/Message.html">Safubot::XMPP::Message</a>
95
+
96
+ <li><a href="./Object.html">Object</a>
97
+
98
+ </ul>
99
+ </nav>
100
+
101
+ </div>
102
+ </nav>
103
+
104
+ <div id="documentation" class="description">
105
+
106
+ <p>require “bundler/gem_tasks”</p>
107
+
108
+ </div>
109
+
110
+
111
+
112
+ <footer id="validator-badges">
113
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
114
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.11.
115
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
116
+ </footer>
117
+