<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>RailsStyle - 最新記事RSS一覧</title>
		<link>http://rails.e1blue.net/modules/d3pipes/index.php?page=eachpipe&amp;pipe_id=</link>
		<description></description>
		<lastBuildDate>Fri, 10 Sep 2010 02:26:44 +0900</lastBuildDate>
		<docs>http://backend.userland.com/rss/</docs>
		<generator>XOOPS - d3pipes</generator>
		<category>d3pipes</category>
		<webMaster>「Ruby on Railsに関するtips」を掲載しているSite</webMaster>
		<language>ja</language>

				<item>
			<title>ruby-oauth で Yahoo! OAuth を使う方法</title>
						<link>http://railspress.matake.jp/yahoo-oauth-with-ruby-oauth</link>
						<description>ruby-oauth で Yahoo! OAuth を使おうとしてだいぶはまったので、対応方法をメモ。
まずは oauth_parameter のうち、値が空のものは送らないようにしないと行けないようです。これは Yahoo! 側の問題かな？この問題を解決するには、OAuth::Client::Helper をオーバーライドします。
PLAIN TEXT
LANG : RUBY




# Yahoo! Hacks (for OAuth2.1)


class OAuth::Client::Helper


&amp;#160; def oauth_parameters


&amp;#160; &amp;#160; &amp;#123; &#039;oauth_consumer_key&#039;&amp;#160; &amp;#160; &amp;#160;=&amp;#62; options&amp;#91;:consumer&amp;#93;.key,


&amp;#160; &amp;#160; &amp;#160; &#039;oauth_token&#039;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; =&amp;#62; options&amp;#91;:token&amp;#93; ? options&amp;#91;:token&amp;#93;.token : &#039;&#039;,


&amp;#160; &amp;#160; &amp;#160; &#039;oauth_signature_method&#039; =&amp;#62; options&amp;#91;:signature_method&amp;#93;,


&amp;#160; &amp;#160; &amp;#160; &#039;oauth_session_handle&#039;&amp;#160; &amp;#160;=&amp;#62; options&amp;#91;:oauth_session_handle&amp;#93; ? options&amp;#91;:oauth_session_handle&amp;#93; : &#039;&#039;,


