GitHub PullRequestReviewCommentEvent at 2014-01-04 19:26:57
Repository: twitter
Actor: sferik
Payload: {"comment":{"url":"https://api.github.com/repos/sferik/twitter/pulls/comments/8652751","id":8652751,"diff_hunk":"@@ -0,0 +1,29 @@\n+# Hello, World!\n+\n+Here is a simple demonstration of how to get tweets using this gem:\n+\n+```ruby\n+require 'twitter'\n+\n+SEARCH_STR = \"#helloworld\"\n+COUNT = 10\n+\n+client = Twitter::REST::Client.new do |config\n+  # you must set up an application using Twitter's developer site, and set these values:\n+  # (See the Configuration example)\n+  config.consumer_key = \"YOUR_CONSUMER_KEY\"\n+  config.consumer_secret = \"YOUR_CONSUMER_SECRET\"\n+  config.access_token = \"YOUR_ACCESS_TOKEN\"\n+  config.access_token_secret = \"YOUR_ACCESS_SECRET\"\n+end\n+\n+opts = { :count => COUNT, :result_type => 'recent' }\n+\n+client.search(SEARCH_STR, opts).each do |tweet| \n+  text = tweet.attrs[:text]\n+  name = tweet.attrs[:user][:name]\n+  screen_name = tweet.attrs[:user][:screen_name]\n+  created_at = tweet.attrs[:created_at]","path":"examples/HelloWorld.md","position":26,"original_position":26,"commit_id":"ca8d21ddb1ab6c2a5cb7e37d5ed19c38bfcf79ef","original_commit_id":"ca8d21ddb1ab6c2a5cb7e37d5ed19c38bfcf79ef","user":{"login":"sferik","id":10308,"avatar_url":"https://gravatar.com/avatar/1f74b13f1e5c6c69cb5d7fbaabb1e2cb?d=https%3A%2F%2Fidenticons.github.com%2F9efb1a59d7b58e69996cf0e32cb71098.png&r=x","gravatar_id":"1f74b13f1e5c6c69cb5d7fbaabb1e2cb","url":"https://api.github.com/users/sferik","html_url":"https://github.com/sferik","followers_url":"https://api.github.com/users/sferik/followers","following_url":"https://api.github.com/users/sferik/following{/other_user}","gists_url":"https://api.github.com/users/sferik/gists{/gist_id}","starred_url":"https://api.github.com/users/sferik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sferik/subscriptions","organizations_url":"https://api.github.com/users/sferik/orgs","repos_url":"https://api.github.com/users/sferik/repos","events_url":"https://api.github.com/users/sferik/events{/privacy}","received_events_url":"https://api.github.com/users/sferik/received_events","type":"User","site_admin":false},"body":"This code can be rewritten as:\r\n\r\n```ruby\r\nclient.search(\"#helloworld\", :count => 10).each do |tweet|\r\n  text = tweet.text\r\n  name = tweet.user.name\r\n  screen_name = tweet.user.screen_name\r\n  created_at = tweet.created_at\r\n  puts \"#{name} (@#{screen_name}): #{text} [Created #{created_at}]\"\r\nend\r\n```\r\n\r\nOr more simply:\r\n\r\n```ruby\r\nclient.search(\"#helloworld\", :count => 10).each do |tweet|\r\n  puts \"#{tweet.user.name} (@#{tweet.user.screen_name}): #{tweet.text} [Created #{tweet.created_at}]\"\r\nend\r\n```\r\n\r\nObviously, I have failed miserably at documenting this library if you think the only way to access an objects attributes is through the `#attrs` method. Do you remember what led you to believe this was true? How can I better document an object’s methods?","created_at":"2014-01-04T19:26:57Z","updated_at":"2014-01-04T19:26:57Z","html_url":"https://github.com/sferik/twitter/pull/505#discussion_r8652751","pull_request_url":"https://api.github.com/repos/sferik/twitter/pulls/505","_links":{"self":{"href":"https://api.github.com/repos/sferik/twitter/pulls/comments/8652751"},"html":{"href":"https://github.com/sferik/twitter/pull/505#discussion_r8652751"},"pull_request":{"href":"https://api.github.com/repos/sferik/twitter/pulls/505"}}}}