cerberus 0.6 → 0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Authors.txt +4 -0
- data/Changelog.txt +11 -0
- data/Copyright.txt +16 -0
- data/Rakefile +16 -25
- data/Readme.markdown +1 -3
- data/bin/cerberus +5 -0
- data/lib/cerberus/builder/bjam.rb +1 -3
- data/lib/cerberus/builder/maven2.rb +0 -1
- data/lib/cerberus/builder/rake.rb +1 -1
- data/lib/cerberus/builder/rspec.rb +0 -1
- data/lib/cerberus/builder/ruby_base.rb +0 -1
- data/lib/cerberus/component_lazy_loader.rb +6 -2
- data/lib/cerberus/config.example.yml +1 -0
- data/lib/cerberus/constants.rb +2 -2
- data/lib/cerberus/manager.rb +7 -1
- data/lib/cerberus/publisher/mail.rb +4 -4
- data/lib/cerberus/publisher/twitter.rb +0 -1
- data/lib/cerberus/scm/base.rb +19 -0
- data/lib/cerberus/scm/bzr.rb +62 -0
- data/lib/cerberus/scm/cvs.rb +2 -7
- data/lib/cerberus/scm/darcs.rb +2 -11
- data/lib/cerberus/scm/git.rb +6 -14
- data/lib/cerberus/scm/perforce.rb +4 -4
- data/lib/cerberus/scm/svn.rb +2 -7
- data/lib/cerberus/utils.rb +5 -0
- data/lib/vendor/irc/README +23 -0
- data/lib/vendor/irc/lib/IRC.rb +164 -0
- data/lib/vendor/irc/lib/IRCChannel.rb +33 -0
- data/lib/vendor/irc/lib/IRCConnection.rb +134 -0
- data/lib/vendor/irc/lib/IRCEvent.rb +91 -0
- data/lib/vendor/irc/lib/IRCUser.rb +23 -0
- data/lib/vendor/irc/lib/IRCUtil.rb +49 -0
- data/lib/vendor/irc/lib/eventmap.yml +247 -0
- data/lib/vendor/twitter/CHANGES +129 -0
- data/lib/vendor/twitter/MIT-LICENSE +20 -0
- data/lib/vendor/twitter/README +37 -0
- data/lib/vendor/twitter/TODO +7 -0
- data/lib/vendor/twitter/lib/twitter.rb +34 -0
- data/lib/vendor/twitter/lib/twitter/client.rb +24 -0
- data/lib/vendor/twitter/lib/twitter/client/account.rb +24 -0
- data/lib/vendor/twitter/lib/twitter/client/auth.rb +27 -0
- data/lib/vendor/twitter/lib/twitter/client/base.rb +93 -0
- data/lib/vendor/twitter/lib/twitter/client/blocks.rb +35 -0
- data/lib/vendor/twitter/lib/twitter/client/favorites.rb +53 -0
- data/lib/vendor/twitter/lib/twitter/client/friendship.rb +35 -0
- data/lib/vendor/twitter/lib/twitter/client/graph.rb +37 -0
- data/lib/vendor/twitter/lib/twitter/client/messaging.rb +79 -0
- data/lib/vendor/twitter/lib/twitter/client/profile.rb +29 -0
- data/lib/vendor/twitter/lib/twitter/client/search.rb +27 -0
- data/lib/vendor/twitter/lib/twitter/client/status.rb +51 -0
- data/lib/vendor/twitter/lib/twitter/client/timeline.rb +72 -0
- data/lib/vendor/twitter/lib/twitter/client/user.rb +65 -0
- data/lib/vendor/twitter/lib/twitter/config.rb +77 -0
- data/lib/vendor/twitter/lib/twitter/console.rb +31 -0
- data/lib/vendor/twitter/lib/twitter/core.rb +137 -0
- data/lib/vendor/twitter/lib/twitter/ext.rb +2 -0
- data/lib/vendor/twitter/lib/twitter/ext/stdlib.rb +52 -0
- data/lib/vendor/twitter/lib/twitter/extras.rb +39 -0
- data/lib/vendor/twitter/lib/twitter/meta.rb +56 -0
- data/lib/vendor/twitter/lib/twitter/model.rb +360 -0
- data/lib/vendor/twitter/lib/twitter/version.rb +19 -0
- data/lib/vendor/twitter/spec/twitter/client/account_spec.rb +28 -0
- data/lib/vendor/twitter/spec/twitter/client/auth_spec.rb +34 -0
- data/lib/vendor/twitter/spec/twitter/client/base_spec.rb +242 -0
- data/lib/vendor/twitter/spec/twitter/client/blocks_spec.rb +76 -0
- data/lib/vendor/twitter/spec/twitter/client/favorites_spec.rb +183 -0
- data/lib/vendor/twitter/spec/twitter/client/friendship_spec.rb +76 -0
- data/lib/vendor/twitter/spec/twitter/client/graph_spec.rb +67 -0
- data/lib/vendor/twitter/spec/twitter/client/messaging_spec.rb +135 -0
- data/lib/vendor/twitter/spec/twitter/client/profile_spec.rb +91 -0
- data/lib/vendor/twitter/spec/twitter/client/search_spec.rb +68 -0
- data/lib/vendor/twitter/spec/twitter/client/status_spec.rb +119 -0
- data/lib/vendor/twitter/spec/twitter/client/timeline_spec.rb +79 -0
- data/lib/vendor/twitter/spec/twitter/client/user_spec.rb +203 -0
- data/lib/vendor/twitter/spec/twitter/client_spec.rb +2 -0
- data/lib/vendor/twitter/spec/twitter/config_spec.rb +86 -0
- data/lib/vendor/twitter/spec/twitter/console_spec.rb +15 -0
- data/lib/vendor/twitter/spec/twitter/core_spec.rb +127 -0
- data/lib/vendor/twitter/spec/twitter/ext/stdlib_spec.rb +59 -0
- data/lib/vendor/twitter/spec/twitter/extras_spec.rb +46 -0
- data/lib/vendor/twitter/spec/twitter/meta_spec.rb +90 -0
- data/lib/vendor/twitter/spec/twitter/model_spec.rb +508 -0
- data/lib/vendor/twitter/spec/twitter/version_spec.rb +19 -0
- data/lib/vendor/xmpp4r/CHANGELOG +83 -0
- data/lib/vendor/xmpp4r/COPYING +340 -0
- data/lib/vendor/xmpp4r/LICENSE +59 -0
- data/lib/vendor/xmpp4r/README.rdoc +110 -0
- data/lib/vendor/xmpp4r/README_ruby19.txt +43 -0
- data/lib/vendor/xmpp4r/Rakefile +262 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/README +56 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/adventure.rb +23 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/adventuremuc.rb +136 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/cube.xml +15 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/tower.xml +69 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/world.rb +424 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/fileserve.conf +11 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/fileserve.rb +346 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/getonline.rb +56 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/gtkmucclient.rb +315 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/migrate.rb +88 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/minimuc.rb +266 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/pep-aggregator/index.xsl +235 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/pep-aggregator/pep-aggregator.rb +147 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/recvfile.rb +84 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/rosterdiscovery.rb +129 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/sendfile.conf +10 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/sendfile.rb +72 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr.rb +51 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr_jabber.rb +43 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr_test.rb +10 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/versionpoll.rb +90 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/xmpping.rb +146 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/xmppingrc.sample +14 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/change_password.rb +41 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/client.rb +70 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/component.rb +11 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/echo.rb +37 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/jabbersend.rb +41 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/mass_sender.rb +68 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/muc_owner_config.rb +12 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/mucinfo.rb +41 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/mucsimplebot.rb +82 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/register.rb +42 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/remove_registration.rb +18 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/roster.rb +44 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/rosterprint.rb +50 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/rosterrename.rb +34 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/rosterwatch.rb +171 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/send_vcard.rb +67 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/tune_client.rb +56 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/tune_server.rb +58 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/versionbot.rb +75 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r.rb +116 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/base64.rb +32 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams.rb +15 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/filetransfer.rb +319 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/ibb/base.rb +257 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/ibb/initiator.rb +31 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/ibb/target.rb +47 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/base.rb +152 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/initiator.rb +86 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/server.rb +198 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/socks5.rb +65 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb +73 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb.orig +62 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/iq/bytestreams.rb +170 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/iq/si.rb +206 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/callbacks.rb +124 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/caps.rb +1 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/caps/c.rb +53 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/caps/helper/generator.rb +160 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/caps/helper/helper.rb +87 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/client.rb +317 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/command/helper/responder.rb +53 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/command/iq/command.rb +154 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/component.rb +103 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/connection.rb +219 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/dataforms.rb +5 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/dataforms/x/data.rb +297 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/debuglog.rb +42 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/delay.rb +5 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/delay/x/delay.rb +99 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/discovery.rb +7 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/discovery/helper/responder.rb +165 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/discovery/iq/discoinfo.rb +211 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/discovery/iq/discoitems.rb +147 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/errors.rb +281 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/feature_negotiation.rb +5 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/feature_negotiation/iq/feature.rb +28 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/framework/base.rb +55 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/framework/bot.rb +148 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/httpbinding.rb +5 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/httpbinding/client.rb +285 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/idgenerator.rb +37 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/iq.rb +221 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/jid.rb +167 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/message.rb +148 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc.rb +14 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/helper/mucbrowser.rb +92 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/helper/mucclient.rb +462 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/helper/simplemucclient.rb +332 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/iq/mucadmin.rb +23 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/iq/mucadminitem.rb +20 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/iq/mucowner.rb +15 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/item.rb +143 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/x/muc.rb +70 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/x/mucuserinvite.rb +60 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/x/mucuseritem.rb +36 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/presence.rb +232 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub.rb +8 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/configuration.rb +86 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/event.rb +49 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/item.rb +35 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/items.rb +44 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/node_config.rb +48 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/publish.rb +24 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/subscription.rb +62 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/subscription_config.rb +67 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/unsubscribe.rb +48 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/helper/nodebrowser.rb +130 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/helper/nodehelper.rb +156 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/helper/servicehelper.rb +417 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/iq/pubsub.rb +19 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/query.rb +15 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/rexmladdons.rb +151 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/roster.rb +7 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/roster/helper/roster.rb +519 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/roster/iq/roster.rb +215 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/roster/x/roster.rb +138 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/rpc.rb +2 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/rpc/helper/client.rb +123 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/rpc/helper/server.rb +74 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/rpc/helper/xmlrpcaddons.rb +67 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/rpc/iq/rpc.rb +23 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/sasl.rb +237 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/semaphore.rb +38 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/stream.rb +497 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/streamparser.rb +77 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/tune.rb +2 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/tune/helper/helper.rb +58 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/tune/tune.rb +113 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/vcard.rb +6 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/vcard/helper/vcard.rb +84 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/vcard/iq/vcard.rb +109 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/version.rb +7 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/version/helper/responder.rb +72 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/version/helper/simpleresponder.rb +44 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/version/iq/version.rb +105 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/x.rb +37 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/xhtml.rb +1 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/xhtml/html.rb +115 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/xmpp4r.rb +18 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/xmppelement.rb +168 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/xmppstanza.rb +162 -0
- data/lib/vendor/xmpp4r/setup.rb +1586 -0
- data/lib/vendor/xmpp4r/test/bytestreams/tc_ibb.rb +186 -0
- data/lib/vendor/xmpp4r/test/bytestreams/tc_socks5bytestreams.rb +113 -0
- data/lib/vendor/xmpp4r/test/caps/tc_helper.rb +156 -0
- data/lib/vendor/xmpp4r/test/dataforms/tc_data.rb +81 -0
- data/lib/vendor/xmpp4r/test/delay/tc_xdelay.rb +51 -0
- data/lib/vendor/xmpp4r/test/discovery/tc_responder.rb +91 -0
- data/lib/vendor/xmpp4r/test/lib/assert_equal_xml.rb +14 -0
- data/lib/vendor/xmpp4r/test/lib/clienttester.rb +120 -0
- data/lib/vendor/xmpp4r/test/muc/tc_muc_mucclient.rb +830 -0
- data/lib/vendor/xmpp4r/test/muc/tc_muc_simplemucclient.rb +114 -0
- data/lib/vendor/xmpp4r/test/muc/tc_mucowner.rb +50 -0
- data/lib/vendor/xmpp4r/test/pubsub/tc_helper.rb +662 -0
- data/lib/vendor/xmpp4r/test/pubsub/tc_nodeconfig.rb +54 -0
- data/lib/vendor/xmpp4r/test/pubsub/tc_subscriptionconfig.rb +41 -0
- data/lib/vendor/xmpp4r/test/roster/tc_helper.rb +514 -0
- data/lib/vendor/xmpp4r/test/roster/tc_iqqueryroster.rb +173 -0
- data/lib/vendor/xmpp4r/test/roster/tc_xroster.rb +73 -0
- data/lib/vendor/xmpp4r/test/rpc/tc_helper.rb +96 -0
- data/lib/vendor/xmpp4r/test/tc_callbacks.rb +129 -0
- data/lib/vendor/xmpp4r/test/tc_class_names.rb +146 -0
- data/lib/vendor/xmpp4r/test/tc_client.rb +30 -0
- data/lib/vendor/xmpp4r/test/tc_errors.rb +146 -0
- data/lib/vendor/xmpp4r/test/tc_idgenerator.rb +30 -0
- data/lib/vendor/xmpp4r/test/tc_iq.rb +113 -0
- data/lib/vendor/xmpp4r/test/tc_iqquery.rb +31 -0
- data/lib/vendor/xmpp4r/test/tc_jid.rb +204 -0
- data/lib/vendor/xmpp4r/test/tc_message.rb +116 -0
- data/lib/vendor/xmpp4r/test/tc_presence.rb +150 -0
- data/lib/vendor/xmpp4r/test/tc_rexml.rb +139 -0
- data/lib/vendor/xmpp4r/test/tc_stream.rb +229 -0
- data/lib/vendor/xmpp4r/test/tc_streamComponent.rb +95 -0
- data/lib/vendor/xmpp4r/test/tc_streamError.rb +131 -0
- data/lib/vendor/xmpp4r/test/tc_streamSend.rb +59 -0
- data/lib/vendor/xmpp4r/test/tc_streamparser.rb +112 -0
- data/lib/vendor/xmpp4r/test/tc_xmppstanza.rb +135 -0
- data/lib/vendor/xmpp4r/test/ts_xmpp4r.rb +53 -0
- data/lib/vendor/xmpp4r/test/tune/tc_helper_recv.rb +84 -0
- data/lib/vendor/xmpp4r/test/tune/tc_helper_send.rb +74 -0
- data/lib/vendor/xmpp4r/test/tune/tc_tune.rb +79 -0
- data/lib/vendor/xmpp4r/test/vcard/tc_helper.rb +49 -0
- data/lib/vendor/xmpp4r/test/vcard/tc_iqvcard.rb +62 -0
- data/lib/vendor/xmpp4r/test/version/tc_helper.rb +60 -0
- data/lib/vendor/xmpp4r/test/version/tc_iqqueryversion.rb +97 -0
- data/lib/vendor/xmpp4r/test/xhtml/tc_html.rb +41 -0
- data/lib/vendor/xmpp4r/tools/gen_requires.bash +31 -0
- data/lib/vendor/xmpp4r/tools/xmpp4r-gemspec-test.rb +11 -0
- data/lib/vendor/xmpp4r/xmpp4r.gemspec +291 -0
- data/test/jabber_publisher_test.rb +1 -1
- data/test/mail_publisher_test.rb +2 -2
- data/test/mock/twitter.rb +0 -1
- data/test/rspec_builder_test.rb +39 -2
- data/test/rss_publisher_test.rb +1 -1
- data/test/twitter_publisher_test.rb +1 -1
- metadata +268 -53
- 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
|