&amp;#160; &amp;#160; [...]</description>
							<content:encoded> <![CDATA[ <p>ruby-oauth で Yahoo! OAuth を使おうとしてだいぶはまったので、対応方法をメモ。</p>
<p>まずは oauth_parameter のうち、値が空のものは送らないようにしないと行けないようです。これは Yahoo! 側の問題かな？この問題を解決するには、OAuth::Client::Helper をオーバーライドします。</p>
<div class="igBar"><span id="lruby-3"><a href="#" onclick="javascript:showPlainTxt('ruby-3'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">LANG : RUBY</span>
<div id="ruby-3">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000; font-style:italic;"># Yahoo! Hacks (for OAuth2.1)</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">class</span> OAuth::Client::Helper</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> oauth_parameters</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span> 'oauth_consumer_key'&nbsp; &nbsp; &nbsp;=&gt; options<span style="color:#006600; font-weight:bold;">&#91;</span>:consumer<span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">key</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; 'oauth_token'&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&gt; options<span style="color:#006600; font-weight:bold;">&#91;</span>:token<span style="color:#006600; font-weight:bold;">&#93;</span> ? options<span style="color:#006600; font-weight:bold;">&#91;</span>:token<span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">token</span> : '',</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; 'oauth_signature_method' =&gt; options<span style="color:#006600; font-weight:bold;">&#91;</span>:signature_method<span style="color:#006600; font-weight:bold;">&#93;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; 'oauth_session_handle'&nbsp; &nbsp;=&gt; options<span style="color:#006600; font-weight:bold;">&#91;</span>:oauth_session_handle<span style="color:#006600; font-weight:bold;">&#93;</span> ? options<span style="color:#006600; font-weight:bold;">&#91;</span>:oauth_session_handle<span style="color:#006600; font-weight:bold;">&#93;</span> : '',</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; 'oauth_timestamp'&nbsp; &nbsp; &nbsp; &nbsp; =&gt; timestamp,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; 'oauth_nonce'&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&gt; nonce,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; 'oauth_version'&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&gt; '<span style="color:#006666;color:#800000;">1</span>.<span style="color:#006666;color:#800000;">0</span>' <span style="color:#006600; font-weight:bold;">&#125;</span>.<span style="color:#9900CC;">reject</span> <span style="color:#006600; font-weight:bold;">&#123;</span> |k,v| v == <span style="color:#996600;">""</span> <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">end</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>次に、Yahoo! OAuth では１時間ごとに token を再発行したり、その際に session_handle を使ったりするので、ruby-oauth の OAuth::AccessToken と OAuth::RequestToken をこれらの属性に対応させる必要があります。</p>
<p><span id="more-169"></span></p>
<p>今はとりあえず Yahoo 用に AccessToken と RequestToken クラスを用意してやってます。多分そのうち ruby-oauth 側が対応するはずなので、それまではこれで。</p>
<div class="igBar"><span id="lruby-4"><a href="#" onclick="javascript:showPlainTxt('ruby-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">LANG : RUBY</span>
<div id="ruby-4">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">class</span> OAuth::AccessToken::Yahoo &lt;OAuth::AccessToken</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; attr_accessor :session_handle, :expires_in, :authorization_expires_in</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> initialize<span style="color:#006600; font-weight:bold;">&#40;</span>consumer, token, secret, options = <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">super</span><span style="color:#006600; font-weight:bold;">&#40;</span>consumer, token, secret<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; @session_handle&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= options<span style="color:#006600; font-weight:bold;">&#91;</span>:session_handle<span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; @expires_in&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= options<span style="color:#006600; font-weight:bold;">&#91;</span>:expires_in<span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; @authorization_expires_in = options<span style="color:#006600; font-weight:bold;">&#91;</span>:authorization_expires_in<span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">class</span> OAuth::RequestToken::Yahoo &lt;OAuth::RequestToken</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> get_access_token<span style="color:#006600; font-weight:bold;">&#40;</span>options=<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; response = consumer.<span style="color:#9900CC;">token_request</span><span style="color:#006600; font-weight:bold;">&#40;</span>consumer.<span style="color:#9900CC;">http_method</span>, consumer.<span style="color:#9900CC;">access_token_path</span>, <span style="color:#0000FF; font-weight:bold;">self</span>, options<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; access_token = OAuth::AccessToken::Yahoo.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; consumer,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; response<span style="color:#006600; font-weight:bold;">&#91;</span>:oauth_token<span style="color:#006600; font-weight:bold;">&#93;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; response<span style="color:#006600; font-weight:bold;">&#91;</span>:oauth_token_secret<span style="color:#006600; font-weight:bold;">&#93;</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span> :session_handle&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=&gt; response<span style="color:#006600; font-weight:bold;">&#91;</span>:oauth_session_handle<span style="color:#006600; font-weight:bold;">&#93;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; :expires_in&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=&gt; response<span style="color:#006600; font-weight:bold;">&#91;</span>:oauth_expires_in<span style="color:#006600; font-weight:bold;">&#93;</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; :authorization_expires_in =&gt; response<span style="color:#006600; font-weight:bold;">&#91;</span>:oauth_authorization_expires_in<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">end</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>あとはtoken の長さが 255 文字を超える（常に670文字？）のと、:session_handle, :expires_in, :authorization_expires_in の３つの属性が追加されるので、DB にそれらを反映させるのを忘れずに。</p>
 ]]> </content:encoded>
						<guid>http://railspress.matake.jp/?p=169</guid>
			<pubDate>Sat, 27 Dec 2008 15:04:27 +0900</pubDate>
			<category>Array</category>
		</item>
				<item>
			<title>iKnow! gem 0.2.2</title>
						<link>http://railspress.matake.jp/iknow-gem-version-0-2-2</link>
						<description>version 0.4.0 - version 0.1.1 までの更新履歴はこちら。
iKnow! gem version 0.1.1 - 京の路
iKnow! gem version up - OAuth &amp;#038; Basic認証 - 京の路
version 0.2.2 となり、ようやくこちらのブログでも発表できるレベルになりました。version 0.2.2 では、OAuth / Basic 認証のサポート、すべての要認証 API Call のサポートが追加されています。
OAuth / Basic 認証は同じインタフェースで使えます。Iknow::Auth に username と password を指定すれば Basic 認証、token と secret を指定すれば OAuth を使います。
PLAIN TEXT
LANG : RUBY




