{"action":"created","comment":{"url":"https://api.github.com/repos/cerner/icontrol_rest/pulls/comments/189397769","pull_request_review_id":121576854,"id":189397769,"diff_hunk":"@@ -64,38 +64,51 @@ def logger\n     #         \"nameServers\"=>[\"1.2.3.72\", \"1.2.3.73\"],\n     #         \"search\"=>[\"domain.com\"]}\n     #\n-    %w[delete get].each do |action|\n-      define_method(action.to_s) do |route, _arg = nil|\n-        send_request { self.class.send(action, route, @options) }\n+    %w[delete get post put patch].each do |action|\n+      define_method(action.to_s) do |route:, headers: {}|\n+        send_request(action: action, route: route, headers: headers)\n       end\n     end\n \n-    # Public  - Post/Put request methods.\n+    # Public    - Post/Put/Patch request methods.\n     #\n-    # route   - URI to send to server as a string.\n-    # data    - Hash of parameters to pass with request.\n+    # route     - URI to send to server as a string.\n+    # body      - Hash representing the request body.\n+    # headers   - Hash of headers to pass with request.\n     #\n-    # Returns - response from the server as a hash.\n+    # Returns   - response from the server as a hash.\n     %w[post put patch].each do |action|\n-      define_method(action.to_s) do |route, data|\n-        body = {}\n-        body[:body] = data.to_json\n-        send_request { self.class.send(action, route, body.merge(@options)) }\n+      define_method(action.to_s) do |route:, body: {}, headers: {}|\n+        send_request(action: action, route: route, body: body, headers: headers)\n       end\n     end\n \n     private\n \n+    # Private - Builds a Hash of headers for a request.\n+    #\n+    # headers - A Hash of headers to be included with the required headers for an iControl request.\n+    #\n+    # Returns - A Hash of required headers and any additional headers to be included in the request.\n+    def build_headers(headers:)","path":"lib/icontrol_rest/client.rb","position":89,"original_position":89,"commit_id":"49330a8974e6554461e285c263fa815e6665725e","original_commit_id":"49330a8974e6554461e285c263fa815e6665725e","user":{"login":"JerrodCarpenter","id":4128301,"avatar_url":"https://avatars1.githubusercontent.com/u/4128301?v=4","gravatar_id":"","url":"https://api.github.com/users/JerrodCarpenter","html_url":"https://github.com/JerrodCarpenter","followers_url":"https://api.github.com/users/JerrodCarpenter/followers","following_url":"https://api.github.com/users/JerrodCarpenter/following{/other_user}","gists_url":"https://api.github.com/users/JerrodCarpenter/gists{/gist_id}","starred_url":"https://api.github.com/users/JerrodCarpenter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JerrodCarpenter/subscriptions","organizations_url":"https://api.github.com/users/JerrodCarpenter/orgs","repos_url":"https://api.github.com/users/JerrodCarpenter/repos","events_url":"https://api.github.com/users/JerrodCarpenter/events{/privacy}","received_events_url":"https://api.github.com/users/JerrodCarpenter/received_events","type":"User","site_admin":false},"body":"What's the benefit of moving the header structure into this method?","created_at":"2018-05-18T21:29:15Z","updated_at":"2018-05-18T21:30:50Z","html_url":"https://github.com/cerner/icontrol_rest/pull/4#discussion_r189397769","pull_request_url":"https://api.github.com/repos/cerner/icontrol_rest/pulls/4","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/cerner/icontrol_rest/pulls/comments/189397769"},"html":{"href":"https://github.com/cerner/icontrol_rest/pull/4#discussion_r189397769"},"pull_request":{"href":"https://api.github.com/repos/cerner/icontrol_rest/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/cerner/icontrol_rest/pulls/4","id":189135875,"html_url":"https://github.com/cerner/icontrol_rest/pull/4","diff_url":"https://github.com/cerner/icontrol_rest/pull/4.diff","patch_url":"https://github.com/cerner/icontrol_rest/pull/4.patch","issue_url":"https://api.github.com/repos/cerner/icontrol_rest/issues/4","number":4,"state":"open","locked":false,"title":"Support headers","user":{"login":"braydensterrett","id":7805772,"avatar_url":"https://avatars2.githubusercontent.com/u/7805772?v=4","gravatar_id":"","url":"https://api.github.com/users/braydensterrett","html_url":"https://github.com/braydensterrett","followers_url":"https://api.github.com/users/braydensterrett/followers","following_url":"https://api.github.com/users/braydensterrett/following{/other_user}","gists_url":"https://api.github.com/users/braydensterrett/gists{/gist_id}","starred_url":"https://api.github.com/users/braydensterrett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/braydensterrett/subscriptions","organizations_url":"https://api.github.com/users/braydensterrett/orgs","repos_url":"https://api.github.com/users/braydensterrett/repos","events_url":"https://api.github.com/users/braydensterrett/events{/privacy}","received_events_url":"https://api.github.com/users/braydensterrett/received_events","type":"User","site_admin":false},"body":"### Summary\r\nSummarize the contents of the code changes in your pull request. Tag any open issues you believe to be resolved by this pull request.\r\n\r\nAdds the ability to specify custom headers to any request. \r\nUpdates the logging framework to be more robust.\r\nRequires 'route' keyword arguments to be provided for all request types. 'body' and 'header' keyword arguments may be provided, but have default values so they are not required. \r\n\r\n\r\nSCRIPT RUN:\r\n![screen shot 2018-05-18 at 4 07 08 pm](https://user-images.githubusercontent.com/7805772/40258002-c8019588-5ab5-11e8-9483-379f3bef096c.png)\r\n\r\nOUTPUT:\r\n<img width=\"1438\" alt=\"screen shot 2018-05-18 at 4 09 09 pm\" src=\"https://user-images.githubusercontent.com/7805772/40258074-fbc623c0-5ab5-11e8-8609-85431cf3c1cd.png\">\r\n\r\n\r\n### Additional Details\r\nIf you have anything else that you think may be relevant to this issue, list it here. Additional information can help us better understand your changes and speed up the review process.\r\n\r\nPlease add your name to the [CONTRIBUTORS.md] file. Adding your name to the [CONTRIBUTORS.md] file signifies agreement to all rights and reservations provided by the [License].\r\n\r\nThanks for contributing to icontrol_rest. \r\n\r\n[CONTRIBUTORS.md]: ../blob/master/CONTRIBUTORS.md\r\n[License]: ../blob/master/LICENSE\r\n","created_at":"2018-05-18T21:10:35Z","updated_at":"2018-05-18T21:30:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"db729f37853feb74afb5afca32d4ba8dbb07e279","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/cerner/icontrol_rest/pulls/4/commits","review_comments_url":"https://api.github.com/repos/cerner/icontrol_rest/pulls/4/comments","review_comment_url":"https://api.github.com/repos/cerner/icontrol_rest/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cerner/icontrol_rest/issues/4/comments","statuses_url":"https://api.github.com/repos/cerner/icontrol_rest/statuses/49330a8974e6554461e285c263fa815e6665725e","head":{"label":"cerner:Support-Headers","ref":"Support-Headers","sha":"49330a8974e6554461e285c263fa815e6665725e","user":{"login":"cerner","id":1873208,"avatar_url":"https://avatars1.githubusercontent.com/u/1873208?v=4","gravatar_id":"","url":"https://api.github.com/users/cerner","html_url":"https://github.com/cerner","followers_url":"https://api.github.com/users/cerner/followers","following_url":"https://api.github.com/users/cerner/following{/other_user}","gists_url":"https://api.github.com/users/cerner/gists{/gist_id}","starred_url":"https://api.github.com/users/cerner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cerner/subscriptions","organizations_url":"https://api.github.com/users/cerner/orgs","repos_url":"https://api.github.com/users/cerner/repos","events_url":"https://api.github.com/users/cerner/events{/privacy}","received_events_url":"https://api.github.com/users/cerner/received_events","type":"Organization","site_admin":false},"repo":{"id":108594099,"name":"icontrol_rest","full_name":"cerner/icontrol_rest","owner":{"login":"cerner","id":1873208,"avatar_url":"https://avatars1.githubusercontent.com/u/1873208?v=4","gravatar_id":"","url":"https://api.github.com/users/cerner","html_url":"https://github.com/cerner","followers_url":"https://api.github.com/users/cerner/followers","following_url":"https://api.github.com/users/cerner/following{/other_user}","gists_url":"https://api.github.com/users/cerner/gists{/gist_id}","starred_url":"https://api.github.com/users/cerner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cerner/subscriptions","organizations_url":"https://api.github.com/users/cerner/orgs","repos_url":"https://api.github.com/users/cerner/repos","events_url":"https://api.github.com/users/cerner/events{/privacy}","received_events_url":"https://api.github.com/users/cerner/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cerner/icontrol_rest","description":"IcontrolRest provides a simple client to interact with Icontrol.","fork":false,"url":"https://api.github.com/repos/cerner/icontrol_rest","forks_url":"https://api.github.com/repos/cerner/icontrol_rest/forks","keys_url":"https://api.github.com/repos/cerner/icontrol_rest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cerner/icontrol_rest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cerner/icontrol_rest/teams","hooks_url":"https://api.github.com/repos/cerner/icontrol_rest/hooks","issue_events_url":"https://api.github.com/repos/cerner/icontrol_rest/issues/events{/number}","events_url":"https://api.github.com/repos/cerner/icontrol_rest/events","assignees_url":"https://api.github.com/repos/cerner/icontrol_rest/assignees{/user}","branches_url":"https://api.github.com/repos/cerner/icontrol_rest/branches{/branch}","tags_url":"https://api.github.com/repos/cerner/icontrol_rest/tags","blobs_url":"https://api.github.com/repos/cerner/icontrol_rest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cerner/icontrol_rest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cerner/icontrol_rest/git/refs{/sha}","trees_url":"https://api.github.com/repos/cerner/icontrol_rest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cerner/icontrol_rest/statuses/{sha}","languages_url":"https://api.github.com/repos/cerner/icontrol_rest/languages","stargazers_url":"https://api.github.com/repos/cerner/icontrol_rest/stargazers","contributors_url":"https://api.github.com/repos/cerner/icontrol_rest/contributors","subscribers_url":"https://api.github.com/repos/cerner/icontrol_rest/subscribers","subscription_url":"https://api.github.com/repos/cerner/icontrol_rest/subscription","commits_url":"https://api.github.com/repos/cerner/icontrol_rest/commits{/sha}","git_commits_url":"https://api.github.com/repos/cerner/icontrol_rest/git/commits{/sha}","comments_url":"https://api.github.com/repos/cerner/icontrol_rest/comments{/number}","issue_comment_url":"https://api.github.com/repos/cerner/icontrol_rest/issues/comments{/number}","contents_url":"https://api.github.com/repos/cerner/icontrol_rest/contents/{+path}","compare_url":"https://api.github.com/repos/cerner/icontrol_rest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cerner/icontrol_rest/merges","archive_url":"https://api.github.com/repos/cerner/icontrol_rest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cerner/icontrol_rest/downloads","issues_url":"https://api.github.com/repos/cerner/icontrol_rest/issues{/number}","pulls_url":"https://api.github.com/repos/cerner/icontrol_rest/pulls{/number}","milestones_url":"https://api.github.com/repos/cerner/icontrol_rest/milestones{/number}","notifications_url":"https://api.github.com/repos/cerner/icontrol_rest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cerner/icontrol_rest/labels{/name}","releases_url":"https://api.github.com/repos/cerner/icontrol_rest/releases{/id}","deployments_url":"https://api.github.com/repos/cerner/icontrol_rest/deployments","created_at":"2017-10-27T20:46:27Z","updated_at":"2018-05-15T17:13:11Z","pushed_at":"2018-05-18T21:22:08Z","git_url":"git://github.com/cerner/icontrol_rest.git","ssh_url":"git@github.com:cerner/icontrol_rest.git","clone_url":"https://github.com/cerner/icontrol_rest.git","svn_url":"https://github.com/cerner/icontrol_rest","homepage":"","size":17,"stargazers_count":3,"watchers_count":3,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":1,"watchers":3,"default_branch":"master"}},"base":{"label":"cerner:master","ref":"master","sha":"d4045520a2455bc8d6ec34dc635802abcaeb7f86","user":{"login":"cerner","id":1873208,"avatar_url":"https://avatars1.githubusercontent.com/u/1873208?v=4","gravatar_id":"","url":"https://api.github.com/users/cerner","html_url":"https://github.com/cerner","followers_url":"https://api.github.com/users/cerner/followers","following_url":"https://api.github.com/users/cerner/following{/other_user}","gists_url":"https://api.github.com/users/cerner/gists{/gist_id}","starred_url":"https://api.github.com/users/cerner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cerner/subscriptions","organizations_url":"https://api.github.com/users/cerner/orgs","repos_url":"https://api.github.com/users/cerner/repos","events_url":"https://api.github.com/users/cerner/events{/privacy}","received_events_url":"https://api.github.com/users/cerner/received_events","type":"Organization","site_admin":false},"repo":{"id":108594099,"name":"icontrol_rest","full_name":"cerner/icontrol_rest","owner":{"login":"cerner","id":1873208,"avatar_url":"https://avatars1.githubusercontent.com/u/1873208?v=4","gravatar_id":"","url":"https://api.github.com/users/cerner","html_url":"https://github.com/cerner","followers_url":"https://api.github.com/users/cerner/followers","following_url":"https://api.github.com/users/cerner/following{/other_user}","gists_url":"https://api.github.com/users/cerner/gists{/gist_id}","starred_url":"https://api.github.com/users/cerner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cerner/subscriptions","organizations_url":"https://api.github.com/users/cerner/orgs","repos_url":"https://api.github.com/users/cerner/repos","events_url":"https://api.github.com/users/cerner/events{/privacy}","received_events_url":"https://api.github.com/users/cerner/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cerner/icontrol_rest","description":"IcontrolRest provides a simple client to interact with Icontrol.","fork":false,"url":"https://api.github.com/repos/cerner/icontrol_rest","forks_url":"https://api.github.com/repos/cerner/icontrol_rest/forks","keys_url":"https://api.github.com/repos/cerner/icontrol_rest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cerner/icontrol_rest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cerner/icontrol_rest/teams","hooks_url":"https://api.github.com/repos/cerner/icontrol_rest/hooks","issue_events_url":"https://api.github.com/repos/cerner/icontrol_rest/issues/events{/number}","events_url":"https://api.github.com/repos/cerner/icontrol_rest/events","assignees_url":"https://api.github.com/repos/cerner/icontrol_rest/assignees{/user}","branches_url":"https://api.github.com/repos/cerner/icontrol_rest/branches{/branch}","tags_url":"https://api.github.com/repos/cerner/icontrol_rest/tags","blobs_url":"https://api.github.com/repos/cerner/icontrol_rest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cerner/icontrol_rest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cerner/icontrol_rest/git/refs{/sha}","trees_url":"https://api.github.com/repos/cerner/icontrol_rest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cerner/icontrol_rest/statuses/{sha}","languages_url":"https://api.github.com/repos/cerner/icontrol_rest/languages","stargazers_url":"https://api.github.com/repos/cerner/icontrol_rest/stargazers","contributors_url":"https://api.github.com/repos/cerner/icontrol_rest/contributors","subscribers_url":"https://api.github.com/repos/cerner/icontrol_rest/subscribers","subscription_url":"https://api.github.com/repos/cerner/icontrol_rest/subscription","commits_url":"https://api.github.com/repos/cerner/icontrol_rest/commits{/sha}","git_commits_url":"https://api.github.com/repos/cerner/icontrol_rest/git/commits{/sha}","comments_url":"https://api.github.com/repos/cerner/icontrol_rest/comments{/number}","issue_comment_url":"https://api.github.com/repos/cerner/icontrol_rest/issues/comments{/number}","contents_url":"https://api.github.com/repos/cerner/icontrol_rest/contents/{+path}","compare_url":"https://api.github.com/repos/cerner/icontrol_rest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cerner/icontrol_rest/merges","archive_url":"https://api.github.com/repos/cerner/icontrol_rest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cerner/icontrol_rest/downloads","issues_url":"https://api.github.com/repos/cerner/icontrol_rest/issues{/number}","pulls_url":"https://api.github.com/repos/cerner/icontrol_rest/pulls{/number}","milestones_url":"https://api.github.com/repos/cerner/icontrol_rest/milestones{/number}","notifications_url":"https://api.github.com/repos/cerner/icontrol_rest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cerner/icontrol_rest/labels{/name}","releases_url":"https://api.github.com/repos/cerner/icontrol_rest/releases{/id}","deployments_url":"https://api.github.com/repos/cerner/icontrol_rest/deployments","created_at":"2017-10-27T20:46:27Z","updated_at":"2018-05-15T17:13:11Z","pushed_at":"2018-05-18T21:22:08Z","git_url":"git://github.com/cerner/icontrol_rest.git","ssh_url":"git@github.com:cerner/icontrol_rest.git","clone_url":"https://github.com/cerner/icontrol_rest.git","svn_url":"https://github.com/cerner/icontrol_rest","homepage":"","size":17,"stargazers_count":3,"watchers_count":3,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":1,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cerner/icontrol_rest/pulls/4"},"html":{"href":"https://github.com/cerner/icontrol_rest/pull/4"},"issue":{"href":"https://api.github.com/repos/cerner/icontrol_rest/issues/4"},"comments":{"href":"https://api.github.com/repos/cerner/icontrol_rest/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/cerner/icontrol_rest/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/cerner/icontrol_rest/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cerner/icontrol_rest/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/cerner/icontrol_rest/statuses/49330a8974e6554461e285c263fa815e6665725e"}},"author_association":"NONE"}}
{"actor":{"display_login":"JerrodCarpenter"}}