{"action":"created","comment":{"url":"https://api.github.com/repos/BlockScore/blockscore-ruby/pulls/comments/32093316","id":32093316,"diff_hunk":"@@ -0,0 +1,33 @@\n+module BlockScore\n+  class APIError < Error\n+    attr_reader :http_status\n+    attr_reader :error_type\n+    attr_reader :http_body\n+\n+    # Public: Creates a new instance of BlockScore::Error.\n+    #\n+    # rbody - The HTTP response body from HTTParty.\n+    # rcode - The HTTP response code from HTTParty.\n+    #\n+    # While BlockScore::Error can be instantiated, the more meaningful\n+    # error classes are its subclasses:\n+    # InvalidRequestError - Indicates a malformed request (HTTP 400 or 404)\n+    # APIError - Indicates an error on the server side (HTTP 5xx)\n+    # AuthenticationError - Indicates an authentication error (HTTP 401)\n+    def initialize(response)\n+      body = JSON.parse(response.body, :symbolize_names => true)\n+\n+      @message = body[:error][:message]\n+      @http_status = response.code\n+      @error_type = body[:error][:type]\n+      @http_body = body\n+    end\n+\n+    def to_s\n+      status_string = @http_status ? \"(Status: #{@http_status})\" : \"\"\n+      type_string = @error_type ? \"(Type: #{@error_type})\" : \"\"","path":"lib/blockscore/errors/api_error.rb","position":28,"original_position":28,"commit_id":"c5d5117a29f9d6bd256240019065440afe36a62f","original_commit_id":"c5d5117a29f9d6bd256240019065440afe36a62f","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.","created_at":"2015-06-10T07:18:11Z","updated_at":"2015-06-10T07:18:11Z","html_url":"https://github.com/BlockScore/blockscore-ruby/pull/20#discussion_r32093316","pull_request_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/pulls/20","_links":{"self":{"href":"https://api.github.com/repos/BlockScore/blockscore-ruby/pulls/comments/32093316"},"html":{"href":"https://github.com/BlockScore/blockscore-ruby/pull/20#discussion_r32093316"},"pull_request":{"href":"https://api.github.com/repos/BlockScore/blockscore-ruby/pulls/20"}}},"pull_request":{"url":"https://api.github.com/repos/BlockScore/blockscore-ruby/pulls/20","id":35702861,"html_url":"https://github.com/BlockScore/blockscore-ruby/pull/20","diff_url":"https://github.com/BlockScore/blockscore-ruby/pull/20.diff","patch_url":"https://github.com/BlockScore/blockscore-ruby/pull/20.patch","issue_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/issues/20","number":20,"state":"open","locked":false,"title":"4.1.0","user":{"login":"connorjacobsen","id":1803137,"avatar_url":"https://avatars.githubusercontent.com/u/1803137?v=3","gravatar_id":"","url":"https://api.github.com/users/connorjacobsen","html_url":"https://github.com/connorjacobsen","followers_url":"https://api.github.com/users/connorjacobsen/followers","following_url":"https://api.github.com/users/connorjacobsen/following{/other_user}","gists_url":"https://api.github.com/users/connorjacobsen/gists{/gist_id}","starred_url":"https://api.github.com/users/connorjacobsen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/connorjacobsen/subscriptions","organizations_url":"https://api.github.com/users/connorjacobsen/orgs","repos_url":"https://api.github.com/users/connorjacobsen/repos","events_url":"https://api.github.com/users/connorjacobsen/events{/privacy}","received_events_url":"https://api.github.com/users/connorjacobsen/received_events","type":"User","site_admin":false},"body":"Clean up library, remove duplication, make response objects behave like Ruby objects rather than JSON hashes.","created_at":"2015-05-19T07:31:53Z","updated_at":"2015-06-10T07:18:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5a6bd3f0b7fe548e1d05ed4e164a26c2aded3388","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/pulls/20/commits","review_comments_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/pulls/20/comments","review_comment_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/pulls/comments{/number}","comments_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/issues/20/comments","statuses_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/statuses/c5d5117a29f9d6bd256240019065440afe36a62f","head":{"label":"BlockScore:4.1.0","ref":"4.1.0","sha":"c5d5117a29f9d6bd256240019065440afe36a62f","user":{"login":"BlockScore","id":4524125,"avatar_url":"https://avatars.githubusercontent.com/u/4524125?v=3","gravatar_id":"","url":"https://api.github.com/users/BlockScore","html_url":"https://github.com/BlockScore","followers_url":"https://api.github.com/users/BlockScore/followers","following_url":"https://api.github.com/users/BlockScore/following{/other_user}","gists_url":"https://api.github.com/users/BlockScore/gists{/gist_id}","starred_url":"https://api.github.com/users/BlockScore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BlockScore/subscriptions","organizations_url":"https://api.github.com/users/BlockScore/orgs","repos_url":"https://api.github.com/users/BlockScore/repos","events_url":"https://api.github.com/users/BlockScore/events{/privacy}","received_events_url":"https://api.github.com/users/BlockScore/received_events","type":"Organization","site_admin":false},"repo":{"id":17101801,"name":"blockscore-ruby","full_name":"BlockScore/blockscore-ruby","owner":{"login":"BlockScore","id":4524125,"avatar_url":"https://avatars.githubusercontent.com/u/4524125?v=3","gravatar_id":"","url":"https://api.github.com/users/BlockScore","html_url":"https://github.com/BlockScore","followers_url":"https://api.github.com/users/BlockScore/followers","following_url":"https://api.github.com/users/BlockScore/following{/other_user}","gists_url":"https://api.github.com/users/BlockScore/gists{/gist_id}","starred_url":"https://api.github.com/users/BlockScore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BlockScore/subscriptions","organizations_url":"https://api.github.com/users/BlockScore/orgs","repos_url":"https://api.github.com/users/BlockScore/repos","events_url":"https://api.github.com/users/BlockScore/events{/privacy}","received_events_url":"https://api.github.com/users/BlockScore/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/BlockScore/blockscore-ruby","description":"An API wrapper for the BlockScore API using Ruby.","fork":false,"url":"https://api.github.com/repos/BlockScore/blockscore-ruby","forks_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/forks","keys_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/teams","hooks_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/hooks","issue_events_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/issues/events{/number}","events_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/events","assignees_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/assignees{/user}","branches_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/branches{/branch}","tags_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/tags","blobs_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/git/refs{/sha}","trees_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/statuses/{sha}","languages_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/languages","stargazers_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/stargazers","contributors_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/contributors","subscribers_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/subscribers","subscription_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/subscription","commits_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/commits{/sha}","git_commits_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/git/commits{/sha}","comments_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/comments{/number}","issue_comment_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/issues/comments{/number}","contents_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/contents/{+path}","compare_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/merges","archive_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/downloads","issues_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/issues{/number}","pulls_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/pulls{/number}","milestones_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/milestones{/number}","notifications_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/labels{/name}","releases_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/releases{/id}","created_at":"2014-02-23T04:46:11Z","updated_at":"2015-04-13T23:22:34Z","pushed_at":"2015-06-10T07:17:55Z","git_url":"git://github.com/BlockScore/blockscore-ruby.git","ssh_url":"git@github.com:BlockScore/blockscore-ruby.git","clone_url":"https://github.com/BlockScore/blockscore-ruby.git","svn_url":"https://github.com/BlockScore/blockscore-ruby","homepage":"http://docs.blockscore.com/ruby/","size":980,"stargazers_count":3,"watchers_count":3,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":1,"forks":4,"open_issues":1,"watchers":3,"default_branch":"master"}},"base":{"label":"BlockScore:master","ref":"master","sha":"90f3b95e9e7b43ef7de83af3ec1a1793537b3200","user":{"login":"BlockScore","id":4524125,"avatar_url":"https://avatars.githubusercontent.com/u/4524125?v=3","gravatar_id":"","url":"https://api.github.com/users/BlockScore","html_url":"https://github.com/BlockScore","followers_url":"https://api.github.com/users/BlockScore/followers","following_url":"https://api.github.com/users/BlockScore/following{/other_user}","gists_url":"https://api.github.com/users/BlockScore/gists{/gist_id}","starred_url":"https://api.github.com/users/BlockScore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BlockScore/subscriptions","organizations_url":"https://api.github.com/users/BlockScore/orgs","repos_url":"https://api.github.com/users/BlockScore/repos","events_url":"https://api.github.com/users/BlockScore/events{/privacy}","received_events_url":"https://api.github.com/users/BlockScore/received_events","type":"Organization","site_admin":false},"repo":{"id":17101801,"name":"blockscore-ruby","full_name":"BlockScore/blockscore-ruby","owner":{"login":"BlockScore","id":4524125,"avatar_url":"https://avatars.githubusercontent.com/u/4524125?v=3","gravatar_id":"","url":"https://api.github.com/users/BlockScore","html_url":"https://github.com/BlockScore","followers_url":"https://api.github.com/users/BlockScore/followers","following_url":"https://api.github.com/users/BlockScore/following{/other_user}","gists_url":"https://api.github.com/users/BlockScore/gists{/gist_id}","starred_url":"https://api.github.com/users/BlockScore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BlockScore/subscriptions","organizations_url":"https://api.github.com/users/BlockScore/orgs","repos_url":"https://api.github.com/users/BlockScore/repos","events_url":"https://api.github.com/users/BlockScore/events{/privacy}","received_events_url":"https://api.github.com/users/BlockScore/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/BlockScore/blockscore-ruby","description":"An API wrapper for the BlockScore API using Ruby.","fork":false,"url":"https://api.github.com/repos/BlockScore/blockscore-ruby","forks_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/forks","keys_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/teams","hooks_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/hooks","issue_events_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/issues/events{/number}","events_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/events","assignees_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/assignees{/user}","branches_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/branches{/branch}","tags_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/tags","blobs_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/git/refs{/sha}","trees_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/statuses/{sha}","languages_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/languages","stargazers_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/stargazers","contributors_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/contributors","subscribers_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/subscribers","subscription_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/subscription","commits_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/commits{/sha}","git_commits_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/git/commits{/sha}","comments_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/comments{/number}","issue_comment_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/issues/comments{/number}","contents_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/contents/{+path}","compare_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/merges","archive_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/downloads","issues_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/issues{/number}","pulls_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/pulls{/number}","milestones_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/milestones{/number}","notifications_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/labels{/name}","releases_url":"https://api.github.com/repos/BlockScore/blockscore-ruby/releases{/id}","created_at":"2014-02-23T04:46:11Z","updated_at":"2015-04-13T23:22:34Z","pushed_at":"2015-06-10T07:17:55Z","git_url":"git://github.com/BlockScore/blockscore-ruby.git","ssh_url":"git@github.com:BlockScore/blockscore-ruby.git","clone_url":"https://github.com/BlockScore/blockscore-ruby.git","svn_url":"https://github.com/BlockScore/blockscore-ruby","homepage":"http://docs.blockscore.com/ruby/","size":980,"stargazers_count":3,"watchers_count":3,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":1,"forks":4,"open_issues":1,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/BlockScore/blockscore-ruby/pulls/20"},"html":{"href":"https://github.com/BlockScore/blockscore-ruby/pull/20"},"issue":{"href":"https://api.github.com/repos/BlockScore/blockscore-ruby/issues/20"},"comments":{"href":"https://api.github.com/repos/BlockScore/blockscore-ruby/issues/20/comments"},"review_comments":{"href":"https://api.github.com/repos/BlockScore/blockscore-ruby/pulls/20/comments"},"review_comment":{"href":"https://api.github.com/repos/BlockScore/blockscore-ruby/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/BlockScore/blockscore-ruby/pulls/20/commits"},"statuses":{"href":"https://api.github.com/repos/BlockScore/blockscore-ruby/statuses/c5d5117a29f9d6bd256240019065440afe36a62f"}}}}