iknow_auth = case auth_mode


&amp;#160; when :oauth


&amp;#160; &amp;#160; Iknow::Auth.new&amp;#40;


&amp;#160; [...]</description>
							<content:encoded> <![CDATA[ <p>version 0.4.0 - version 0.1.1 までの更新履歴はこちら。<br />
<a href="http://blog.matake.jp/archives/iknow_gem_version_011.html" title="iKnow! gem version 0.1.1 - 京の路" target="_blank">iKnow! gem version 0.1.1 - 京の路</a><br />
<a href="http://blog.matake.jp/archives/iknow_gem_version_up_oauth_and_basic_auth.html" title="iKnow! gem version up - OAuth &#038; Basic認証 - 京の路" target="_blank">iKnow! gem version up - OAuth &#038; Basic認証 - 京の路</a></p>
<p>version 0.2.2 となり、ようやくこちらのブログでも発表できるレベルになりました。version 0.2.2 では、OAuth / Basic 認証のサポート、すべての要認証 API Call のサポートが追加されています。</p>
<p>OAuth / Basic 認証は同じインタフェースで使えます。Iknow::Auth に username と password を指定すれば Basic 認証、token と secret を指定すれば OAuth を使います。</p>
<div class="igBar"><span id="lruby-8"><a href="#" onclick="javascript:showPlainTxt('ruby-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">LANG : RUBY</span>
<div id="ruby-8">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iknow_auth = <span style="color:#9966CC; font-weight:bold;">case</span> auth_mode</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">when</span> :oauth</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; Iknow::Auth.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; :token =&gt; OAUTH_ACCESS_TOKEN,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; :secret =&gt; OAUTH_ACCESS_TOKEN_SECRET</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">when</span> :basic_auth</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; Iknow::Auth.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; :username =&gt; IKNOW_USERNAME,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; :password =&gt; IKNOW_PASSWORD</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">end</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>あとは、要認証 API Call の第一引数に Iknow::Auth のインスタンスを渡してください。（※ 12月23日現在、OAuth の DELETE 系 Call がエラーになりますが、これは iKnow! API 側の問題です）</p>
<p><span id="more-155"></span></p>
<div class="igBar"><span id="lruby-9"><a href="#" onclick="javascript:showPlainTxt('ruby-9'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">LANG : RUBY</span>
<div id="ruby-9">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000; font-style:italic;">## List API</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">"# List API"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@list = Iknow::List.<span style="color:#9900CC;">create</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; iknow_auth,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; :title =&gt; 'iKnow! gem <span style="color:#CC0066; font-weight:bold;">test</span>',</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; :description =&gt; 'A list <span style="color:#9966CC; font-weight:bold;">for</span> iKnow! gem <span style="color:#CC0066; font-weight:bold;">test</span>'</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@list.<span style="color:#9900CC;">add_item</span><span style="color:#006600; font-weight:bold;">&#40;</span>iknow_auth, Iknow::Item.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;color:#800000;">437525</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@list.<span style="color:#9900CC;">delete_item</span><span style="color:#006600; font-weight:bold;">&#40;</span>iknow_auth, @list.<span style="color:#9900CC;">items</span>.<span style="color:#9900CC;">first</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@list.<span style="color:#9900CC;">delete</span><span style="color:#006600; font-weight:bold;">&#40;</span>iknow_auth<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000; font-style:italic;">## Item API</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">"# Item API"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@item = Iknow::Item.<span style="color:#9900CC;">create</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; iknow_auth,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; :cue =&gt; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; :text =&gt; 'hello world!',</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; :language =&gt; 'en',</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; :part_of_speech =&gt; 'E'</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; :response =&gt; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; :text =&gt; 'ハローワールド！',</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; :language =&gt; 'ja'</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@item.<span style="color:#9900CC;">add_image</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; iknow_auth,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; 'http://farm4.<span style="color:#9900CC;">static</span>.<span style="color:#9900CC;">flickr</span>.<span style="color:#9900CC;">com</span>/<span style="color:#006666;color:#800000;">3276</span>/<span style="color:#006666;color:#800000;">3102381796</span>_a33c1ffdf1.<span style="color:#9900CC;">jpg</span>'</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@item.<span style="color:#9900CC;">add_sound</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; iknow_auth,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; 'http://matake.<span style="color:#9900CC;">jp</span>/download/hello_world.<span style="color:#9900CC;">mp3</span>'</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@item.<span style="color:#9900CC;">add_tags</span><span style="color:#006600; font-weight:bold;">&#40;</span>iknow_auth, 'sample', 'programming'<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000; font-style:italic;">## Sentence API</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">"# Sentence API"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@sentence = Iknow::Sentence.<span style="color:#9900CC;">create</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; iknow_auth,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; :text =&gt; 'Hello World!',</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; :item =&gt; Iknow::Item.<span style="color:#9900CC;">matching</span><span style="color:#006600; font-weight:bold;">&#40;</span>'hello world'<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">first</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@sentence.<span style="color:#9900CC;">add_image</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; iknow_auth,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; 'http://farm4.<span style="color:#9900CC;">static</span>.<span style="color:#9900CC;">flickr</span>.<span style="color:#9900CC;">com</span>/<span style="color:#006666;color:#800000;">3276</span>/<span style="color:#006666;color:#800000;">3102381796</span>_a33c1ffdf1.<span style="color:#9900CC;">jpg</span>'</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@sentence.<span style="color:#9900CC;">add_sound</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; iknow_auth,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; 'http://matake.<span style="color:#9900CC;">jp</span>/download/hello_world.<span style="color:#9900CC;">mp3</span>'</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>インストールは以下のコマンドで。</p>
<div class="igBar"><span id="lcode-10"><a href="#" onclick="javascript:showPlainTxt('code-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">LANG : shell etc.</span>
<div id="code-10">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">gem install iknow </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
 ]]> </content:encoded>
						<guid>http://railspress.matake.jp/?p=155</guid>
			<pubDate>Tue, 23 Dec 2008 16:09:56 +0900</pubDate>
			<category>Array</category>
		</item>
				<item>
			<title>iKnow! gem をアップデートしました version 0.0.4</title>
						<link>http://railspress.matake.jp/iknow-gem-version-0-0-4</link>
						<description>新規 Call の反映と、各 Call で追加された Attributes の反映が主な変更点です。Item creation API は Basic 認証で実装してしまおうかと思ってます。いつやるかは未定（ｱｾｱｾ
