{"id":1013,"date":"2011-02-26T15:30:41","date_gmt":"2011-02-26T06:30:41","guid":{"rendered":"http:\/\/www.kazu.tv\/blog\/?p=1013"},"modified":"2011-02-26T15:30:41","modified_gmt":"2011-02-26T06:30:41","slug":"rubytwitter_api","status":"publish","type":"post","link":"https:\/\/kazu.tv\/blog\/2011\/02\/26\/rubytwitter_api\/","title":{"rendered":"Ruby\u3067Twitter API\u3092\u4f7f\u3046"},"content":{"rendered":"<p>Ruby\u306eTwitter\u95a2\u9023\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u306f\u8272\u3005\u3042\u308b\u307f\u305f\u3044\u3060\u3051\u3069\u3001<a href=\"http:\/\/twitter4r.rubyforge.org\/\" target=\"_blank\">Twitter4R<\/a>\u3092\u4f7f\u3063\u305f\u3002<\/p>\n<h3>\u25a0\u30d0\u30fc\u30b8\u30e7\u30f3<\/h3>\n<p>\u5148\u307b\u3069\u306e\u30da\u30fc\u30b8\u3092\u898b\u308b\u30680.3.0\u304c\u6700\u65b0\u306e\u3088\u3046\u306b\u898b\u3048\u308b\u304c\u3001\u826f\u304f\u8aad\u3080\u3068\u300c\u6700\u65b0\u7248\u306f\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u30b5\u30a4\u30c8\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066\u304f\u308c\u300d\u307f\u305f\u3044\u306b\u66f8\u3044\u3066\u3042\u308b\u3002\u3061\u306a\u307f\u306b\u3001<a href=\"http:\/\/rubyforge.org\/frs\/?group_id=3293\" target=\"_blank\">\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u30b5\u30a4\u30c8<\/a>\u3092\u307f\u308b\u3068 0.5.3 \u304c\u6700\u65b0\u7248\u306e\u3088\u3046\u306b\u3082\u898b\u3048\u308b\u304c\u3001gem install\u3057\u3066\u307f\u305f\u30890.6.0\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u305f\u3002<\/p>\n<h3>\u25a0\u524d\u63d0\u77e5\u8b58<\/h3>\n<p>Twitter API\u3001OAuth\u306b\u3064\u3044\u3066\u306e\u57fa\u790e\u77e5\u8b58\u306f\u3042\u308b\u3082\u306e\u3068\u3059\u308b\u3002\u7279\u306bClient\u3068Browser\u306e\u9055\u3044\u304c\u5206\u304b\u3063\u3066\u306a\u3044\u3068\u6df7\u4e71\u3059\u308b\u304b\u3082\u3002<\/p>\n<p>\u4eca\u56de\u306fClient\u5f62\u5f0f\u306e\u30a2\u30d7\u30ea\u3092\u4f5c\u308b\u3082\u306e\u3068\u3059\u308b\u3002\u307e\u3041\u30dc\u30c3\u30c8\u307f\u305f\u3044\u306a\u3082\u306e\u3092\u60f3\u50cf\u3057\u3066\u3082\u3089\u3048\u3070\u3044\u3044\u304b\u3068\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001&quot;Twitter4R&quot;\u3067\u691c\u7d22\u3057\u3066\u51fa\u3066\u304f\u308b\u30da\u30fc\u30b8\u306f\u7d50\u69cb\u30d1\u30b9\u30ef\u30fc\u30c9\u8a8d\u8a3c\u3092\u4f7f\u3063\u3066\u308b\u3051\u3069\u3001\u4eca\u306f\u30d1\u30b9\u30ef\u30fc\u30c9\u8a8d\u8a3c\u306f\u5ec3\u6b62\u306b\u306a\u3063\u3066\u3044\u3066\u3001API\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u306e\u306b\u306fOAuth\u3092\u4f7f\u3046\u5fc5\u8981\u304c\u3042\u308b\u306e\u3067\u6ce8\u610f\u3002<\/p>\n<p><!--more--><\/p>\n<h3>\u25a0\u4f7f\u3044\u65b9<\/h3>\n<p>\u4e8b\u524d\u306bTwitter\u306e\u958b\u767a\u8005\u5411\u3051\u30b5\u30a4\u30c8\u3067\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u767b\u9332\u3057\u3001\u4ee5\u4e0b\u306e4\u3064\u3092\u78ba\u8a8d\u3057\u3066\u304a\u304f<\/p>\n<ul>\n<li>Consumer key<\/li>\n<li>Consumer secret<\/li>\n<li>Access token<\/li>\n<li>Access secret<\/li>\n<\/ul>\n<p>\u4ee5\u4e0b\u3001\u30b3\u30fc\u30c9\u3002<\/p>\n<pre class=\"brush: ruby; code\">\n# \u521d\u671f\u5316\nTwitter::Client.configure do |c|\nc.oauth_consumer_token = &quot;consumer key&quot;\nc.oauth_consumer_secret = &quot;consumer secret&quot;\nend\n# access token\u3068access secret\u3092\u6e21\u3057\u3066\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3092\u521d\u671f\u5316\nclient = Twitter::Client.new(:oauth_access =&gt; {\n:key    =&gt; &quot;access token&quot;,\n:secret =&gt; &quot;access secret&quot; } )\n# \u5f8c\u306fAPI\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3060\u3051\u3002\n# \u4f8b\u3048\u3070\u3064\u3076\u3084\u304f\u306b\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3084\u308b\u3002\nclient.status(:post, &quot;Hello World!&quot;)\n<\/pre>\n<p>Twitter4R\u306f\u5272\u3068\u30b7\u30f3\u30d7\u30eb\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u3060\u3051\u3069\u3001\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306f\u3042\u307e\u308a\u306a\u3044\u307f\u305f\u3044\u306a\u306e\u3067\u3001\u8a73\u3057\u304f\u306f<a href=\"http:\/\/twitter4r.rubyforge.org\/rdoc\/\" target=\"_blank\">RDoc<\/a>\u3092\u53c2\u7167\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ruby\u306eTwitter\u95a2\u9023\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u306f\u8272\u3005\u3042\u308b\u307f\u305f\u3044\u3060\u3051\u3069\u3001Twitter4R\u3092\u4f7f\u3063\u305f\u3002 \u25a0\u30d0\u30fc\u30b8\u30e7\u30f3 \u5148\u307b\u3069\u306e\u30da\u30fc\u30b8\u3092\u898b\u308b\u30680.3.0\u304c\u6700\u65b0\u306e\u3088\u3046\u306b\u898b\u3048\u308b\u304c\u3001\u826f\u304f\u8aad\u3080\u3068\u300c\u6700\u65b0\u7248\u306f\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u30b5\u30a4\u30c8\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066\u304f\u308c&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[8],"tags":[807,313,810,883],"class_list":["post-1013","post","type-post","status-publish","format-standard","hentry","category-8","tag-oauth","tag-ruby","tag-twitter","tag-twitter4r"],"_links":{"self":[{"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/posts\/1013","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/comments?post=1013"}],"version-history":[{"count":0,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/posts\/1013\/revisions"}],"wp:attachment":[{"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/media?parent=1013"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/categories?post=1013"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/tags?post=1013"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}