cerberus 0.6 → 0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (290) hide show
  1. data/Authors.txt +4 -0
  2. data/Changelog.txt +11 -0
  3. data/Copyright.txt +16 -0
  4. data/Rakefile +16 -25
  5. data/Readme.markdown +1 -3
  6. data/bin/cerberus +5 -0
  7. data/lib/cerberus/builder/bjam.rb +1 -3
  8. data/lib/cerberus/builder/maven2.rb +0 -1
  9. data/lib/cerberus/builder/rake.rb +1 -1
  10. data/lib/cerberus/builder/rspec.rb +0 -1
  11. data/lib/cerberus/builder/ruby_base.rb +0 -1
  12. data/lib/cerberus/component_lazy_loader.rb +6 -2
  13. data/lib/cerberus/config.example.yml +1 -0
  14. data/lib/cerberus/constants.rb +2 -2
  15. data/lib/cerberus/manager.rb +7 -1
  16. data/lib/cerberus/publisher/mail.rb +4 -4
  17. data/lib/cerberus/publisher/twitter.rb +0 -1
  18. data/lib/cerberus/scm/base.rb +19 -0
  19. data/lib/cerberus/scm/bzr.rb +62 -0
  20. data/lib/cerberus/scm/cvs.rb +2 -7
  21. data/lib/cerberus/scm/darcs.rb +2 -11
  22. data/lib/cerberus/scm/git.rb +6 -14
  23. data/lib/cerberus/scm/perforce.rb +4 -4
  24. data/lib/cerberus/scm/svn.rb +2 -7
  25. data/lib/cerberus/utils.rb +5 -0
  26. data/lib/vendor/irc/README +23 -0
  27. data/lib/vendor/irc/lib/IRC.rb +164 -0
  28. data/lib/vendor/irc/lib/IRCChannel.rb +33 -0
  29. data/lib/vendor/irc/lib/IRCConnection.rb +134 -0
  30. data/lib/vendor/irc/lib/IRCEvent.rb +91 -0
  31. data/lib/vendor/irc/lib/IRCUser.rb +23 -0
  32. data/lib/vendor/irc/lib/IRCUtil.rb +49 -0
  33. data/lib/vendor/irc/lib/eventmap.yml +247 -0
  34. data/lib/vendor/twitter/CHANGES +129 -0
  35. data/lib/vendor/twitter/MIT-LICENSE +20 -0
  36. data/lib/vendor/twitter/README +37 -0
  37. data/lib/vendor/twitter/TODO +7 -0
  38. data/lib/vendor/twitter/lib/twitter.rb +34 -0
  39. data/lib/vendor/twitter/lib/twitter/client.rb +24 -0
  40. data/lib/vendor/twitter/lib/twitter/client/account.rb +24 -0
  41. data/lib/vendor/twitter/lib/twitter/client/auth.rb +27 -0
  42. data/lib/vendor/twitter/lib/twitter/client/base.rb +93 -0
  43. data/lib/vendor/twitter/lib/twitter/client/blocks.rb +35 -0
  44. data/lib/vendor/twitter/lib/twitter/client/favorites.rb +53 -0
  45. data/lib/vendor/twitter/lib/twitter/client/friendship.rb +35 -0
  46. data/lib/vendor/twitter/lib/twitter/client/graph.rb +37 -0
  47. data/lib/vendor/twitter/lib/twitter/client/messaging.rb +79 -0
  48. data/lib/vendor/twitter/lib/twitter/client/profile.rb +29 -0
  49. data/lib/vendor/twitter/lib/twitter/client/search.rb +27 -0
  50. data/lib/vendor/twitter/lib/twitter/client/status.rb +51 -0
  51. data/lib/vendor/twitter/lib/twitter/client/timeline.rb +72 -0
  52. data/lib/vendor/twitter/lib/twitter/client/user.rb +65 -0
  53. data/lib/vendor/twitter/lib/twitter/config.rb +77 -0
  54. data/lib/vendor/twitter/lib/twitter/console.rb +31 -0
  55. data/lib/vendor/twitter/lib/twitter/core.rb +137 -0
  56. data/lib/vendor/twitter/lib/twitter/ext.rb +2 -0
  57. data/lib/vendor/twitter/lib/twitter/ext/stdlib.rb +52 -0
  58. data/lib/vendor/twitter/lib/twitter/extras.rb +39 -0
  59. data/lib/vendor/twitter/lib/twitter/meta.rb +56 -0
  60. data/lib/vendor/twitter/lib/twitter/model.rb +360 -0
  61. data/lib/vendor/twitter/lib/twitter/version.rb +19 -0
  62. data/lib/vendor/twitter/spec/twitter/client/account_spec.rb +28 -0
  63. data/lib/vendor/twitter/spec/twitter/client/auth_spec.rb +34 -0
  64. data/lib/vendor/twitter/spec/twitter/client/base_spec.rb +242 -0
  65. data/lib/vendor/twitter/spec/twitter/client/blocks_spec.rb +76 -0
  66. data/lib/vendor/twitter/spec/twitter/client/favorites_spec.rb +183 -0
  67. data/lib/vendor/twitter/spec/twitter/client/friendship_spec.rb +76 -0
  68. data/lib/vendor/twitter/spec/twitter/client/graph_spec.rb +67 -0
  69. data/lib/vendor/twitter/spec/twitter/client/messaging_spec.rb +135 -0
  70. data/lib/vendor/twitter/spec/twitter/client/profile_spec.rb +91 -0
  71. data/lib/vendor/twitter/spec/twitter/client/search_spec.rb +68 -0
  72. data/lib/vendor/twitter/spec/twitter/client/status_spec.rb +119 -0
  73. data/lib/vendor/twitter/spec/twitter/client/timeline_spec.rb +79 -0
  74. data/lib/vendor/twitter/spec/twitter/client/user_spec.rb +203 -0
  75. data/lib/vendor/twitter/spec/twitter/client_spec.rb +2 -0
  76. data/lib/vendor/twitter/spec/twitter/config_spec.rb +86 -0
  77. data/lib/vendor/twitter/spec/twitter/console_spec.rb +15 -0
  78. data/lib/vendor/twitter/spec/twitter/core_spec.rb +127 -0
  79. data/lib/vendor/twitter/spec/twitter/ext/stdlib_spec.rb +59 -0
  80. data/lib/vendor/twitter/spec/twitter/extras_spec.rb +46 -0
  81. data/lib/vendor/twitter/spec/twitter/meta_spec.rb +90 -0
  82. data/lib/vendor/twitter/spec/twitter/model_spec.rb +508 -0
  83. data/lib/vendor/twitter/spec/twitter/version_spec.rb +19 -0
  84. data/lib/vendor/xmpp4r/CHANGELOG +83 -0
  85. data/lib/vendor/xmpp4r/COPYING +340 -0
  86. data/lib/vendor/xmpp4r/LICENSE +59 -0
  87. data/lib/vendor/xmpp4r/README.rdoc +110 -0
  88. data/lib/vendor/xmpp4r/README_ruby19.txt +43 -0
  89. data/lib/vendor/xmpp4r/Rakefile +262 -0
  90. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/README +56 -0
  91. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/adventure.rb +23 -0
  92. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/adventuremuc.rb +136 -0
  93. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/cube.xml +15 -0
  94. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/tower.xml +69 -0
  95. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/world.rb +424 -0
  96. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/fileserve.conf +11 -0
  97. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/fileserve.rb +346 -0
  98. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/getonline.rb +56 -0
  99. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/gtkmucclient.rb +315 -0
  100. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/migrate.rb +88 -0
  101. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/minimuc.rb +266 -0
  102. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/pep-aggregator/index.xsl +235 -0
  103. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/pep-aggregator/pep-aggregator.rb +147 -0
  104. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/recvfile.rb +84 -0
  105. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/rosterdiscovery.rb +129 -0
  106. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/sendfile.conf +10 -0
  107. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/sendfile.rb +72 -0
  108. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr.rb +51 -0
  109. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr_jabber.rb +43 -0
  110. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr_test.rb +10 -0
  111. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/versionpoll.rb +90 -0
  112. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/xmpping.rb +146 -0
  113. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/xmppingrc.sample +14 -0
  114. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/change_password.rb +41 -0
  115. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/client.rb +70 -0
  116. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/component.rb +11 -0
  117. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/echo.rb +37 -0
  118. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/jabbersend.rb +41 -0
  119. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/mass_sender.rb +68 -0
  120. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/muc_owner_config.rb +12 -0
  121. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/mucinfo.rb +41 -0
  122. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/mucsimplebot.rb +82 -0
  123. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/register.rb +42 -0
  124. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/remove_registration.rb +18 -0
  125. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/roster.rb +44 -0
  126. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/rosterprint.rb +50 -0
  127. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/rosterrename.rb +34 -0
  128. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/rosterwatch.rb +171 -0
  129. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/send_vcard.rb +67 -0
  130. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/tune_client.rb +56 -0
  131. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/tune_server.rb +58 -0
  132. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/versionbot.rb +75 -0
  133. data/lib/vendor/xmpp4r/lib/xmpp4r.rb +116 -0
  134. data/lib/vendor/xmpp4r/lib/xmpp4r/base64.rb +32 -0
  135. data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams.rb +15 -0
  136. data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/filetransfer.rb +319 -0
  137. data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/ibb/base.rb +257 -0
  138. data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/ibb/initiator.rb +31 -0
  139. data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/ibb/target.rb +47 -0
  140. data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/base.rb +152 -0
  141. data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/initiator.rb +86 -0
  142. data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/server.rb +198 -0
  143. data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/socks5.rb +65 -0
  144. data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb +73 -0
  145. data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb.orig +62 -0
  146. data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/iq/bytestreams.rb +170 -0
  147. data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/iq/si.rb +206 -0
  148. data/lib/vendor/xmpp4r/lib/xmpp4r/callbacks.rb +124 -0
  149. data/lib/vendor/xmpp4r/lib/xmpp4r/caps.rb +1 -0
  150. data/lib/vendor/xmpp4r/lib/xmpp4r/caps/c.rb +53 -0
  151. data/lib/vendor/xmpp4r/lib/xmpp4r/caps/helper/generator.rb +160 -0
  152. data/lib/vendor/xmpp4r/lib/xmpp4r/caps/helper/helper.rb +87 -0
  153. data/lib/vendor/xmpp4r/lib/xmpp4r/client.rb +317 -0
  154. data/lib/vendor/xmpp4r/lib/xmpp4r/command/helper/responder.rb +53 -0
  155. data/lib/vendor/xmpp4r/lib/xmpp4r/command/iq/command.rb +154 -0
  156. data/lib/vendor/xmpp4r/lib/xmpp4r/component.rb +103 -0
  157. data/lib/vendor/xmpp4r/lib/xmpp4r/connection.rb +219 -0
  158. data/lib/vendor/xmpp4r/lib/xmpp4r/dataforms.rb +5 -0
  159. data/lib/vendor/xmpp4r/lib/xmpp4r/dataforms/x/data.rb +297 -0
  160. data/lib/vendor/xmpp4r/lib/xmpp4r/debuglog.rb +42 -0
  161. data/lib/vendor/xmpp4r/lib/xmpp4r/delay.rb +5 -0
  162. data/lib/vendor/xmpp4r/lib/xmpp4r/delay/x/delay.rb +99 -0
  163. data/lib/vendor/xmpp4r/lib/xmpp4r/discovery.rb +7 -0
  164. data/lib/vendor/xmpp4r/lib/xmpp4r/discovery/helper/responder.rb +165 -0
  165. data/lib/vendor/xmpp4r/lib/xmpp4r/discovery/iq/discoinfo.rb +211 -0
  166. data/lib/vendor/xmpp4r/lib/xmpp4r/discovery/iq/discoitems.rb +147 -0
  167. data/lib/vendor/xmpp4r/lib/xmpp4r/errors.rb +281 -0
  168. data/lib/vendor/xmpp4r/lib/xmpp4r/feature_negotiation.rb +5 -0
  169. data/lib/vendor/xmpp4r/lib/xmpp4r/feature_negotiation/iq/feature.rb +28 -0
  170. data/lib/vendor/xmpp4r/lib/xmpp4r/framework/base.rb +55 -0
  171. data/lib/vendor/xmpp4r/lib/xmpp4r/framework/bot.rb +148 -0
  172. data/lib/vendor/xmpp4r/lib/xmpp4r/httpbinding.rb +5 -0
  173. data/lib/vendor/xmpp4r/lib/xmpp4r/httpbinding/client.rb +285 -0
  174. data/lib/vendor/xmpp4r/lib/xmpp4r/idgenerator.rb +37 -0
  175. data/lib/vendor/xmpp4r/lib/xmpp4r/iq.rb +221 -0
  176. data/lib/vendor/xmpp4r/lib/xmpp4r/jid.rb +167 -0
  177. data/lib/vendor/xmpp4r/lib/xmpp4r/message.rb +148 -0
  178. data/lib/vendor/xmpp4r/lib/xmpp4r/muc.rb +14 -0
  179. data/lib/vendor/xmpp4r/lib/xmpp4r/muc/helper/mucbrowser.rb +92 -0
  180. data/lib/vendor/xmpp4r/lib/xmpp4r/muc/helper/mucclient.rb +462 -0
  181. data/lib/vendor/xmpp4r/lib/xmpp4r/muc/helper/simplemucclient.rb +332 -0
  182. data/lib/vendor/xmpp4r/lib/xmpp4r/muc/iq/mucadmin.rb +23 -0
  183. data/lib/vendor/xmpp4r/lib/xmpp4r/muc/iq/mucadminitem.rb +20 -0
  184. data/lib/vendor/xmpp4r/lib/xmpp4r/muc/iq/mucowner.rb +15 -0
  185. data/lib/vendor/xmpp4r/lib/xmpp4r/muc/item.rb +143 -0
  186. data/lib/vendor/xmpp4r/lib/xmpp4r/muc/x/muc.rb +70 -0
  187. data/lib/vendor/xmpp4r/lib/xmpp4r/muc/x/mucuserinvite.rb +60 -0
  188. data/lib/vendor/xmpp4r/lib/xmpp4r/muc/x/mucuseritem.rb +36 -0
  189. data/lib/vendor/xmpp4r/lib/xmpp4r/presence.rb +232 -0
  190. data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub.rb +8 -0
  191. data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/configuration.rb +86 -0
  192. data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/event.rb +49 -0
  193. data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/item.rb +35 -0
  194. data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/items.rb +44 -0
  195. data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/node_config.rb +48 -0
  196. data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/publish.rb +24 -0
  197. data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/subscription.rb +62 -0
  198. data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/subscription_config.rb +67 -0
  199. data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/unsubscribe.rb +48 -0
  200. data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/helper/nodebrowser.rb +130 -0
  201. data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/helper/nodehelper.rb +156 -0
  202. data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/helper/servicehelper.rb +417 -0
  203. data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/iq/pubsub.rb +19 -0
  204. data/lib/vendor/xmpp4r/lib/xmpp4r/query.rb +15 -0
  205. data/lib/vendor/xmpp4r/lib/xmpp4r/rexmladdons.rb +151 -0
  206. data/lib/vendor/xmpp4r/lib/xmpp4r/roster.rb +7 -0
  207. data/lib/vendor/xmpp4r/lib/xmpp4r/roster/helper/roster.rb +519 -0
  208. data/lib/vendor/xmpp4r/lib/xmpp4r/roster/iq/roster.rb +215 -0
  209. data/lib/vendor/xmpp4r/lib/xmpp4r/roster/x/roster.rb +138 -0
  210. data/lib/vendor/xmpp4r/lib/xmpp4r/rpc.rb +2 -0
  211. data/lib/vendor/xmpp4r/lib/xmpp4r/rpc/helper/client.rb +123 -0
  212. data/lib/vendor/xmpp4r/lib/xmpp4r/rpc/helper/server.rb +74 -0
  213. data/lib/vendor/xmpp4r/lib/xmpp4r/rpc/helper/xmlrpcaddons.rb +67 -0
  214. data/lib/vendor/xmpp4r/lib/xmpp4r/rpc/iq/rpc.rb +23 -0
  215. data/lib/vendor/xmpp4r/lib/xmpp4r/sasl.rb +237 -0
  216. data/lib/vendor/xmpp4r/lib/xmpp4r/semaphore.rb +38 -0
  217. data/lib/vendor/xmpp4r/lib/xmpp4r/stream.rb +497 -0
  218. data/lib/vendor/xmpp4r/lib/xmpp4r/streamparser.rb +77 -0
  219. data/lib/vendor/xmpp4r/lib/xmpp4r/tune.rb +2 -0
  220. data/lib/vendor/xmpp4r/lib/xmpp4r/tune/helper/helper.rb +58 -0
  221. data/lib/vendor/xmpp4r/lib/xmpp4r/tune/tune.rb +113 -0
  222. data/lib/vendor/xmpp4r/lib/xmpp4r/vcard.rb +6 -0
  223. data/lib/vendor/xmpp4r/lib/xmpp4r/vcard/helper/vcard.rb +84 -0
  224. data/lib/vendor/xmpp4r/lib/xmpp4r/vcard/iq/vcard.rb +109 -0
  225. data/lib/vendor/xmpp4r/lib/xmpp4r/version.rb +7 -0
  226. data/lib/vendor/xmpp4r/lib/xmpp4r/version/helper/responder.rb +72 -0
  227. data/lib/vendor/xmpp4r/lib/xmpp4r/version/helper/simpleresponder.rb +44 -0
  228. data/lib/vendor/xmpp4r/lib/xmpp4r/version/iq/version.rb +105 -0
  229. data/lib/vendor/xmpp4r/lib/xmpp4r/x.rb +37 -0
  230. data/lib/vendor/xmpp4r/lib/xmpp4r/xhtml.rb +1 -0
  231. data/lib/vendor/xmpp4r/lib/xmpp4r/xhtml/html.rb +115 -0
  232. data/lib/vendor/xmpp4r/lib/xmpp4r/xmpp4r.rb +18 -0
  233. data/lib/vendor/xmpp4r/lib/xmpp4r/xmppelement.rb +168 -0
  234. data/lib/vendor/xmpp4r/lib/xmpp4r/xmppstanza.rb +162 -0
  235. data/lib/vendor/xmpp4r/setup.rb +1586 -0
  236. data/lib/vendor/xmpp4r/test/bytestreams/tc_ibb.rb +186 -0
  237. data/lib/vendor/xmpp4r/test/bytestreams/tc_socks5bytestreams.rb +113 -0
  238. data/lib/vendor/xmpp4r/test/caps/tc_helper.rb +156 -0
  239. data/lib/vendor/xmpp4r/test/dataforms/tc_data.rb +81 -0
  240. data/lib/vendor/xmpp4r/test/delay/tc_xdelay.rb +51 -0
  241. data/lib/vendor/xmpp4r/test/discovery/tc_responder.rb +91 -0
  242. data/lib/vendor/xmpp4r/test/lib/assert_equal_xml.rb +14 -0
  243. data/lib/vendor/xmpp4r/test/lib/clienttester.rb +120 -0
  244. data/lib/vendor/xmpp4r/test/muc/tc_muc_mucclient.rb +830 -0
  245. data/lib/vendor/xmpp4r/test/muc/tc_muc_simplemucclient.rb +114 -0
  246. data/lib/vendor/xmpp4r/test/muc/tc_mucowner.rb +50 -0
  247. data/lib/vendor/xmpp4r/test/pubsub/tc_helper.rb +662 -0
  248. data/lib/vendor/xmpp4r/test/pubsub/tc_nodeconfig.rb +54 -0
  249. data/lib/vendor/xmpp4r/test/pubsub/tc_subscriptionconfig.rb +41 -0
  250. data/lib/vendor/xmpp4r/test/roster/tc_helper.rb +514 -0
  251. data/lib/vendor/xmpp4r/test/roster/tc_iqqueryroster.rb +173 -0
  252. data/lib/vendor/xmpp4r/test/roster/tc_xroster.rb +73 -0
  253. data/lib/vendor/xmpp4r/test/rpc/tc_helper.rb +96 -0
  254. data/lib/vendor/xmpp4r/test/tc_callbacks.rb +129 -0
  255. data/lib/vendor/xmpp4r/test/tc_class_names.rb +146 -0
  256. data/lib/vendor/xmpp4r/test/tc_client.rb +30 -0
  257. data/lib/vendor/xmpp4r/test/tc_errors.rb +146 -0
  258. data/lib/vendor/xmpp4r/test/tc_idgenerator.rb +30 -0
  259. data/lib/vendor/xmpp4r/test/tc_iq.rb +113 -0
  260. data/lib/vendor/xmpp4r/test/tc_iqquery.rb +31 -0
  261. data/lib/vendor/xmpp4r/test/tc_jid.rb +204 -0
  262. data/lib/vendor/xmpp4r/test/tc_message.rb +116 -0
  263. data/lib/vendor/xmpp4r/test/tc_presence.rb +150 -0
  264. data/lib/vendor/xmpp4r/test/tc_rexml.rb +139 -0
  265. data/lib/vendor/xmpp4r/test/tc_stream.rb +229 -0
  266. data/lib/vendor/xmpp4r/test/tc_streamComponent.rb +95 -0
  267. data/lib/vendor/xmpp4r/test/tc_streamError.rb +131 -0
  268. data/lib/vendor/xmpp4r/test/tc_streamSend.rb +59 -0
  269. data/lib/vendor/xmpp4r/test/tc_streamparser.rb +112 -0
  270. data/lib/vendor/xmpp4r/test/tc_xmppstanza.rb +135 -0
  271. data/lib/vendor/xmpp4r/test/ts_xmpp4r.rb +53 -0
  272. data/lib/vendor/xmpp4r/test/tune/tc_helper_recv.rb +84 -0
  273. data/lib/vendor/xmpp4r/test/tune/tc_helper_send.rb +74 -0
  274. data/lib/vendor/xmpp4r/test/tune/tc_tune.rb +79 -0
  275. data/lib/vendor/xmpp4r/test/vcard/tc_helper.rb +49 -0
  276. data/lib/vendor/xmpp4r/test/vcard/tc_iqvcard.rb +62 -0
  277. data/lib/vendor/xmpp4r/test/version/tc_helper.rb +60 -0
  278. data/lib/vendor/xmpp4r/test/version/tc_iqqueryversion.rb +97 -0
  279. data/lib/vendor/xmpp4r/test/xhtml/tc_html.rb +41 -0
  280. data/lib/vendor/xmpp4r/tools/gen_requires.bash +31 -0
  281. data/lib/vendor/xmpp4r/tools/xmpp4r-gemspec-test.rb +11 -0
  282. data/lib/vendor/xmpp4r/xmpp4r.gemspec +291 -0
  283. data/test/jabber_publisher_test.rb +1 -1
  284. data/test/mail_publisher_test.rb +2 -2
  285. data/test/mock/twitter.rb +0 -1
  286. data/test/rspec_builder_test.rb +39 -2
  287. data/test/rss_publisher_test.rb +1 -1
  288. data/test/twitter_publisher_test.rb +1 -1
  289. metadata +268 -53
  290. data/lib/cerberus/publisher/gmailer.rb +0 -17
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2006-2007 Susan Potter <me _at_ susanpotter _dot_ net>.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,37 @@
1
+ = Twitter4R
2
+
3
+ * Project Website - http://twitter4r.rubyforge.org
4
+ * Mailing List - http://groups.google.com/group/twitter4r-users
5
+
6
+ == Developers
7
+ * {Susan Potter}[http://SusanPotter.NET] <me at susanpotter dot net>
8
+
9
+ == Contributors
10
+ Code:
11
+ * Kaiichi Matsunaga <ma2 at lifemedia dot co dot jp> - proxy code suggestion
12
+ * Sergio Santos <> - message paging code suggestion
13
+ * Adam Stiles <adam at stilesoft dot com> - URI.encode => CGI.escape fix
14
+ * Carl Crawley <cwcrawley at gmail dot com> - Friendship get => post fix
15
+ * Christian Johansen <christian at cjohansen dot no> - in_reply_to attributes in Twitter::Status
16
+
17
+ Design Suggestions:
18
+ * Bosco So <rubymeetup at boscoso dot com> - making Twitter::Error a RuntimeError instead of an Exception to prevent irb from crashing out.
19
+
20
+ == Description
21
+ Twitter4R provides an object based API to query or update your Twitter account via pure Ruby. It hides the ugly HTTP/REST code from your code.
22
+
23
+ == External Dependencies
24
+ * Ruby 1.8 (tested with 1.8.6)
25
+ * RSpec gem 1.0.0+ (tested with 1.1.3)
26
+ * JSON gem 0.4.3+ (tested with versions: 1.1.1 and 1.1.2)
27
+ * jcode (for unicode support)
28
+
29
+ == Usage Examples
30
+ Twitter4R starting with version 0.1.1 and above is organized into seven parts:
31
+ * {Configuration API}[link:files/examples/configure_rb.html]
32
+ * {Friendship API}[link:files/examples/friendship_rb.html]
33
+ * {Messaging API}[link:files/examples/messaging_rb.html]
34
+ * {Model API}[link:files/examples/model_rb.html]
35
+ * {Status API}[link:files/examples/status_rb.html]
36
+ * {Timeline API}[link:files/examples/timeline_rb.html]
37
+ * {User API}[link:files/examples/user_rb.html]
@@ -0,0 +1,7 @@
1
+
2
+ 0.3.1 TODO:
3
+ * Add specs for :page, :lite and :since options support in Twitter::Client#my(...), Twitter::Client#user(....) and Twitter::User#followers calls
4
+ * Add specs for :replies support in Twitter::Client#status(...) and Twitter::Client#timeline_for(...)
5
+ * Add RDoc for :replies support
6
+ * Add better RDoc for Twitter::Client.account_info(:rate_limit_status)
7
+ * Add specs for Twitter::Client.account_info(:rate_limit_status)
@@ -0,0 +1,34 @@
1
+ #
2
+ require('rubygems')
3
+
4
+ module Twitter; end
5
+
6
+ def require_local(suffix)
7
+ require(File.expand_path(File.join(File.dirname(__FILE__), suffix)))
8
+ end
9
+
10
+ # For better unicode support in 1.8
11
+ if RUBY_VERSION < '1.9'
12
+ $KCODE = 'u'
13
+ require 'jcode'
14
+ end
15
+
16
+ # External requires
17
+ require('yaml')
18
+ require('date')
19
+ require('time')
20
+ require('net/https')
21
+ require('uri')
22
+ require('cgi')
23
+ require('json')
24
+ require('yaml')
25
+
26
+ # Ordering matters...pay attention here!
27
+ require_local('twitter/ext')
28
+ require_local('twitter/version')
29
+ require_local('twitter/meta')
30
+ require_local('twitter/core')
31
+ require_local('twitter/model')
32
+ require_local('twitter/config')
33
+ require_local('twitter/client')
34
+ require_local('twitter/console')
@@ -0,0 +1,24 @@
1
+ # client.rb contains the classes, methods and extends <tt>Twitter4R</tt>
2
+ # features to define client calls to the Twitter REST API.
3
+ #
4
+ # See:
5
+ # * <tt>Twitter::Client</tt>
6
+
7
+ # Used to query or post to the Twitter REST API to simplify code.
8
+ class Twitter::Client
9
+ include Twitter::ClassUtilMixin
10
+ end
11
+
12
+ require('twitter/client/base')
13
+ require('twitter/client/timeline')
14
+ require('twitter/client/status')
15
+ require('twitter/client/friendship')
16
+ require('twitter/client/messaging')
17
+ require('twitter/client/user')
18
+ require('twitter/client/auth')
19
+ require('twitter/client/favorites')
20
+ require('twitter/client/blocks')
21
+ require('twitter/client/account')
22
+ require('twitter/client/graph')
23
+ require('twitter/client/profile')
24
+ require('twitter/client/search')
@@ -0,0 +1,24 @@
1
+ class Twitter::Client
2
+ @@ACCOUNT_URIS = {
3
+ :rate_limit_status => '/account/rate_limit_status',
4
+ }
5
+
6
+ # Provides access to the Twitter rate limit status API.
7
+ #
8
+ # You can find out information about your account status. Currently the only
9
+ # supported type of account status is the <tt>:rate_limit_status</tt> which
10
+ # returns a <tt>Twitter::RateLimitStatus</tt> object.
11
+ #
12
+ # Example:
13
+ # account_status = client.account_info
14
+ # puts account_status.remaining_hits
15
+ def account_info(type = :rate_limit_status)
16
+ connection = create_http_connection
17
+ connection.start do |connection|
18
+ response = http_connect do |conn|
19
+ create_http_get_request(@@ACCOUNT_URIS[type])
20
+ end
21
+ bless_models(Twitter::RateLimitStatus.unmarshal(response.body))
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,27 @@
1
+ class Twitter::Client
2
+ @@AUTHENTICATION_URIS = {
3
+ :verify => '/account/verify_credentials',
4
+ }
5
+
6
+ # Provides access to the Twitter verify credentials API.
7
+ #
8
+ # You can verify Twitter user credentials with minimal overhead using this method.
9
+ #
10
+ # Example:
11
+ # client.authenticate?("osxisforlightweights", "l30p@rd_s^cks!")
12
+ def authenticate?(login, password)
13
+ verify_credentials(login, password)
14
+ end
15
+
16
+ private
17
+ def verify_credentials(username, passwd)
18
+ connection = create_http_connection
19
+ connection.start do |connection|
20
+ request = create_http_get_request("#{@@AUTHENTICATION_URIS[:verify]}.json")
21
+ request.basic_auth(username, passwd)
22
+ response = connection.request(request)
23
+ response.is_a?(Net::HTTPSuccess) ? true : false
24
+ end
25
+ end
26
+ end
27
+
@@ -0,0 +1,93 @@
1
+ class Twitter::Client
2
+ alias :old_inspect :inspect
3
+ def inspect
4
+ s = old_inspect
5
+ s.gsub!(/@password=".*?"/, '@password="XXXX"')
6
+ end
7
+ protected
8
+ attr_accessor :login, :password
9
+
10
+ # Returns the response of the HTTP connection.
11
+ def http_connect(body = nil, require_auth = true, service = :rest, &block)
12
+ require_block(block_given?)
13
+ connection = create_http_connection(service)
14
+ connection.start do |connection|
15
+ request = yield connection if block_given?
16
+ request.basic_auth(@login, @password) if require_auth
17
+ response = connection.request(request, body)
18
+ handle_rest_response(response)
19
+ response
20
+ end
21
+ end
22
+
23
+ # "Blesses" model object with client information
24
+ def bless_model(model)
25
+ model.bless(self) if model
26
+ end
27
+
28
+ def bless_models(list)
29
+ return bless_model(list) if list.respond_to?(:client=)
30
+ list.collect { |model| bless_model(model) } if list.respond_to?(:collect)
31
+ end
32
+
33
+ private
34
+ @@http_header = nil
35
+
36
+ def raise_rest_error(response, uri = nil)
37
+ raise Twitter::RESTError.new(:code => response.code,
38
+ :message => response.message,
39
+ :uri => uri)
40
+ end
41
+
42
+ def handle_rest_response(response, uri = nil)
43
+ unless response.is_a?(Net::HTTPSuccess)
44
+ raise_rest_error(response, uri)
45
+ end
46
+ end
47
+
48
+ def create_http_connection(service = :rest)
49
+ case service
50
+ when :rest
51
+ protocol, host, port = @@config.protocol, @@config.host, @@config.port
52
+ when :search
53
+ protocol, host, port = @@config.search_protocol, @@config.search_host, @@config.search_port
54
+ end
55
+ conn = Net::HTTP.new(host, port,
56
+ @@config.proxy_host, @@config.proxy_port,
57
+ @@config.proxy_user, @@config.proxy_pass)
58
+ if protocol == :ssl
59
+ conn.use_ssl = true
60
+ conn.verify_mode = OpenSSL::SSL::VERIFY_NONE
61
+ end
62
+ conn
63
+ end
64
+
65
+ def http_header
66
+ # can cache this in class variable since all "variables" used to
67
+ # create the contents of the HTTP header are determined by other
68
+ # class variables that are not designed to change after instantiation.
69
+ @@http_header ||= {
70
+ 'User-Agent' => "Twitter4R v#{Twitter::Version.to_version} [#{@@config.user_agent}]",
71
+ 'Accept' => 'text/x-json',
72
+ 'X-Twitter-Client' => @@config.application_name,
73
+ 'X-Twitter-Client-Version' => @@config.application_version,
74
+ 'X-Twitter-Client-URL' => @@config.application_url,
75
+ }
76
+ @@http_header
77
+ end
78
+
79
+ def create_http_get_request(uri, params = {})
80
+ path = (params.size > 0) ? "#{uri}?#{params.to_http_str}" : uri
81
+ Net::HTTP::Get.new(path, http_header)
82
+ end
83
+
84
+ def create_http_post_request(uri)
85
+ Net::HTTP::Post.new(uri, http_header)
86
+ end
87
+
88
+ def create_http_delete_request(uri, params = {})
89
+ path = (params.size > 0) ? "#{uri}?#{params.to_http_str}" : uri
90
+ Net::HTTP::Delete.new(path, http_header)
91
+ end
92
+ end
93
+
@@ -0,0 +1,35 @@
1
+ class Twitter::Client
2
+ @@BLOCK_URIS = {
3
+ :add => '/blocks/create',
4
+ :remove => '/blocks/destroy',
5
+ }
6
+
7
+ # Provides access to the Twitter Block API.
8
+ #
9
+ # You can add and remove blocks to users using this method.
10
+ #
11
+ # <tt>action</tt> can be any of the following values:
12
+ # * <tt>:add</tt> - to add a block, you would use this <tt>action</tt> value
13
+ # * <tt>:remove</tt> - to remove a block use this.
14
+ #
15
+ # The <tt>value</tt> must be either the user screen name, integer unique user ID or Twitter::User
16
+ # object representation.
17
+ #
18
+ # Examples:
19
+ # screen_name = 'dictionary'
20
+ # client.block(:add, 'dictionary')
21
+ # client.block(:remove, 'dictionary')
22
+ # id = 1260061
23
+ # client.block(:add, id)
24
+ # client.block(:remove, id)
25
+ # user = Twitter::User.find(id, client)
26
+ # client.block(:add, user)
27
+ # client.block(:remove, user)
28
+ def block(action, value)
29
+ raise ArgumentError, "Invalid friend action provided: #{action}" unless @@BLOCK_URIS.keys.member?(action)
30
+ value = value.to_i unless value.is_a?(String)
31
+ uri = "#{@@BLOCK_URIS[action]}/#{value}.json"
32
+ response = http_connect {|conn| create_http_get_request(uri) }
33
+ bless_model(Twitter::User.unmarshal(response.body))
34
+ end
35
+ end
@@ -0,0 +1,53 @@
1
+ class Twitter::Client
2
+ # Why Twitter.com developers can't correctly document their API, I do not know!
3
+ @@FAVORITES_URIS = {
4
+ :add => '/favourings/create',
5
+ :remove => '/favourings/destroy',
6
+ }
7
+
8
+ # Provides access to the Twitter list favorites API.
9
+ #
10
+ # You can access the authenticated [Twitter] user's favorites list using this method.
11
+ #
12
+ # By default you will receive the last twenty statuses added to your favorites list.
13
+ # To get a previous page you can provide options to this method. For example,
14
+ # statuses = client.favorites(:page => 2)
15
+ # The above one-liner will get the second page of favorites for the authenticated user.
16
+ def favorites(options = nil)
17
+ def uri_suffix(opts); opts && opts[:page] ? "?page=#{opts[:page]}" : ""; end
18
+ uri = '/favorites.json' + uri_suffix(options)
19
+ response = http_connect {|conn| create_http_get_request(uri) }
20
+ bless_models(Twitter::Status.unmarshal(response.body))
21
+ end
22
+
23
+ # Provides access to the Twitter add/remove favorite API.
24
+ #
25
+ # You can add and remove favorite status using this method.
26
+ #
27
+ # <tt>action</tt> can be any of the following values:
28
+ # * <tt>:add</tt> - to add a status to your favorites, you would use this <tt>action</tt> value
29
+ # * <tt>:remove</tt> - to remove an status from your existing favorites list use this.
30
+ #
31
+ # The <tt>value</tt> must be either the status object to add or remove or
32
+ # the integer unique status ID.
33
+ #
34
+ # Examples:
35
+ # id = 126006103423
36
+ # client.favorite(:add, id)
37
+ # client.favorite(:remove, id)
38
+ # status = Twitter::Status.find(id, client)
39
+ # client.favorite(:add, status)
40
+ # client.favorite(:remove, status)
41
+ def favorite(action, value)
42
+ raise ArgumentError, "Invalid favorite action provided: #{action}" unless @@FAVORITES_URIS.keys.member?(action)
43
+ value = value.to_i.to_s unless value.is_a?(String)
44
+ uri = "#{@@FAVORITES_URIS[action]}/#{value}.json"
45
+ case action
46
+ when :add
47
+ response = http_connect {|conn| create_http_post_request(uri) }
48
+ when :remove
49
+ response = http_connect {|conn| create_http_delete_request(uri) }
50
+ end
51
+ bless_model(Twitter::Status.unmarshal(response.body))
52
+ end
53
+ end
@@ -0,0 +1,35 @@
1
+ class Twitter::Client
2
+ @@FRIENDSHIP_URIS = {
3
+ :add => '/friendships/create',
4
+ :remove => '/friendships/destroy',
5
+ }
6
+
7
+ # Provides access to the Twitter Friendship API.
8
+ #
9
+ # You can add and remove friends using this method.
10
+ #
11
+ # <tt>action</tt> can be any of the following values:
12
+ # * <tt>:add</tt> - to add a friend, you would use this <tt>action</tt> value
13
+ # * <tt>:remove</tt> - to remove an existing friend from your friends list use this.
14
+ #
15
+ # The <tt>value</tt> must be either the user to befriend or defriend's
16
+ # screen name, integer unique user ID or Twitter::User object representation.
17
+ #
18
+ # Examples:
19
+ # screen_name = 'dictionary'
20
+ # client.friend(:add, 'dictionary')
21
+ # client.friend(:remove, 'dictionary')
22
+ # id = 1260061
23
+ # client.friend(:add, id)
24
+ # client.friend(:remove, id)
25
+ # user = Twitter::User.find(id, client)
26
+ # client.friend(:add, user)
27
+ # client.friend(:remove, user)
28
+ def friend(action, value)
29
+ raise ArgumentError, "Invalid friend action provided: #{action}" unless @@FRIENDSHIP_URIS.keys.member?(action)
30
+ value = value.to_i unless value.is_a?(String)
31
+ uri = "#{@@FRIENDSHIP_URIS[action]}/#{value}.json"
32
+ response = http_connect {|conn| create_http_post_request(uri) }
33
+ bless_model(Twitter::User.unmarshal(response.body))
34
+ end
35
+ end
@@ -0,0 +1,37 @@
1
+ class Twitter::Client
2
+ @@GRAPH_URIS = {
3
+ :friends => '/friends/ids',
4
+ :followers => '/followers/ids',
5
+ }
6
+
7
+ # Provides access to the Twitter Social Graphing API.
8
+ #
9
+ # You can retrieve the full graph of a user's friends or followers in one method call.
10
+ #
11
+ # <tt>action</tt> can be any of the following values:
12
+ # * <tt>:friends</tt> - retrieves ids of all friends of a given user.
13
+ # * <tt>:followers</tt> - retrieves ids of all followers of a given user.
14
+ #
15
+ # The <tt>value</tt> must be either the user screen name, integer unique user ID or Twitter::User
16
+ # object representation.
17
+ #
18
+ # Examples:
19
+ # screen_name = 'dictionary'
20
+ # client.graph(:friends, 'dictionary')
21
+ # client.graph(:followers, 'dictionary')
22
+ # id = 1260061
23
+ # client.graph(:friends, id)
24
+ # client.graph(:followers, id)
25
+ # user = Twitter::User.find(id, client)
26
+ # client.graph(:friends, user)
27
+ # client.graph(:followers, user)
28
+ def graph(action, value = nil)
29
+ raise ArgumentError, "Invalid friend action provided: #{action}" unless @@GRAPH_URIS.keys.member?(action)
30
+ id = value.to_i unless value.nil? || value.is_a?(String)
31
+ id ||= value
32
+ id ||= @login
33
+ uri = "#{@@GRAPH_URIS[action]}.json"
34
+ response = http_connect {|conn| create_http_get_request(uri, :id => id) }
35
+ JSON.parse(response.body)
36
+ end
37
+ end
@@ -0,0 +1,79 @@
1
+ class Twitter::Client
2
+
3
+ @@MESSAGING_URIS = {
4
+ :received => '/direct_messages.json',
5
+ :sent => '/direct_messages/sent.json',
6
+ :post => '/direct_messages/new.json',
7
+ :delete => '/direct_messages/destroy',
8
+ }
9
+
10
+ # Provides access to Twitter's Messaging API for received and
11
+ # sent direct messages.
12
+ #
13
+ # Example:
14
+ # received_messages = @twitter.messages(:received)
15
+ #
16
+ # An <tt>ArgumentError</tt> will be raised if an invalid <tt>action</tt>
17
+ # is given. Valid actions are:
18
+ # * +:received+
19
+ # * +:sent+
20
+ def messages(action, options = {})
21
+ raise ArgumentError, "Invalid messaging action: #{action}" unless [:sent, :received].member?(action)
22
+ uri = @@MESSAGING_URIS[action]
23
+ response = http_connect {|conn| create_http_get_request(uri, options) }
24
+ bless_models(Twitter::Message.unmarshal(response.body))
25
+ end
26
+
27
+ # Provides access to Twitter's Messaging API for sending and deleting
28
+ # direct messages to other users.
29
+ #
30
+ # <tt>action</tt> can be:
31
+ # * <tt>:post</tt> - to send a new direct message, <tt>value</tt>, to <tt>user</tt> given.
32
+ # * <tt>:delete</tt> - to delete direct message with message ID <tt>value</tt>.
33
+ #
34
+ # <tt>value</tt> should be:
35
+ # * <tt>String</tt> when action is <tt>:post</tt>. Will be the message text sent to given <tt>user</tt>.
36
+ # * <tt>Integer</tt> or <tt>Twitter::Message</tt> object when action is <tt>:delete</tt>. Will refer to the unique message ID to delete. When passing in an instance of <tt>Twitter::Message</tt> that Status will be
37
+ #
38
+ # <tt>user</tt> should be:
39
+ # * <tt>Twitter::User</tt>, <tt>Integer</tt> or <tt>String</tt> object when <tt>action</tt> is <tt>:post</tt>. The <tt>Integer</tt> must be the unique ID of the Twitter user you wish to send the direct message to and any <tt>String</tt>s passed in must be the screen name of the user you wish to send the direct message to.
40
+ # * totally ignore when <tt>action</tt> is <tt>:delete</tt>. It has no purpose in this use case scenario.
41
+ #
42
+ # Examples:
43
+ # The example below sends the message text 'Are you coming over at 6pm for the BBQ tonight?' to user with screen name 'myfriendslogin'...
44
+ # @twitter.message(:post, 'Are you coming over at 6pm for the BBQ tonight?', 'myfriendslogin')
45
+ # The example below sends the same message text as above to user with unique integer ID of 1234567890...
46
+ # the example below sends the same message text as above to user represented by <tt>user</tt> object instance of <tt>Twitter::User</tt>...
47
+ # @twitter.message(:post, 'Are you coming over at 6pm for the BBQ tonight?', user)
48
+ # message = @twitter.message(:post, 'Are you coming over at 6pm for the BBQ tonight?', 1234567890)
49
+ # the example below delete's the message send directly above to user with unique ID 1234567890...
50
+ # @twitter.message(:delete, message)
51
+ # Or the following can also be done...
52
+ # @twitter.message(:delete, message.id)
53
+ #
54
+ # In both scenarios (<tt>action</tt> is <tt>:post</tt> or
55
+ # <tt>:delete</tt>) a blessed <tt>Twitter::Message</tt> object is
56
+ # returned that represents the newly posted or newly deleted message.
57
+ #
58
+ # An <tt>ArgumentError</tt> will be raised if an invalid <tt>action</tt>
59
+ # is given. Valid actions are:
60
+ # * +:post+
61
+ # * +:delete+
62
+ #
63
+ # An <tt>ArgumentError</tt> is also raised when no user argument is
64
+ # supplied when <tt>action</tt> is +:post+.
65
+ def message(action, value, user = nil)
66
+ raise ArgumentError, "Invalid messaging action: #{action}" unless [:post, :delete].member?(action)
67
+ raise ArgumentError, "User argument must be supplied for :post case" if action.eql?(:post) and user.nil?
68
+ uri = @@MESSAGING_URIS[action]
69
+ user = user.to_i if user and user.is_a?(Twitter::User)
70
+ case action
71
+ when :post
72
+ response = http_connect({:text => value, :user => user, :source => @@config.source}.to_http_str) {|conn| create_http_post_request(uri) }
73
+ when :delete
74
+ response = http_connect {|conn| create_http_delete_request(uri, :id => value.to_i) }
75
+ end
76
+ message = Twitter::Message.unmarshal(response.body)
77
+ bless_model(message)
78
+ end
79
+ end