相変わらずドキュメントはサンプルコードですが、List / Item / Sentence の find や、User#study.total_summary などが新しく追加されています。また :include_sentences と :include_items は新しく追加されたパラメータです。
PLAIN TEXT
LANG : RUBY




## User API


@user = Iknow::User.find&amp;#40;&#039;kirk&#039;&amp;#41;


@user.items&amp;#40;:include_sentences =&amp;#62; true&amp;#41;


@user.lists


@user.friends


@user.study.results


@user.study.total_summary


@matched_users = Iknow::User.matching&amp;#40;&#039;matake&#039;&amp;#41;


&amp;#160;


## List API


@recent_lists = Iknow::List.recent


@list = Iknow::List.find&amp;#40;31509, :include_sentences =&amp;#62; true, :include_items =&amp;#62; true&amp;#41;


@list.items


@list.sentences


@matched_lists = Iknow::List.matching&amp;#40;&quot;イタリア語であいさつ&quot;&amp;#41;


&amp;#160;


# puts Iknow::List.find(31509, :include_sentences =&amp;#62; true, :include_items [...]</description>
							<content:encoded> <![CDATA[ <p>新規 Call の反映と、各 Call で追加された Attributes の反映が主な変更点です。Item creation API は Basic 認証で実装してしまおうかと思ってます。いつやるかは未定（ｱｾｱｾ</p>
<p>相変わらずドキュメントはサンプルコードですが、List / Item / Sentence の find や、User#study.total_summary などが新しく追加されています。また :include_sentences と :include_items は新しく追加されたパラメータです。</p>
<div class="igBar"><span id="lruby-12"><a href="#" onclick="javascript:showPlainTxt('ruby-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">LANG : RUBY</span>
<div id="ruby-12">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000; font-style:italic;">## User API</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@user = Iknow::User.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span>'kirk'<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@user.<span style="color:#9900CC;">items</span><span style="color:#006600; font-weight:bold;">&#40;</span>:include_sentences =&gt; <span style="color:#0000FF; font-weight:bold;">true</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@user.<span style="color:#9900CC;">lists</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@user.<span style="color:#9900CC;">friends</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@user.<span style="color:#9900CC;">study</span>.<span style="color:#9900CC;">results</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@user.<span style="color:#9900CC;">study</span>.<span style="color:#9900CC;">total_summary</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@matched_users = Iknow::User.<span style="color:#9900CC;">matching</span><span style="color:#006600; font-weight:bold;">&#40;</span>'matake'<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000; font-style:italic;">## List API</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@recent_lists = Iknow::List.<span style="color:#9900CC;">recent</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@list = Iknow::List.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;color:#800000;">31509</span>, :include_sentences =&gt; <span style="color:#0000FF; font-weight:bold;">true</span>, :include_items =&gt; <span style="color:#0000FF; font-weight:bold;">true</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@list.<span style="color:#9900CC;">items</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@list.<span style="color:#9900CC;">sentences</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@matched_lists = Iknow::List.<span style="color:#9900CC;">matching</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">"イタリア語であいさつ"</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000; font-style:italic;"># puts Iknow::List.find(31509, :include_sentences =&gt; true, :include_items =&gt; true).inspect</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000; font-style:italic;">## Item API</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@recent_items = Iknow::Item.<span style="color:#9900CC;">recent</span><span style="color:#006600; font-weight:bold;">&#40;</span>:include_sentences =&gt; <span style="color:#0000FF; font-weight:bold;">true</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@item = Iknow::Item.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;color:#800000;">437525</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@matched_items = Iknow::Item.<span style="color:#9900CC;">matching</span><span style="color:#006600; font-weight:bold;">&#40;</span>'record', :include_sentences =&gt; <span style="color:#0000FF; font-weight:bold;">true</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@items = Iknow::Item.<span style="color:#9900CC;">extract</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">"sometimes, often, electrical"</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@items.<span style="color:#9900CC;">first</span>.<span style="color:#9900CC;">sentences</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000; font-style:italic;">## Sentence API</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@recent_sentences = Iknow::Sentence.<span style="color:#9900CC;">recent</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@sentence = Iknow::Sentence.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;color:#800000;">312271</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@matched_sentences = Iknow::Sentence.<span style="color:#9900CC;">matching</span><span style="color:#006600; font-weight:bold;">&#40;</span>'record'<span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p> </p>
<p><span id="more-147"></span></p>
<p>ps.<br />
毎回 gem をいじってると細かいバグとか、微妙に使いづらい点とかに気がつくので、そういった点は API 自体の方にまた反映させていきます。「特定の Call でしか使えないオプションとかすごい分かりづらいので、なるべく全部の Call で使えるものはそうしたい」とか、そういうの。</p>
 ]]> </content:encoded>
						<guid>http://railspress.matake.jp/?p=147</guid>
			<pubDate>Sat, 29 Nov 2008 02:51:05 +0900</pubDate>
			<category>Array</category>
		</item>
				<item>
			<title>iKnow! の OpenID で XRI をサポート &amp; ruby-openid を日本語 XRI 対応に</title>
						<link>http://railspress.matake.jp/ruby-openid-patches-for-multibyte-xr</link>
						<description>昨日 OpenID Foundation Japan で NRI の崎村さんに「iKnow! の OpenID は XRI をサポートしてないですね」ってなことを言われたらしいので、iKnow! の OpenID を XRI に対応させました。
