{"action":"created","comment":{"url":"https://api.github.com/repos/estately/rets/pulls/comments/32246031","id":32246031,"diff_hunk":"@@ -10,6 +10,35 @@ def initialize(http, options, logger, login_url)\n       @options.fetch(:ca_certs, []).each {|c| @http.ssl_config.add_trust_ca(c) }\n     end\n \n+    def self.from_options(options, logger)\n+      if options[:http_proxy]\n+        http = HTTPClient.new(options.fetch(:http_proxy))\n+\n+        if options[:proxy_username]\n+          http.set_proxy_auth(options.fetch(:proxy_username), options.fetch(:proxy_password))\n+        end\n+      else\n+        http = HTTPClient.new\n+      end\n+\n+      if options[:receive_timeout]\n+        http.receive_timeout = options[:receive_timeout]\n+      end\n+      if options[:cookie_store]\n+        http.set_cookie_store(options[:cookie_store])\n+      end\n+\n+      http_client = new(http, options, logger, options[:login_url])\n+\n+      if options[:http_timing_stats_collector]\n+        http_client = Rets::MeasuringHttpClient.new(http_client, options.fetch(:http_timing_stats_collector), options.fetch(:http_timing_stats_prefix))\n+      end\n+      if options[:lock_around_http_requests]\n+        http_client = Rets::LockingHttpClient.new(http_client, options.fetch(:locker), options.fetch(:lock_name), options.fetch(:lock_options))\n+      end","path":"lib/rets/http_client.rb","position":29,"original_position":29,"commit_id":"e74f75b6cd1438e3c527cea9ea7efc22fa7b7917","original_commit_id":"e74f75b6cd1438e3c527cea9ea7efc22fa7b7917","user":{"login":"phiggins","id":22962,"avatar_url":"https://avatars.githubusercontent.com/u/22962?v=3","gravatar_id":"","url":"https://api.github.com/users/phiggins","html_url":"https://github.com/phiggins","followers_url":"https://api.github.com/users/phiggins/followers","following_url":"https://api.github.com/users/phiggins/following{/other_user}","gists_url":"https://api.github.com/users/phiggins/gists{/gist_id}","starred_url":"https://api.github.com/users/phiggins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phiggins/subscriptions","organizations_url":"https://api.github.com/users/phiggins/orgs","repos_url":"https://api.github.com/users/phiggins/repos","events_url":"https://api.github.com/users/phiggins/events{/privacy}","received_events_url":"https://api.github.com/users/phiggins/received_events","type":"User","site_admin":false},"body":"It seems a bit weird that you get either `Rets::MeasuringHttpClient` or `Rets::LockingHttpClient`. Could they compose (ie, one wrapping the other)? Is there no use case where you might want both?","created_at":"2015-06-11T17:30:09Z","updated_at":"2015-06-11T17:30:09Z","html_url":"https://github.com/estately/rets/pull/126#discussion_r32246031","pull_request_url":"https://api.github.com/repos/estately/rets/pulls/126","_links":{"self":{"href":"https://api.github.com/repos/estately/rets/pulls/comments/32246031"},"html":{"href":"https://github.com/estately/rets/pull/126#discussion_r32246031"},"pull_request":{"href":"https://api.github.com/repos/estately/rets/pulls/126"}}},"pull_request":{"url":"https://api.github.com/repos/estately/rets/pulls/126","id":37487198,"html_url":"https://github.com/estately/rets/pull/126","diff_url":"https://github.com/estately/rets/pull/126.diff","patch_url":"https://github.com/estately/rets/pull/126.patch","issue_url":"https://api.github.com/repos/estately/rets/issues/126","number":126,"state":"open","locked":false,"title":"Clean up client constructor and how we use attr_reader/writer","user":{"login":"hfaulds","id":645812,"avatar_url":"https://avatars.githubusercontent.com/u/645812?v=3","gravatar_id":"","url":"https://api.github.com/users/hfaulds","html_url":"https://github.com/hfaulds","followers_url":"https://api.github.com/users/hfaulds/followers","following_url":"https://api.github.com/users/hfaulds/following{/other_user}","gists_url":"https://api.github.com/users/hfaulds/gists{/gist_id}","starred_url":"https://api.github.com/users/hfaulds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hfaulds/subscriptions","organizations_url":"https://api.github.com/users/hfaulds/orgs","repos_url":"https://api.github.com/users/hfaulds/repos","events_url":"https://api.github.com/users/hfaulds/events{/privacy}","received_events_url":"https://api.github.com/users/hfaulds/received_events","type":"User","site_admin":false},"body":"It's been bugging me that we have such a confusing constructor.\n\nSome of it got moved to `Rets::HttpClient`\n\nI tried to clean up where we refer to instance variables with attr_readers within the class (sometimes we would refer to them as `self.foo`,`@foo` or `foo`).\n\nI removed the attr_writer and allowed those arguments to be passed into the constructor.\n\nThe only instance var I left that confuses me is `@tries` which appears to be some now-defunct code which I would be in favour of deleting.","created_at":"2015-06-11T17:18:49Z","updated_at":"2015-06-11T17:30:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bd8a0e64cfbe5b2986b7fcbed1554b40d00afa19","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/estately/rets/pulls/126/commits","review_comments_url":"https://api.github.com/repos/estately/rets/pulls/126/comments","review_comment_url":"https://api.github.com/repos/estately/rets/pulls/comments{/number}","comments_url":"https://api.github.com/repos/estately/rets/issues/126/comments","statuses_url":"https://api.github.com/repos/estately/rets/statuses/e74f75b6cd1438e3c527cea9ea7efc22fa7b7917","head":{"label":"estately:clean-up-client-constructor","ref":"clean-up-client-constructor","sha":"e74f75b6cd1438e3c527cea9ea7efc22fa7b7917","user":{"login":"estately","id":368721,"avatar_url":"https://avatars.githubusercontent.com/u/368721?v=3","gravatar_id":"","url":"https://api.github.com/users/estately","html_url":"https://github.com/estately","followers_url":"https://api.github.com/users/estately/followers","following_url":"https://api.github.com/users/estately/following{/other_user}","gists_url":"https://api.github.com/users/estately/gists{/gist_id}","starred_url":"https://api.github.com/users/estately/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/estately/subscriptions","organizations_url":"https://api.github.com/users/estately/orgs","repos_url":"https://api.github.com/users/estately/repos","events_url":"https://api.github.com/users/estately/events{/privacy}","received_events_url":"https://api.github.com/users/estately/received_events","type":"Organization","site_admin":false},"repo":{"id":1522301,"name":"rets","full_name":"estately/rets","owner":{"login":"estately","id":368721,"avatar_url":"https://avatars.githubusercontent.com/u/368721?v=3","gravatar_id":"","url":"https://api.github.com/users/estately","html_url":"https://github.com/estately","followers_url":"https://api.github.com/users/estately/followers","following_url":"https://api.github.com/users/estately/following{/other_user}","gists_url":"https://api.github.com/users/estately/gists{/gist_id}","starred_url":"https://api.github.com/users/estately/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/estately/subscriptions","organizations_url":"https://api.github.com/users/estately/orgs","repos_url":"https://api.github.com/users/estately/repos","events_url":"https://api.github.com/users/estately/events{/privacy}","received_events_url":"https://api.github.com/users/estately/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/estately/rets","description":"A pure-ruby library for fetching data from RETS servers","fork":false,"url":"https://api.github.com/repos/estately/rets","forks_url":"https://api.github.com/repos/estately/rets/forks","keys_url":"https://api.github.com/repos/estately/rets/keys{/key_id}","collaborators_url":"https://api.github.com/repos/estately/rets/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/estately/rets/teams","hooks_url":"https://api.github.com/repos/estately/rets/hooks","issue_events_url":"https://api.github.com/repos/estately/rets/issues/events{/number}","events_url":"https://api.github.com/repos/estately/rets/events","assignees_url":"https://api.github.com/repos/estately/rets/assignees{/user}","branches_url":"https://api.github.com/repos/estately/rets/branches{/branch}","tags_url":"https://api.github.com/repos/estately/rets/tags","blobs_url":"https://api.github.com/repos/estately/rets/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/estately/rets/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/estately/rets/git/refs{/sha}","trees_url":"https://api.github.com/repos/estately/rets/git/trees{/sha}","statuses_url":"https://api.github.com/repos/estately/rets/statuses/{sha}","languages_url":"https://api.github.com/repos/estately/rets/languages","stargazers_url":"https://api.github.com/repos/estately/rets/stargazers","contributors_url":"https://api.github.com/repos/estately/rets/contributors","subscribers_url":"https://api.github.com/repos/estately/rets/subscribers","subscription_url":"https://api.github.com/repos/estately/rets/subscription","commits_url":"https://api.github.com/repos/estately/rets/commits{/sha}","git_commits_url":"https://api.github.com/repos/estately/rets/git/commits{/sha}","comments_url":"https://api.github.com/repos/estately/rets/comments{/number}","issue_comment_url":"https://api.github.com/repos/estately/rets/issues/comments{/number}","contents_url":"https://api.github.com/repos/estately/rets/contents/{+path}","compare_url":"https://api.github.com/repos/estately/rets/compare/{base}...{head}","merges_url":"https://api.github.com/repos/estately/rets/merges","archive_url":"https://api.github.com/repos/estately/rets/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/estately/rets/downloads","issues_url":"https://api.github.com/repos/estately/rets/issues{/number}","pulls_url":"https://api.github.com/repos/estately/rets/pulls{/number}","milestones_url":"https://api.github.com/repos/estately/rets/milestones{/number}","notifications_url":"https://api.github.com/repos/estately/rets/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/estately/rets/labels{/name}","releases_url":"https://api.github.com/repos/estately/rets/releases{/id}","created_at":"2011-03-24T19:04:06Z","updated_at":"2015-06-04T13:17:01Z","pushed_at":"2015-06-11T17:18:49Z","git_url":"git://github.com/estately/rets.git","ssh_url":"git@github.com:estately/rets.git","clone_url":"https://github.com/estately/rets.git","svn_url":"https://github.com/estately/rets","homepage":"https://github.com/estately/rets","size":1615,"stargazers_count":55,"watchers_count":55,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":39,"mirror_url":null,"open_issues_count":8,"forks":39,"open_issues":8,"watchers":55,"default_branch":"master"}},"base":{"label":"estately:master","ref":"master","sha":"ff71204b14d831f4227cdb3d034f95e68559acbd","user":{"login":"estately","id":368721,"avatar_url":"https://avatars.githubusercontent.com/u/368721?v=3","gravatar_id":"","url":"https://api.github.com/users/estately","html_url":"https://github.com/estately","followers_url":"https://api.github.com/users/estately/followers","following_url":"https://api.github.com/users/estately/following{/other_user}","gists_url":"https://api.github.com/users/estately/gists{/gist_id}","starred_url":"https://api.github.com/users/estately/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/estately/subscriptions","organizations_url":"https://api.github.com/users/estately/orgs","repos_url":"https://api.github.com/users/estately/repos","events_url":"https://api.github.com/users/estately/events{/privacy}","received_events_url":"https://api.github.com/users/estately/received_events","type":"Organization","site_admin":false},"repo":{"id":1522301,"name":"rets","full_name":"estately/rets","owner":{"login":"estately","id":368721,"avatar_url":"https://avatars.githubusercontent.com/u/368721?v=3","gravatar_id":"","url":"https://api.github.com/users/estately","html_url":"https://github.com/estately","followers_url":"https://api.github.com/users/estately/followers","following_url":"https://api.github.com/users/estately/following{/other_user}","gists_url":"https://api.github.com/users/estately/gists{/gist_id}","starred_url":"https://api.github.com/users/estately/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/estately/subscriptions","organizations_url":"https://api.github.com/users/estately/orgs","repos_url":"https://api.github.com/users/estately/repos","events_url":"https://api.github.com/users/estately/events{/privacy}","received_events_url":"https://api.github.com/users/estately/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/estately/rets","description":"A pure-ruby library for fetching data from RETS servers","fork":false,"url":"https://api.github.com/repos/estately/rets","forks_url":"https://api.github.com/repos/estately/rets/forks","keys_url":"https://api.github.com/repos/estately/rets/keys{/key_id}","collaborators_url":"https://api.github.com/repos/estately/rets/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/estately/rets/teams","hooks_url":"https://api.github.com/repos/estately/rets/hooks","issue_events_url":"https://api.github.com/repos/estately/rets/issues/events{/number}","events_url":"https://api.github.com/repos/estately/rets/events","assignees_url":"https://api.github.com/repos/estately/rets/assignees{/user}","branches_url":"https://api.github.com/repos/estately/rets/branches{/branch}","tags_url":"https://api.github.com/repos/estately/rets/tags","blobs_url":"https://api.github.com/repos/estately/rets/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/estately/rets/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/estately/rets/git/refs{/sha}","trees_url":"https://api.github.com/repos/estately/rets/git/trees{/sha}","statuses_url":"https://api.github.com/repos/estately/rets/statuses/{sha}","languages_url":"https://api.github.com/repos/estately/rets/languages","stargazers_url":"https://api.github.com/repos/estately/rets/stargazers","contributors_url":"https://api.github.com/repos/estately/rets/contributors","subscribers_url":"https://api.github.com/repos/estately/rets/subscribers","subscription_url":"https://api.github.com/repos/estately/rets/subscription","commits_url":"https://api.github.com/repos/estately/rets/commits{/sha}","git_commits_url":"https://api.github.com/repos/estately/rets/git/commits{/sha}","comments_url":"https://api.github.com/repos/estately/rets/comments{/number}","issue_comment_url":"https://api.github.com/repos/estately/rets/issues/comments{/number}","contents_url":"https://api.github.com/repos/estately/rets/contents/{+path}","compare_url":"https://api.github.com/repos/estately/rets/compare/{base}...{head}","merges_url":"https://api.github.com/repos/estately/rets/merges","archive_url":"https://api.github.com/repos/estately/rets/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/estately/rets/downloads","issues_url":"https://api.github.com/repos/estately/rets/issues{/number}","pulls_url":"https://api.github.com/repos/estately/rets/pulls{/number}","milestones_url":"https://api.github.com/repos/estately/rets/milestones{/number}","notifications_url":"https://api.github.com/repos/estately/rets/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/estately/rets/labels{/name}","releases_url":"https://api.github.com/repos/estately/rets/releases{/id}","created_at":"2011-03-24T19:04:06Z","updated_at":"2015-06-04T13:17:01Z","pushed_at":"2015-06-11T17:18:49Z","git_url":"git://github.com/estately/rets.git","ssh_url":"git@github.com:estately/rets.git","clone_url":"https://github.com/estately/rets.git","svn_url":"https://github.com/estately/rets","homepage":"https://github.com/estately/rets","size":1615,"stargazers_count":55,"watchers_count":55,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":39,"mirror_url":null,"open_issues_count":8,"forks":39,"open_issues":8,"watchers":55,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/estately/rets/pulls/126"},"html":{"href":"https://github.com/estately/rets/pull/126"},"issue":{"href":"https://api.github.com/repos/estately/rets/issues/126"},"comments":{"href":"https://api.github.com/repos/estately/rets/issues/126/comments"},"review_comments":{"href":"https://api.github.com/repos/estately/rets/pulls/126/comments"},"review_comment":{"href":"https://api.github.com/repos/estately/rets/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/estately/rets/pulls/126/commits"},"statuses":{"href":"https://api.github.com/repos/estately/rets/statuses/e74f75b6cd1438e3c527cea9ea7efc22fa7b7917"}}}}