å¾®å¦ã«ååã ãåºãã¦ãã¾ããããã©
ã¤ãã«ATND API リファレンスãæ£å¼ã«ãªãªã¼ã¹ãããã®ã§ããã¡ããæ£å¼ã«åç¥ãã¾ãã
githubã® sugamasao/atnd4r · GitHub ã«ããã¸ã§ã¯ããã¼ã¸ãããã¾ãã
Atnd4R ã¨ã¯ä½ã§ãã
ATND API ã Ruby ãã使ç¨ããããã®ã©ããã¼ã«ãªãã¾ãã
æ¤ç´¢çµæã¯ãã¾ãã㨠Ruby ãªãã¸ã§ã¯ãã«å¤æããã¾ãã
ã©ã®ããã«å ¥æã§ãã¾ãã
github ã« rubygems ã§ç½®ãã¦ããã®ã§ãä¸è¨ã®ããã«ã¤ã³ã¹ãã¼ã«ãã¾ãã
github ã® URL ãç»é²ãã¦ããªã人ã®ã¿ãä¸ã®ã³ãã³ããåããã¦å®è¡ãã¦ãã ããã
gem sources -a http://gems.github.com
sudo gem install sugamasao-atnd4r
ã¾ããããã¸ã§ã¯ããã¼ã¸ã® Downloads ãã¼ã¸ãã tgz çã®å½¢å¼ãåå¾å¯è½ã§ãã
ã©ã®ããã«ä½¿ãã¾ãã
ã¾ããrequire ãã¾ã
requre 'atnd4r'
ã¤ãã³ããµã¼ãAPIã使ãå ´å
Atnd4r::get_event_list ã¡ã½ãããå®è¡ãã¦ãã ãããå¼æ°ã¯ Hash ã§ã {æ¤ç´¢ãã¼ => æ¤ç´¢ãããå¤} ã¨æ¸¡ãã¾ãã
Atnd4r::get_event_list({:user_id => 1500})
æ¤ç´¢ãããå¤ãè¤æ°ããå ´åã¯ãé åã¨ãã¦æ¸¡ãã¾ãã
Atnd4r::get_event_list({:user_id => [1500, 1]})
æ¤ç´¢çµæã¯ä»¥ä¸ã®ãããªã Atnd4r::AtndAPI ãªãã¸ã§ã¯ãã¨ãã¦è¿å´ããã¾ãã
#<Atnd4r::AtndAPI:0x1561ac0 @events= [#<Atnd4r::AtndEvent:0x155a1d0 @accepted=48, @address="æ±äº¬é½ä¸å¤®åºé座ï¼âï¼âï¼ï¼", @catch= "ãã®ã¤ãã³ãã¯ATNDã®ãã¢ã§ããå®éã«éå¬ããããã¨ã¯ããã¾ããããèªç±ã«åå /ãã£ã³ã»ã«ããã¦ã¿ã¦ãã ããï¼ãµãã¿ã¤ãã«ï¼", @description= "<h1>ããï¼å 容ï¼ã®ä½¿ãæ¹</h1>\n<ul>\n<li>ããã«ã¤ãã³ãã®å 容ãæ¸ãã¾ã</li>\n<li>ç°¡åãªHTMLã使ããã¨ãã§ãã¾ã</li>\n</ul>\n\n<h1>ãç¥ãã</h1>\n<ul>\n<li><a href=\"http://atnd.org/users/profile\">http://atnd.org/users/profile</a>ãããATNDå ã®ã¦ã¼ã¶åãè¨å®ãããã¨ãã§ãã¾ãã®ã§ããã²å¤æ´ãã¦ã¿ã¦ãã ããã</li>\n</ul>", @ended_at=nil, @event_id=1, @event_url="http://atnd.org/events/1", @lat=35.6685393, @limit=48, @lon=139.7593983, @owner_id=1, @owner_nickname="knjko", @place="MTL", @started_at=Wed Sep 02 14:20:00 +0900 2009, @title="ATNDãã¢ã¤ãã³ãï¼ã¿ã¤ãã«ï¼", @updated_at=Wed Jan 14 15:06:00 +0900 2009, @url="http://atnd.org/", @users=[], @waiting=134>], @results_available=1, @results_returned=1, @results_start=1>
æ¤ç´¢ãã©ã¡ã¼ã¿ã®è©³ç´°ããæ¤ç´¢çµæã®å¤ã®æå³ãªã©ã¯å ¬å¼ãã¼ã¸ãã確èªä¸ããã
åºå¸ç¢ºèªAPIã使ãå ´å
ã¡ã½ããå以å¤ã¯ãã»ã¼åãã§ãã
Atnd4r::get_user_list ã¡ã½ãããå®è¡ãã¦ãã ãããå¼æ°ã¯ Hash ã§ã {æ¤ç´¢ãã¼ => æ¤ç´¢ãããå¤} ã¨æ¸¡ãã¾ãã
Atnd4r::get_user_list({:user_id => 1500})
æ¤ç´¢ãããå¤ãè¤æ°ããå ´åã¯ãé åã¨ãã¦æ¸¡ãã¾ãã
Atnd4r::get_user_list({:user_id => [1500, 1]})
æ¤ç´¢çµæã¯ä»¥ä¸ã®ãããªã Atnd4r::AtndAPI ãªãã¸ã§ã¯ãã¨ãã¦è¿å´ããã¾ãã
#<Atnd4r::AtndAPI:0x105499c @events= [#<Atnd4r::AtndEvent:0x104cf6c @accepted=92, @address=nil, @catch=nil, @description=nil, @ended_at=nil, @event_id=202, @event_url="http://atnd.org/events/202", @lat=nil, @limit=100, @lon=nil, @owner_id=nil, @owner_nickname=nil, @place=nil, @started_at=nil, @title="1981så¿å¹´ä¼#2", @updated_at=Fri Dec 12 17:41:14 +0900 2008, @url=nil, @users= [#<Atnd4r::AtndUser:0x15d531c @nickname="ããã¾ãã(id:seiunsky)", @status=1, @user_id=1500>, ï¼ä¸ç¥ï¼], @waiting=0>], @results_available=1, @results_returned=1, @results_start=1>
ã¤ãã³ããµã¼ãAPIã¨ã®ä¸çªã®éãã¯ãevents ããããã£ã«ãAtnd4r::AtndUser ãªãã¸ã§ã¯ãã®é åãå ¥ã£ã¦ãããã¨ã§ã*1ã
ããä¸å ·åã£ã½ãã®ãããã°
ãã®ã¨ã³ããªã¼ã®ã³ã¡ã³ãã¨ãã§ãè¯ãã®ã§ãææé ããã¨å©ããã¾ãï¼ï¼
ã¾ãã㯠atnd4r ã使ã£ã¦åãã¦ã¾ãï¼
ã¨ããããã§
ããã£ãã使ã£ã¦ãã ããï¼
追è¨ï¼2009/7/30ï¼
詳細ãªä½¿ãæ¹ã®ã¨ã³ããªãæ¸ãã¾ããã
Atnd4Rの使い方 - @sugamasao.blog.title # => ”コードで世界を変えたい”