{"action":"created","comment":{"url":"https://api.github.com/repos/keviny22/quickbase/pulls/comments/27618278","id":27618278,"diff_hunk":"@@ -2,7 +2,67 @@ module Quickbase\n   class HTTP\n     include HTTParty\n     attr_accessor :qb_params\n-  \n+    module Quickbase\n+      class HTTP\n+        include HTTParty\n+        attr_accessor :qb_params\n+\n+        def initialize(config)\n+          self.class.base_uri \"https://#{config[:org]}.quickbase.com\"\n+          instance_variable_set \"@qb_params\", {:dbid => \"main\"}\n+          http_proxy = config[:http_proxy] || ENV['http_proxy']\n+          setup_proxy(http_proxy) if http_proxy\n+\n+          response = post(\"API_Authenticate\", Quickbase::Helper.hash_to_xml(config))\n+          qb_params[:ticket] = response.xpath(\"//ticket\").first.content\n+          qb_params[:apptoken] = config[:apptoken]\n+          qb_params[:dbid] = config[:dbid]\n+\n+\n+        end\n+\n+        def post(quickbase_action, params = [])\n+          params = params.concat(Quickbase::Helper.hash_to_xml(qb_params))\n+          clean_xml_string = Quickbase::Helper.generate_xml(params).to_s\n+          self.class.headers({\"Content-Length\" => clean_xml_string.length.to_s})\n+          self.class.headers({\"Content-Type\" => \"application/xml\"})\n+          self.class.headers({\"QUICKBASE-ACTION\" => quickbase_action})\n+          response = Nokogiri::XML([self.class.post(\"/db/#{qb_params[:dbid]}\", :body => clean_xml_string)].to_xml)\n+          error_handler(response)\n+          response\n+        end\n+\n+        private\n+        def no_proxy?\n+          host = URI.parse(self.class.base_uri).host\n+          ENV.fetch('no_proxy','').split(',').any? do |pattern|\n+            # convert patterns like `*.example.com` into `.*\\.example\\.com`\n+            host =~ Regexp.new(pattern.gsub(/\\./,'\\\\.').gsub(/\\*/,'.*'))\n+          end\n+        end\n+\n+        def setup_proxy(proxy_url)\n+          return if no_proxy?\n+\n+          proxy_url = URI.parse(proxy_url)\n+\n+          self.class.http_proxy(proxy_url.host, proxy_url.port,\n+                                proxy_url.user, proxy_url.password)\n+        end\n+\n+        def error_handler(response)\n+          case response.xpath(\"//errcode\").first.content.to_i\n+            when 0\n+              return true\n+            else\n+              errcode = response.xpath('//errcode').first.content\n+              errtext = response.xpath('//errtext').first.content\n+              raise \"#{errcode}: #{errtext}\"\n+              return false\n+          end\n+        end\n+      end\n+    end\n     def initialize(config)","path":"lib/classes/http.rb","position":66,"original_position":66,"commit_id":"b888321038b7a9055c2457b88172b7a64f06c112","original_commit_id":"b888321038b7a9055c2457b88172b7a64f06c112","user":{"login":"brettweavnet-intuit","id":6727884,"avatar_url":"https://avatars.githubusercontent.com/u/6727884?v=3","gravatar_id":"","url":"https://api.github.com/users/brettweavnet-intuit","html_url":"https://github.com/brettweavnet-intuit","followers_url":"https://api.github.com/users/brettweavnet-intuit/followers","following_url":"https://api.github.com/users/brettweavnet-intuit/following{/other_user}","gists_url":"https://api.github.com/users/brettweavnet-intuit/gists{/gist_id}","starred_url":"https://api.github.com/users/brettweavnet-intuit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brettweavnet-intuit/subscriptions","organizations_url":"https://api.github.com/users/brettweavnet-intuit/orgs","repos_url":"https://api.github.com/users/brettweavnet-intuit/repos","events_url":"https://api.github.com/users/brettweavnet-intuit/events{/privacy}","received_events_url":"https://api.github.com/users/brettweavnet-intuit/received_events","type":"User","site_admin":false},"body":"duplicate method?","created_at":"2015-04-01T22:26:58Z","updated_at":"2015-04-01T22:26:58Z","html_url":"https://github.com/keviny22/quickbase/pull/1#discussion_r27618278","pull_request_url":"https://api.github.com/repos/keviny22/quickbase/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/keviny22/quickbase/pulls/comments/27618278"},"html":{"href":"https://github.com/keviny22/quickbase/pull/1#discussion_r27618278"},"pull_request":{"href":"https://api.github.com/repos/keviny22/quickbase/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/keviny22/quickbase/pulls/1","id":32461727,"html_url":"https://github.com/keviny22/quickbase/pull/1","diff_url":"https://github.com/keviny22/quickbase/pull/1.diff","patch_url":"https://github.com/keviny22/quickbase/pull/1.patch","issue_url":"https://api.github.com/repos/keviny22/quickbase/issues/1","number":1,"state":"open","locked":false,"title":"Proxy support","user":{"login":"keviny22","id":3271530,"avatar_url":"https://avatars.githubusercontent.com/u/3271530?v=3","gravatar_id":"","url":"https://api.github.com/users/keviny22","html_url":"https://github.com/keviny22","followers_url":"https://api.github.com/users/keviny22/followers","following_url":"https://api.github.com/users/keviny22/following{/other_user}","gists_url":"https://api.github.com/users/keviny22/gists{/gist_id}","starred_url":"https://api.github.com/users/keviny22/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keviny22/subscriptions","organizations_url":"https://api.github.com/users/keviny22/orgs","repos_url":"https://api.github.com/users/keviny22/repos","events_url":"https://api.github.com/users/keviny22/events{/privacy}","received_events_url":"https://api.github.com/users/keviny22/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-04-01T21:16:45Z","updated_at":"2015-04-01T22:26:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"758ed11acf12f9240c3e3d9288b230b50b8bcaef","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/keviny22/quickbase/pulls/1/commits","review_comments_url":"https://api.github.com/repos/keviny22/quickbase/pulls/1/comments","review_comment_url":"https://api.github.com/repos/keviny22/quickbase/pulls/comments{/number}","comments_url":"https://api.github.com/repos/keviny22/quickbase/issues/1/comments","statuses_url":"https://api.github.com/repos/keviny22/quickbase/statuses/b888321038b7a9055c2457b88172b7a64f06c112","head":{"label":"keviny22:proxy_support","ref":"proxy_support","sha":"b888321038b7a9055c2457b88172b7a64f06c112","user":{"login":"keviny22","id":3271530,"avatar_url":"https://avatars.githubusercontent.com/u/3271530?v=3","gravatar_id":"","url":"https://api.github.com/users/keviny22","html_url":"https://github.com/keviny22","followers_url":"https://api.github.com/users/keviny22/followers","following_url":"https://api.github.com/users/keviny22/following{/other_user}","gists_url":"https://api.github.com/users/keviny22/gists{/gist_id}","starred_url":"https://api.github.com/users/keviny22/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keviny22/subscriptions","organizations_url":"https://api.github.com/users/keviny22/orgs","repos_url":"https://api.github.com/users/keviny22/repos","events_url":"https://api.github.com/users/keviny22/events{/privacy}","received_events_url":"https://api.github.com/users/keviny22/received_events","type":"User","site_admin":false},"repo":{"id":33272413,"name":"quickbase","full_name":"keviny22/quickbase","owner":{"login":"keviny22","id":3271530,"avatar_url":"https://avatars.githubusercontent.com/u/3271530?v=3","gravatar_id":"","url":"https://api.github.com/users/keviny22","html_url":"https://github.com/keviny22","followers_url":"https://api.github.com/users/keviny22/followers","following_url":"https://api.github.com/users/keviny22/following{/other_user}","gists_url":"https://api.github.com/users/keviny22/gists{/gist_id}","starred_url":"https://api.github.com/users/keviny22/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keviny22/subscriptions","organizations_url":"https://api.github.com/users/keviny22/orgs","repos_url":"https://api.github.com/users/keviny22/repos","events_url":"https://api.github.com/users/keviny22/events{/privacy}","received_events_url":"https://api.github.com/users/keviny22/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/keviny22/quickbase","description":"Quickbase gem","fork":true,"url":"https://api.github.com/repos/keviny22/quickbase","forks_url":"https://api.github.com/repos/keviny22/quickbase/forks","keys_url":"https://api.github.com/repos/keviny22/quickbase/keys{/key_id}","collaborators_url":"https://api.github.com/repos/keviny22/quickbase/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/keviny22/quickbase/teams","hooks_url":"https://api.github.com/repos/keviny22/quickbase/hooks","issue_events_url":"https://api.github.com/repos/keviny22/quickbase/issues/events{/number}","events_url":"https://api.github.com/repos/keviny22/quickbase/events","assignees_url":"https://api.github.com/repos/keviny22/quickbase/assignees{/user}","branches_url":"https://api.github.com/repos/keviny22/quickbase/branches{/branch}","tags_url":"https://api.github.com/repos/keviny22/quickbase/tags","blobs_url":"https://api.github.com/repos/keviny22/quickbase/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/keviny22/quickbase/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/keviny22/quickbase/git/refs{/sha}","trees_url":"https://api.github.com/repos/keviny22/quickbase/git/trees{/sha}","statuses_url":"https://api.github.com/repos/keviny22/quickbase/statuses/{sha}","languages_url":"https://api.github.com/repos/keviny22/quickbase/languages","stargazers_url":"https://api.github.com/repos/keviny22/quickbase/stargazers","contributors_url":"https://api.github.com/repos/keviny22/quickbase/contributors","subscribers_url":"https://api.github.com/repos/keviny22/quickbase/subscribers","subscription_url":"https://api.github.com/repos/keviny22/quickbase/subscription","commits_url":"https://api.github.com/repos/keviny22/quickbase/commits{/sha}","git_commits_url":"https://api.github.com/repos/keviny22/quickbase/git/commits{/sha}","comments_url":"https://api.github.com/repos/keviny22/quickbase/comments{/number}","issue_comment_url":"https://api.github.com/repos/keviny22/quickbase/issues/comments{/number}","contents_url":"https://api.github.com/repos/keviny22/quickbase/contents/{+path}","compare_url":"https://api.github.com/repos/keviny22/quickbase/compare/{base}...{head}","merges_url":"https://api.github.com/repos/keviny22/quickbase/merges","archive_url":"https://api.github.com/repos/keviny22/quickbase/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/keviny22/quickbase/downloads","issues_url":"https://api.github.com/repos/keviny22/quickbase/issues{/number}","pulls_url":"https://api.github.com/repos/keviny22/quickbase/pulls{/number}","milestones_url":"https://api.github.com/repos/keviny22/quickbase/milestones{/number}","notifications_url":"https://api.github.com/repos/keviny22/quickbase/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/keviny22/quickbase/labels{/name}","releases_url":"https://api.github.com/repos/keviny22/quickbase/releases{/id}","created_at":"2015-04-01T20:53:10Z","updated_at":"2015-04-01T20:53:10Z","pushed_at":"2015-04-01T21:16:45Z","git_url":"git://github.com/keviny22/quickbase.git","ssh_url":"git@github.com:keviny22/quickbase.git","clone_url":"https://github.com/keviny22/quickbase.git","svn_url":"https://github.com/keviny22/quickbase","homepage":"http://quickbase.com","size":86,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"keviny22:master","ref":"master","sha":"c3ece64314158bdf17609fa4be04cd890846fde5","user":{"login":"keviny22","id":3271530,"avatar_url":"https://avatars.githubusercontent.com/u/3271530?v=3","gravatar_id":"","url":"https://api.github.com/users/keviny22","html_url":"https://github.com/keviny22","followers_url":"https://api.github.com/users/keviny22/followers","following_url":"https://api.github.com/users/keviny22/following{/other_user}","gists_url":"https://api.github.com/users/keviny22/gists{/gist_id}","starred_url":"https://api.github.com/users/keviny22/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keviny22/subscriptions","organizations_url":"https://api.github.com/users/keviny22/orgs","repos_url":"https://api.github.com/users/keviny22/repos","events_url":"https://api.github.com/users/keviny22/events{/privacy}","received_events_url":"https://api.github.com/users/keviny22/received_events","type":"User","site_admin":false},"repo":{"id":33272413,"name":"quickbase","full_name":"keviny22/quickbase","owner":{"login":"keviny22","id":3271530,"avatar_url":"https://avatars.githubusercontent.com/u/3271530?v=3","gravatar_id":"","url":"https://api.github.com/users/keviny22","html_url":"https://github.com/keviny22","followers_url":"https://api.github.com/users/keviny22/followers","following_url":"https://api.github.com/users/keviny22/following{/other_user}","gists_url":"https://api.github.com/users/keviny22/gists{/gist_id}","starred_url":"https://api.github.com/users/keviny22/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keviny22/subscriptions","organizations_url":"https://api.github.com/users/keviny22/orgs","repos_url":"https://api.github.com/users/keviny22/repos","events_url":"https://api.github.com/users/keviny22/events{/privacy}","received_events_url":"https://api.github.com/users/keviny22/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/keviny22/quickbase","description":"Quickbase gem","fork":true,"url":"https://api.github.com/repos/keviny22/quickbase","forks_url":"https://api.github.com/repos/keviny22/quickbase/forks","keys_url":"https://api.github.com/repos/keviny22/quickbase/keys{/key_id}","collaborators_url":"https://api.github.com/repos/keviny22/quickbase/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/keviny22/quickbase/teams","hooks_url":"https://api.github.com/repos/keviny22/quickbase/hooks","issue_events_url":"https://api.github.com/repos/keviny22/quickbase/issues/events{/number}","events_url":"https://api.github.com/repos/keviny22/quickbase/events","assignees_url":"https://api.github.com/repos/keviny22/quickbase/assignees{/user}","branches_url":"https://api.github.com/repos/keviny22/quickbase/branches{/branch}","tags_url":"https://api.github.com/repos/keviny22/quickbase/tags","blobs_url":"https://api.github.com/repos/keviny22/quickbase/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/keviny22/quickbase/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/keviny22/quickbase/git/refs{/sha}","trees_url":"https://api.github.com/repos/keviny22/quickbase/git/trees{/sha}","statuses_url":"https://api.github.com/repos/keviny22/quickbase/statuses/{sha}","languages_url":"https://api.github.com/repos/keviny22/quickbase/languages","stargazers_url":"https://api.github.com/repos/keviny22/quickbase/stargazers","contributors_url":"https://api.github.com/repos/keviny22/quickbase/contributors","subscribers_url":"https://api.github.com/repos/keviny22/quickbase/subscribers","subscription_url":"https://api.github.com/repos/keviny22/quickbase/subscription","commits_url":"https://api.github.com/repos/keviny22/quickbase/commits{/sha}","git_commits_url":"https://api.github.com/repos/keviny22/quickbase/git/commits{/sha}","comments_url":"https://api.github.com/repos/keviny22/quickbase/comments{/number}","issue_comment_url":"https://api.github.com/repos/keviny22/quickbase/issues/comments{/number}","contents_url":"https://api.github.com/repos/keviny22/quickbase/contents/{+path}","compare_url":"https://api.github.com/repos/keviny22/quickbase/compare/{base}...{head}","merges_url":"https://api.github.com/repos/keviny22/quickbase/merges","archive_url":"https://api.github.com/repos/keviny22/quickbase/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/keviny22/quickbase/downloads","issues_url":"https://api.github.com/repos/keviny22/quickbase/issues{/number}","pulls_url":"https://api.github.com/repos/keviny22/quickbase/pulls{/number}","milestones_url":"https://api.github.com/repos/keviny22/quickbase/milestones{/number}","notifications_url":"https://api.github.com/repos/keviny22/quickbase/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/keviny22/quickbase/labels{/name}","releases_url":"https://api.github.com/repos/keviny22/quickbase/releases{/id}","created_at":"2015-04-01T20:53:10Z","updated_at":"2015-04-01T20:53:10Z","pushed_at":"2015-04-01T21:16:45Z","git_url":"git://github.com/keviny22/quickbase.git","ssh_url":"git@github.com:keviny22/quickbase.git","clone_url":"https://github.com/keviny22/quickbase.git","svn_url":"https://github.com/keviny22/quickbase","homepage":"http://quickbase.com","size":86,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/keviny22/quickbase/pulls/1"},"html":{"href":"https://github.com/keviny22/quickbase/pull/1"},"issue":{"href":"https://api.github.com/repos/keviny22/quickbase/issues/1"},"comments":{"href":"https://api.github.com/repos/keviny22/quickbase/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/keviny22/quickbase/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/keviny22/quickbase/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/keviny22/quickbase/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/keviny22/quickbase/statuses/b888321038b7a9055c2457b88172b7a64f06c112"}}}}