Skip to content

Instantly share code, notes, and snippets.

@mataki
Created June 7, 2010 02:55
Show Gist options
  • Save mataki/428164 to your computer and use it in GitHub Desktop.
Save mataki/428164 to your computer and use it in GitHub Desktop.
require "rubygems"
require "oauth"
consumer_key = "consumer_key"
consumer_secret = "consumer_secret"
consumer = OAuth::Consumer.new(consumer_key,
consumer_secret,
:site => "https://www.youroom.in")
# Authentication by XAuth------------------------------
access_token = consumer.get_access_token(nil, {}, {
:x_auth_mode => "client_auth",
:x_auth_username => "[email protected]",
:x_auth_password => "user_password",
})
atoken = access_token.token # =>
asecret = access_token.secret # =>
# Access with saved token ------
# access_token = OAuth::AccessToken.new(consumer, "access_token", "access_secret")
resp = access_token.get('https://www.youroom.in/r/6/entries.xml') # => #<Net::HTTPOK 200 OK readbody=true>
puts resp.body
# >> <?xml version="1.0" encoding="UTF-8"?>
# >> <entries type="array">
# >> <entry>
# >> <content>Twitter&#12398;&#12452;&#12494;&#12505;&#12540;&#12471;&#12519;&#12531;&#12398;&#19968;&#12388;&#12395;&#12289;&#20214;&#21517;&#12434;&#28961;&#12367;&#12375;&#12383;&#12371;&#12392;&#12395;&#12424;&#12427;&#27671;&#36605;&#12373;&#12364;&#12354;&#12387;&#12383;&#12424;&#12358;&#12395;&#12289;youRoom&#12391;&#12399;&#12289;&#12383;&#12375;&#12363;&#12523;&#12540;&#12512;&#21517;&#12364;&#24517;&#38920;&#12384;&#12387;&#12383;&#12369;&#12393;&#12289;wave&#12415;&#12383;&#12356;&#12395;&#12523;&#12540;&#12512;&#21517;&#12394;&#12367;&#12390;&#12418;&#12523;&#12540;&#12512;&#12398;&#20316;&#25104;&#12364;&#20986;&#26469;&#12427;&#12424;&#12358;&#12395;&#12394;&#12387;&#12390;&#12418;&#33391;&#12356;&#12363;&#12418;&#12397;&#12290; @mat_aki #youroom</content>
# >> <created-at type="datetime">2010-06-06T13:30:08Z</created-at>
# >> <id type="integer">42440</id>
# >> <parent-id type="integer" nil="true"></parent-id>
# >> <root-id type="integer">42440</root-id>
# >> <updated-at type="datetime">2010-06-07T01:14:03Z</updated-at>
# >> <participation>
# >> <id type="integer">1267</id>
# >> <name>TwitterFetcher</name>
# >> </participation>
# >> </entry>
# >> ...
# >> </entries>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment