cerberus 0.6 → 0.7
Sign up to get free protection for your applications and to get access to all the features.
- 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,52 @@
|
|
1
|
+
# Contains Ruby standard library extensions specific to <tt>Twitter4R</tt> library.
|
2
|
+
|
3
|
+
# Extension to Hash to create URL encoded string from key-values
|
4
|
+
class Hash
|
5
|
+
# Returns string formatted for HTTP URL encoded name-value pairs.
|
6
|
+
# For example,
|
7
|
+
# {:id => 'thomas_hardy'}.to_http_str
|
8
|
+
# # => "id=thomas_hardy"
|
9
|
+
# {:id => 23423, :since => Time.now}.to_http_str
|
10
|
+
# # => "since=Thu,%2021%20Jun%202007%2012:10:05%20-0500&id=23423"
|
11
|
+
def to_http_str
|
12
|
+
result = ''
|
13
|
+
return result if self.empty?
|
14
|
+
self.each do |key, val|
|
15
|
+
result << "#{key}=#{CGI.escape(val.to_s)}&"
|
16
|
+
end
|
17
|
+
result.chop # remove the last '&' character, since it can be discarded
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# Extension to Time that outputs RFC2822 compliant string on #to_s
|
22
|
+
class Time
|
23
|
+
alias :old_to_s :to_s
|
24
|
+
|
25
|
+
# Returns RFC2822 compliant string for <tt>Time</tt> object.
|
26
|
+
# For example,
|
27
|
+
# # Tony Blair's last day in office (hopefully)
|
28
|
+
# best_day_ever = Time.local(2007, 6, 27)
|
29
|
+
# best_day_ever.to_s # => "Wed, 27 Jun 2007 00:00:00 +0100"
|
30
|
+
# You can also pass in an option <tt>format</tt> argument that
|
31
|
+
# corresponds to acceptable values according to ActiveSupport's
|
32
|
+
# +Time#to_formatted_s+ method.
|
33
|
+
def to_s(format = nil)
|
34
|
+
format ? self.to_formatted_s(format) : self.rfc2822
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# Extension to Kernel to add #gem_present? without any exceptions raised
|
39
|
+
module Kernel
|
40
|
+
|
41
|
+
# Returns whether or not a gem exists without raising a Gem::LoadError exception
|
42
|
+
def gem_present?(gem_name, version = nil)
|
43
|
+
present = false
|
44
|
+
begin
|
45
|
+
present = !!(version ? gem(gem_name, version) : gem(gem_name))
|
46
|
+
rescue Gem::LoadError => le
|
47
|
+
present = false
|
48
|
+
warn("Gem load error: Couldn't load #{gem_name} #{version ? "with version requirement #{version}: #{le.to_s}": ""}")
|
49
|
+
end
|
50
|
+
present
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# extra.rb contains features that are not considered part of the core library.
|
2
|
+
# This file is not imported by doing <tt>require('twitter')</tt>, so you will
|
3
|
+
# need to import this file separately like:
|
4
|
+
# require('twitter')
|
5
|
+
# require('twitter/extras')
|
6
|
+
|
7
|
+
require('twitter')
|
8
|
+
|
9
|
+
class Twitter::Client
|
10
|
+
@@FEATURED_URIS = {
|
11
|
+
:users => 'http://twitter.com/statuses/featured.json'
|
12
|
+
}
|
13
|
+
|
14
|
+
# Provides access to the Featured Twitter API.
|
15
|
+
#
|
16
|
+
# Currently the only value for <tt>type</tt> accepted is <tt>:users</tt>,
|
17
|
+
# which will return an Array of blessed Twitter::User objects that
|
18
|
+
# represent Twitter's featured users.
|
19
|
+
def featured(type)
|
20
|
+
uri = @@FEATURED_URIS[type]
|
21
|
+
response = http_connect {|conn| create_http_get_request(uri) }
|
22
|
+
bless_models(Twitter::User.unmarshal(response.body))
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class Twitter::User
|
27
|
+
class << self
|
28
|
+
# Provides access to the Featured Twitter API via the Twitter4R Model
|
29
|
+
# interface.
|
30
|
+
#
|
31
|
+
# The following lines of code are equivalent to each other:
|
32
|
+
# users1 = Twitter::User.features(client)
|
33
|
+
# users2 = client.featured(:users)
|
34
|
+
# where <tt>users1</tt> and <tt>users2</tt> would be logically equivalent.
|
35
|
+
def featured(client)
|
36
|
+
client.featured(:users)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# meta.rb contains <tt>Twitter::Meta</tt> and related classes that
|
2
|
+
# help define the metadata of the <tt>Twitter4R</tt> project.
|
3
|
+
|
4
|
+
require('rubygems')
|
5
|
+
require('erb')
|
6
|
+
|
7
|
+
class Twitter::Meta #:nodoc:
|
8
|
+
attr_accessor :root_dir
|
9
|
+
attr_reader :gem_spec, :project_files, :spec_files
|
10
|
+
|
11
|
+
# Initializer for Twitter::Meta class. Takes <tt>root_dir</tt> as parameter.
|
12
|
+
def initialize(root_dir)
|
13
|
+
@root_dir = root_dir
|
14
|
+
end
|
15
|
+
|
16
|
+
# Returns package information defined in <tt>root_dir</tt>/pkg-info.yml
|
17
|
+
def pkg_info
|
18
|
+
yaml_file = File.join(@root_dir, 'pkg-info.yml')
|
19
|
+
ryaml = ERB.new(File.read(yaml_file), 0)
|
20
|
+
s = ryaml.result(binding)
|
21
|
+
YAML.load(s)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Returns RubyGems spec information
|
25
|
+
def spec_info
|
26
|
+
self.pkg_info['spec'] if self.pkg_info
|
27
|
+
end
|
28
|
+
|
29
|
+
# Returns list of project files
|
30
|
+
def project_files
|
31
|
+
@project_files ||= Dir.glob(File.join(@root_dir, 'lib/**/*.rb'))
|
32
|
+
@project_files
|
33
|
+
end
|
34
|
+
|
35
|
+
# Returns list of specification files
|
36
|
+
def spec_files
|
37
|
+
@spec_files ||= Dir.glob(File.join(@root_dir, 'spec/**/*_spec.rb'))
|
38
|
+
@spec_files
|
39
|
+
end
|
40
|
+
|
41
|
+
# Returns RubyGem specification for Twitter4R project
|
42
|
+
def gem_spec
|
43
|
+
@gem_spec ||= Gem::Specification.new do |spec|
|
44
|
+
self.spec_info.each do |key, val|
|
45
|
+
if val.is_a?(Hash)
|
46
|
+
val.each do |k, v|
|
47
|
+
spec.send(key, k, v)
|
48
|
+
end
|
49
|
+
else
|
50
|
+
spec.send("#{key}=", val)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
@gem_spec
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,360 @@
|
|
1
|
+
# Contains Twitter4R Model API.
|
2
|
+
|
3
|
+
module Twitter
|
4
|
+
# Mixin module for model classes. Includes generic class methods like
|
5
|
+
# unmarshal.
|
6
|
+
#
|
7
|
+
# To create a new model that includes this mixin's features simply:
|
8
|
+
# class NewModel
|
9
|
+
# include Twitter::ModelMixin
|
10
|
+
# end
|
11
|
+
#
|
12
|
+
# This mixin module automatically includes <tt>Twitter::ClassUtilMixin</tt>
|
13
|
+
# features.
|
14
|
+
#
|
15
|
+
# The contract for models to use this mixin correctly is that the class
|
16
|
+
# including this mixin must provide an class method named <tt>attributes</tt>
|
17
|
+
# that will return an Array of attribute symbols that will be checked
|
18
|
+
# in #eql? override method. The following would be sufficient:
|
19
|
+
# def self.attributes; @@ATTRIBUTES; end
|
20
|
+
module ModelMixin #:nodoc:
|
21
|
+
def self.included(base) #:nodoc:
|
22
|
+
base.send(:include, Twitter::ClassUtilMixin)
|
23
|
+
base.send(:include, InstanceMethods)
|
24
|
+
base.extend(ClassMethods)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Class methods defined for <tt>Twitter::ModelMixin</tt> module.
|
28
|
+
module ClassMethods #:nodoc:
|
29
|
+
# Unmarshal object singular or plural array of model objects
|
30
|
+
# from JSON serialization. Currently JSON is only supported
|
31
|
+
# since this is all <tt>Twitter4R</tt> needs.
|
32
|
+
def unmarshal(raw)
|
33
|
+
input = JSON.parse(raw)
|
34
|
+
def unmarshal_model(hash)
|
35
|
+
self.new(hash)
|
36
|
+
end
|
37
|
+
return unmarshal_model(input) if input.is_a?(Hash) # singular case
|
38
|
+
result = []
|
39
|
+
input.each do |hash|
|
40
|
+
model = unmarshal_model(hash) if hash.is_a?(Hash)
|
41
|
+
result << model
|
42
|
+
end if input.is_a?(Array)
|
43
|
+
result # plural case
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# Instance methods defined for <tt>Twitter::ModelMixin</tt> module.
|
48
|
+
module InstanceMethods #:nodoc:
|
49
|
+
attr_accessor :client
|
50
|
+
# Equality method override of Object#eql? default.
|
51
|
+
#
|
52
|
+
# Relies on the class using this mixin to provide a <tt>attributes</tt>
|
53
|
+
# class method that will return an Array of attributes to check are
|
54
|
+
# equivalent in this #eql? override.
|
55
|
+
#
|
56
|
+
# It is by design that the #eql? method will raise a NoMethodError
|
57
|
+
# if no <tt>attributes</tt> class method exists, to alert you that
|
58
|
+
# you must provide it for a meaningful result from this #eql? override.
|
59
|
+
# Otherwise this will return a meaningless result.
|
60
|
+
def eql?(other)
|
61
|
+
attrs = self.class.attributes
|
62
|
+
attrs.each do |att|
|
63
|
+
return false unless self.send(att).eql?(other.send(att))
|
64
|
+
end
|
65
|
+
true
|
66
|
+
end
|
67
|
+
|
68
|
+
# Returns integer representation of model object instance.
|
69
|
+
#
|
70
|
+
# For example,
|
71
|
+
# status = Twitter::Status.new(:id => 234343)
|
72
|
+
# status.to_i #=> 234343
|
73
|
+
def to_i
|
74
|
+
@id
|
75
|
+
end
|
76
|
+
|
77
|
+
# Returns string representation of model object instance.
|
78
|
+
#
|
79
|
+
# For example,
|
80
|
+
# status = Twitter::Status.new(:text => 'my status message')
|
81
|
+
# status.to_s #=> 'my status message'
|
82
|
+
#
|
83
|
+
# If a model class doesn't have a @text attribute defined
|
84
|
+
# the default Object#to_s will be returned as the result.
|
85
|
+
def to_s
|
86
|
+
self.respond_to?(:text) ? @text : super.to_s
|
87
|
+
end
|
88
|
+
|
89
|
+
# Returns hash representation of model object instance.
|
90
|
+
#
|
91
|
+
# For example,
|
92
|
+
# u = Twitter::User.new(:id => 2342342, :screen_name => 'tony_blair_is_the_devil')
|
93
|
+
# u.to_hash #=> {:id => 2342342, :screen_name => 'tony_blair_is_the_devil'}
|
94
|
+
#
|
95
|
+
# This method also requires that the class method <tt>attributes</tt> be
|
96
|
+
# defined to return an Array of attributes for the class.
|
97
|
+
def to_hash
|
98
|
+
attrs = self.class.attributes
|
99
|
+
result = {}
|
100
|
+
attrs.each do |att|
|
101
|
+
value = self.send(att)
|
102
|
+
value = value.to_hash if value.respond_to?(:to_hash)
|
103
|
+
result[att] = value if value
|
104
|
+
end
|
105
|
+
result
|
106
|
+
end
|
107
|
+
|
108
|
+
# "Blesses" model object.
|
109
|
+
#
|
110
|
+
# Should be overridden by model class if special behavior is expected
|
111
|
+
#
|
112
|
+
# Expected to return blessed object (usually <tt>self</tt>)
|
113
|
+
def bless(client)
|
114
|
+
self.basic_bless(client)
|
115
|
+
end
|
116
|
+
|
117
|
+
protected
|
118
|
+
# Basic "blessing" of model object
|
119
|
+
def basic_bless(client)
|
120
|
+
self.client = client
|
121
|
+
self
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
module AuthenticatedUserMixin
|
127
|
+
def self.included(base)
|
128
|
+
base.send(:include, InstanceMethods)
|
129
|
+
end
|
130
|
+
|
131
|
+
module InstanceMethods
|
132
|
+
# Returns an Array of user objects that represents the authenticated
|
133
|
+
# user's friends on Twitter.
|
134
|
+
def followers(options = {})
|
135
|
+
@client.my(:followers, options)
|
136
|
+
end
|
137
|
+
|
138
|
+
# Adds given user as a friend. Returns user object as given by
|
139
|
+
# <tt>Twitter</tt> REST server response.
|
140
|
+
#
|
141
|
+
# For <tt>user</tt> argument you may pass in the unique integer
|
142
|
+
# user ID, screen name or Twitter::User object representation.
|
143
|
+
def befriend(user)
|
144
|
+
@client.friend(:add, user)
|
145
|
+
end
|
146
|
+
|
147
|
+
# Removes given user as a friend. Returns user object as given by
|
148
|
+
# <tt>Twitter</tt> REST server response.
|
149
|
+
#
|
150
|
+
# For <tt>user</tt> argument you may pass in the unique integer
|
151
|
+
# user ID, screen name or Twitter::User object representation.
|
152
|
+
def defriend(user)
|
153
|
+
@client.friend(:remove, user)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
# Represents a <tt>Twitter</tt> user
|
159
|
+
class User
|
160
|
+
include ModelMixin
|
161
|
+
@@ATTRIBUTES = [:id, :name, :description, :location, :screen_name, :url,
|
162
|
+
:protected, :profile_image_url, :profile_background_color,
|
163
|
+
:profile_text_color, :profile_link_color, :profile_sidebar_fill_color,
|
164
|
+
:profile_sidebar_border_color, :profile_background_image_url,
|
165
|
+
:profile_background_tile, :utc_offset, :time_zone,
|
166
|
+
:following, :notifications, :favourites_count, :followers_count,
|
167
|
+
:friends_count, :statuses_count, :created_at, ]
|
168
|
+
attr_accessor *@@ATTRIBUTES
|
169
|
+
|
170
|
+
class << self
|
171
|
+
# Used as factory method callback
|
172
|
+
def attributes; @@ATTRIBUTES; end
|
173
|
+
|
174
|
+
# Returns user model object with given <tt>id</tt> using the configuration
|
175
|
+
# and credentials of the <tt>client</tt> object passed in.
|
176
|
+
#
|
177
|
+
# You can pass in either the user's unique integer ID or the user's
|
178
|
+
# screen name.
|
179
|
+
def find(id, client)
|
180
|
+
client.user(id)
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
# Override of ModelMixin#bless method.
|
185
|
+
#
|
186
|
+
# Adds #followers instance method when user object represents
|
187
|
+
# authenticated user. Otherwise just do basic bless.
|
188
|
+
#
|
189
|
+
# This permits applications using <tt>Twitter4R</tt> to write
|
190
|
+
# Rubyish code like this:
|
191
|
+
# followers = user.followers if user.is_me?
|
192
|
+
# Or:
|
193
|
+
# followers = user.followers if user.respond_to?(:followers)
|
194
|
+
def bless(client)
|
195
|
+
basic_bless(client)
|
196
|
+
self.instance_eval(%{
|
197
|
+
self.class.send(:include, Twitter::AuthenticatedUserMixin)
|
198
|
+
}) if self.is_me? and not self.respond_to?(:followers)
|
199
|
+
self
|
200
|
+
end
|
201
|
+
|
202
|
+
# Returns whether this <tt>Twitter::User</tt> model object
|
203
|
+
# represents the authenticated user of the <tt>client</tt>
|
204
|
+
# that blessed it.
|
205
|
+
def is_me?
|
206
|
+
# TODO: Determine whether we should cache this or not?
|
207
|
+
# Might be dangerous to do so, but do we want to support
|
208
|
+
# the edge case where this would cause a problem? i.e.
|
209
|
+
# changing authenticated user after initial use of
|
210
|
+
# authenticated API.
|
211
|
+
# TBD: To cache or not to cache. That is the question!
|
212
|
+
# Since this is an implementation detail we can leave this for
|
213
|
+
# subsequent 0.2.x releases. It doesn't have to be decided before
|
214
|
+
# the 0.2.0 launch.
|
215
|
+
@screen_name == @client.instance_eval("@login")
|
216
|
+
end
|
217
|
+
|
218
|
+
# Returns an Array of user objects that represents the authenticated
|
219
|
+
# user's friends on Twitter.
|
220
|
+
def friends
|
221
|
+
@client.user(@id, :friends)
|
222
|
+
end
|
223
|
+
end # User
|
224
|
+
|
225
|
+
# Represents a status posted to <tt>Twitter</tt> by a <tt>Twitter</tt> user.
|
226
|
+
class Status
|
227
|
+
include ModelMixin
|
228
|
+
@@ATTRIBUTES = [:id, :text, :source, :truncated, :created_at, :user,
|
229
|
+
:favorited, :in_reply_to_status_id, :in_reply_to_user_id,
|
230
|
+
:in_reply_to_screen_name]
|
231
|
+
attr_accessor *@@ATTRIBUTES
|
232
|
+
|
233
|
+
class << self
|
234
|
+
# Used as factory method callback
|
235
|
+
def attributes; @@ATTRIBUTES; end
|
236
|
+
|
237
|
+
# Returns status model object with given <tt>status</tt> using the
|
238
|
+
# configuration and credentials of the <tt>client</tt> object passed in.
|
239
|
+
def find(id, client)
|
240
|
+
client.status(:get, id)
|
241
|
+
end
|
242
|
+
|
243
|
+
# Creates a new status for the authenticated user of the given
|
244
|
+
# <tt>client</tt> context.
|
245
|
+
#
|
246
|
+
# You MUST include a valid/authenticated <tt>client</tt> context
|
247
|
+
# in the given <tt>params</tt> argument.
|
248
|
+
#
|
249
|
+
# For example:
|
250
|
+
# status = Twitter::Status.create(
|
251
|
+
# :text => 'I am shopping for flip flops',
|
252
|
+
# :client => client)
|
253
|
+
#
|
254
|
+
# An <tt>ArgumentError</tt> will be raised if no valid client context
|
255
|
+
# is given in the <tt>params</tt> Hash. For example,
|
256
|
+
# status = Twitter::Status.create(:text => 'I am shopping for flip flops')
|
257
|
+
# The above line of code will raise an <tt>ArgumentError</tt>.
|
258
|
+
#
|
259
|
+
# The same is true when you do not provide a <tt>:text</tt> key-value
|
260
|
+
# pair in the <tt>params</tt> argument given.
|
261
|
+
#
|
262
|
+
# The Twitter::Status object returned after the status successfully
|
263
|
+
# updates on the Twitter server side is returned from this method.
|
264
|
+
def create(params)
|
265
|
+
client, text = params[:client], params[:text]
|
266
|
+
raise ArgumentError, 'Valid client context must be provided' unless client.is_a?(Twitter::Client)
|
267
|
+
raise ArgumentError, 'Must provide text for the status to update' unless text.is_a?(String)
|
268
|
+
client.status(:post, text)
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
def reply?
|
273
|
+
!!@in_reply_to_status_id
|
274
|
+
end
|
275
|
+
|
276
|
+
def reply(status)
|
277
|
+
client.status(:reply, :status => status, :in_reply_to_status_id => @id)
|
278
|
+
end
|
279
|
+
|
280
|
+
protected
|
281
|
+
# Constructor callback
|
282
|
+
def init
|
283
|
+
@user = User.new(@user) if @user.is_a?(Hash)
|
284
|
+
@created_at = Time.parse(@created_at) if @created_at.is_a?(String)
|
285
|
+
end
|
286
|
+
end # Status
|
287
|
+
|
288
|
+
# Represents a direct message on <tt>Twitter</tt> between <tt>Twitter</tt> users.
|
289
|
+
class Message
|
290
|
+
include ModelMixin
|
291
|
+
@@ATTRIBUTES = [:id, :recipient, :sender, :text, :created_at]
|
292
|
+
attr_accessor *@@ATTRIBUTES
|
293
|
+
|
294
|
+
class << self
|
295
|
+
# Used as factory method callback
|
296
|
+
def attributes; @@ATTRIBUTES; end
|
297
|
+
|
298
|
+
# Raises <tt>NotImplementedError</tt> because currently
|
299
|
+
# <tt>Twitter</tt> doesn't provide a facility to retrieve
|
300
|
+
# one message by unique ID.
|
301
|
+
def find(id, client)
|
302
|
+
raise NotImplementedError, 'Twitter has yet to implement a REST API for this. This is not a Twitter4R library limitation.'
|
303
|
+
end
|
304
|
+
|
305
|
+
# Creates a new direct message from the authenticated user of the
|
306
|
+
# given <tt>client</tt> context.
|
307
|
+
#
|
308
|
+
# You MUST include a valid/authenticated <tt>client</tt> context
|
309
|
+
# in the given <tt>params</tt> argument.
|
310
|
+
#
|
311
|
+
# For example:
|
312
|
+
# status = Twitter::Message.create(
|
313
|
+
# :text => 'I am shopping for flip flops',
|
314
|
+
# :receipient => 'anotherlogin',
|
315
|
+
# :client => client)
|
316
|
+
#
|
317
|
+
# An <tt>ArgumentError</tt> will be raised if no valid client context
|
318
|
+
# is given in the <tt>params</tt> Hash. For example,
|
319
|
+
# status = Twitter::Status.create(:text => 'I am shopping for flip flops')
|
320
|
+
# The above line of code will raise an <tt>ArgumentError</tt>.
|
321
|
+
#
|
322
|
+
# The same is true when you do not provide any of the following
|
323
|
+
# key-value pairs in the <tt>params</tt> argument given:
|
324
|
+
# * <tt>text</tt> - the String that will be the message text to send to <tt>user</tt>
|
325
|
+
# * <tt>recipient</tt> - the user ID, screen_name or Twitter::User object representation of the recipient of the direct message
|
326
|
+
#
|
327
|
+
# The Twitter::Message object returned after the direct message is
|
328
|
+
# successfully sent on the Twitter server side is returned from
|
329
|
+
# this method.
|
330
|
+
def create(params)
|
331
|
+
client, text, recipient = params[:client], params[:text], params[:recipient]
|
332
|
+
raise ArgumentError, 'Valid client context must be given' unless client.is_a?(Twitter::Client)
|
333
|
+
raise ArgumentError, 'Message text must be supplied to send direct message' unless text.is_a?(String)
|
334
|
+
raise ArgumentError, 'Recipient user must be specified to send direct message' unless [Twitter::User, Integer, String].member?(recipient.class)
|
335
|
+
client.message(:post, text, recipient)
|
336
|
+
end
|
337
|
+
end
|
338
|
+
|
339
|
+
protected
|
340
|
+
# Constructor callback
|
341
|
+
def init
|
342
|
+
@sender = User.new(@sender) if @sender.is_a?(Hash)
|
343
|
+
@recipient = User.new(@recipient) if @recipient.is_a?(Hash)
|
344
|
+
@created_at = Time.parse(@created_at) if @created_at.is_a?(String)
|
345
|
+
end
|
346
|
+
end # Message
|
347
|
+
|
348
|
+
# RateLimitStatus provides information about how many requests you have left
|
349
|
+
# and when you can resume more requests if your remaining_hits count is zero.
|
350
|
+
class RateLimitStatus
|
351
|
+
include ModelMixin
|
352
|
+
@@ATTRIBUTES = [:remaining_hits, :hourly_limit, :reset_time_in_seconds, :reset_time]
|
353
|
+
attr_accessor *@@ATTRIBUTES
|
354
|
+
|
355
|
+
class << self
|
356
|
+
# Used as factory method callback
|
357
|
+
def attributes; @@ATTRIBUTES; end
|
358
|
+
end
|
359
|
+
end
|
360
|
+
end # Twitter
|