OpenID Authentication Plugin の XRI 対応は RailsのOpenID Authentication PluginをXRI対応にする方法 に書きましたが、OpenID::Yadis::XRI.identifier_scheme というメソッドが既にあったので、今回はそれを使いました。
PLAIN TEXT
LANG : RUBY




module OpenIdAuthentication


&amp;#160; # XRI support


&amp;#160; def self.normalize_url_with_xri&amp;#40;identifier&amp;#41;


&amp;#160; &amp;#160; case OpenID::Yadis::XRI.identifier_scheme&amp;#40;identifier&amp;#41;


&amp;#160; &amp;#160; when :xri : identifier


&amp;#160; &amp;#160; when :uri : normalize_url_without_xri&amp;#40;identifier&amp;#41;


&amp;#160; &amp;#160; end


&amp;#160; end


&amp;#160; class &amp;#60;&amp;#60;self


&amp;#160; &amp;#160; [...]</description>
							<content:encoded> <![CDATA[ <p>昨日 OpenID Foundation Japan で NRI の<a href="http://www.sakimura.org/">崎村さん</a>に「iKnow! の OpenID は XRI をサポートしてないですね」ってなことを言われたらしいので、iKnow! の OpenID を XRI に対応させました。</p>
<p>OpenID Authentication Plugin の XRI 対応は <a href="http://railspress.matake.jp/use-xri-identity-with-openid-authentication-plugin">RailsのOpenID Authentication PluginをXRI対応にする方法</a> に書きましたが、OpenID::Yadis::XRI.identifier_scheme というメソッドが既にあったので、今回はそれを使いました。</p>
<div class="igBar"><span id="lruby-16"><a href="#" onclick="javascript:showPlainTxt('ruby-16'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">LANG : RUBY</span>
<div id="ruby-16">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">module</span> OpenIdAuthentication</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#008000; font-style:italic;"># XRI support</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">normalize_url_with_xri</span><span style="color:#006600; font-weight:bold;">&#40;</span>identifier<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">case</span> OpenID::Yadis::XRI.<span style="color:#9900CC;">identifier_scheme</span><span style="color:#006600; font-weight:bold;">&#40;</span>identifier<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">when</span> :xri : identifier</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">when</span> :uri : normalize_url_without_xri<span style="color:#006600; font-weight:bold;">&#40;</span>identifier<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">class</span> &lt;&lt;self</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; alias_method :normalize_url_without_xri, :normalize_url</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; alias_method :normalize_url, :normalize_url_with_xri</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">end</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>で、久しぶりに <a href="http://www.freexri.com/" target="_blank">@freexri</a> に行ってみたら、「=名前*nov」とかとれるようになってました。いつのまにか XRI って日本語も使えるようになってるんですね。日本語 XRI は微妙だけど、一応対応しておきました。</p>
<p>ruby-openid が日本語 XRI に対応してなかったので、OpenID::Yadis::XRI.escape_for_iri_with_multibyte をちょっと変更する必要があります。</p>
<div class="igBar"><span id="lruby-17"><a href="#" onclick="javascript:showPlainTxt('ruby-17'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">LANG : RUBY</span>
<div id="ruby-17">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">module</span> OpenID::Yadis::XRI</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">escape_for_iri_with_multibyte</span><span style="color:#006600; font-weight:bold;">&#40;</span>xri<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; esc = escape_for_iri_without_multibyte<span style="color:#006600; font-weight:bold;">&#40;</span>xri<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; esc.<span style="color:#CC0066; font-weight:bold;">gsub</span>!<span style="color:#006600; font-weight:bold;">&#40;</span>/<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#91;</span>\xC0-\xDF<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span>\x80-\xBF<span style="color:#006600; font-weight:bold;">&#93;</span>|<span style="color:#006600; font-weight:bold;">&#91;</span>\xE0-\xEF<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span>\x80-\xBF<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006666;color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#125;</span>|<span style="color:#006600; font-weight:bold;">&#91;</span>\xF0-\xF7<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span>\x80-\xBF<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006666;color:#800000;">3</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span>/e<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> |char_match|</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; CGI::escape<span style="color:#006600; font-weight:bold;">&#40;</span>char_match<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF; font-weight:bold;">return</span> esc</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">class</span> &lt;&lt;self</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; alias_method :escape_for_iri_without_multibyte, :escape_for_iri</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; alias_method :escape_for_iri, :escape_for_iri_with_multibyte</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">end</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>これで OK なはずですが...</p>
<p><span id="more-139"></span></p>
<p>そもそも「=名前*nov」の Yadis が動いてないみたい...意味ねー（涙</p>
<p>...「@id*またけ」はちゃんと動いてるから、まぁ良しとしよう。</p>
<p>fuckin <a href="http://www.freexri.com/" target="_blank">@freexri</a> !!</p>
<p>ps.<br />
ruby-openid は XRI のエラー処理が不十分なので、以下のパッチも当てておくと良いかと思います。</p>
<div class="igBar"><span id="lruby-18"><a href="#" onclick="javascript:showPlainTxt('ruby-18'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">LANG : RUBY</span>
<div id="ruby-18">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">module</span> OpenID</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#008000; font-style:italic;"># XRI Error handling</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">discover_xri_with_error_handling</span><span style="color:#006600; font-weight:bold;">&#40;</span>xri<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; discover_xri_without_error_handling<span style="color:#006600; font-weight:bold;">&#40;</span>xri<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">rescue</span> OpenID::Yadis::XRI::XRIHTTPError =&gt; e</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">raise</span> DiscoveryFailure.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">"XRI is not valid: #{e.message}"</span>, <span style="color:#0000FF; font-weight:bold;">nil</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">class</span> &lt;&lt;self</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; alias_method :discover_xri_without_error_handling, :discover_xri</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; alias_method :discover_xri, :discover_xri_with_error_handling</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">end</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
 ]]> </content:encoded>
						<guid>http://railspress.matake.jp/?p=139</guid>
			<pubDate>Wed, 26 Nov 2008 13:48:25 +0900</pubDate>
			<category>Array</category>
		</item>
				<item>
			<title>iKnow! Developers Conference が終了しました</title>
						<link>http://railspress.matake.jp/iknow-developers-conference-%e3%81%8c%e7%b5%82%e4%ba%86%e3%81%97%e3%81%be%e3%81%97%e3%81%9f</link>
						<description>iKnow! API の今後の方向性や、ライトニングトーク、ユーザのみなさまからのご要望など、非常に有意義なイベントになって良かったです。
飲み会も盛り上がってよかった！
僕のライトニングトークの時のプレゼン資料はこちらです。
280 slides っていう Keynote 風のサービスを使って作りました。280 slides が日本語使えない（コピーペーストすれば使える）ので、基本英語で簡単な資料ですが、よかったらどうぞ。
a_rubygem_for_iknow_api
View SlideShare presentation or Upload your own. (tags: 280slides)

しかし、通訳するにはあと３ヶ月くらいは英語勉強せんといかんな。特に日本語 =&gt; 英語をリアルタイムで訳すのはきっつい。
</description>
							<content:encoded> <![CDATA[ <p>iKnow! API の今後の方向性や、ライトニングトーク、ユーザのみなさまからのご要望など、非常に有意義なイベントになって良かったです。</p>
<p>飲み会も盛り上がってよかった！</p>
<p>僕のライトニングトークの時のプレゼン資料はこちらです。</p>
<p><a href="http://280slides.com/" target="_blank">280 slides</a> っていう Keynote 風のサービスを使って作りました。280 slides が日本語使えない（コピーペーストすれば使える）ので、基本英語で簡単な資料ですが、よかったらどうぞ。</p>
<div style="width:425px;text-align:left" id="__ss_751406"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/matake/arubygemforiknowapi?type=powerpoint" title="a_rubygem_for_iknow_api">a_rubygem_for_iknow_api</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=arubygemforiknowapi1199&#038;rel=0&#038;stripped_title=arubygemforiknowapi" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=arubygemforiknowapi1199&#038;rel=0&#038;stripped_title=arubygemforiknowapi" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View SlideShare <a style="text-decoration:underline;" href="http://www.slideshare.net/matake/arubygemforiknowapi?type=powerpoint" title="View a_rubygem_for_iknow_api on SlideShare">presentation</a> or <a style="text-decoration:underline;" href="http://www.slideshare.net/upload?type=powerpoint">Upload</a> your own. (tags: <a style="text-decoration:underline;" href="http://slideshare.net/tag/280slides">280slides</a>)</div>
</div>
<p>しかし、通訳するにはあと３ヶ月くらいは英語勉強せんといかんな。特に日本語 => 英語をリアルタイムで訳すのはきっつい。</p>
 ]]> </content:encoded>
						<guid>http://railspress.matake.jp/?p=137</guid>
			<pubDate>Fri, 14 Nov 2008 10:25:27 +0900</pubDate>
			<category>Array</category>
		</item>
		
	</channel>
</rss>