{"action":"created","comment":{"url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/pulls/comments/59959210","id":59959210,"diff_hunk":"@@ -0,0 +1,36 @@\n+\"\"\"Pump Manager manages the water pump.\"\"\"\n+\n+# If soil goes below this moisture threshold, pump needs to add water.\n+# Moisture is based on sensor calibration by @dicksondisckson:\n+# https://github.com/dicksondickson/PlantFriends/blob/master/sensor_node/RFM69/sensor_node.ino\n+SOIL_MOISTURE_THRESHOLD = 300\n+\n+# Default amount of water to add to the plant (in mL) when pump manager detects\n+# low soil moisture.\n+DEFAULT_PUMP_AMOUNT = 200\n+\n+\n+class PumpManager(object):\n+\n+    def __init__(self, moisture_sensor, pump):\n+        \"\"\"Creates a PumpManager object, which manages moisture levels.\n+\n+        Args:\n+            moisture_sensor: A moisture sensor instance that provides soil\n+                moisture level readings.\n+            pump: A pump instance, which supports water pumping.\n+        \"\"\"\n+        self._moisture_sensor = moisture_sensor\n+        self._pump = pump\n+\n+    def pump_if_needed(self):\n+        \"\"\"Run the water pump if there is a need to run it.\n+\n+        Checks whether it's time to run the pump and runs it if needed.\n+        Running the pump is necessary if the soil's moisture is below the\n+        defined moisture threshold.\n+\n+        \"\"\"\n+        # TODO(JeetShetty): Add logic here so that it only runs the pump when\n+        # the soil moisture is too low.\n+        self._pump.pump_water(DEFAULT_PUMP_AMOUNT)","path":"greenpithumb/pump_manager.py","position":36,"original_position":36,"commit_id":"954b775fa8c0a9973d184f904e5a631fd7abbc32","original_commit_id":"954b775fa8c0a9973d184f904e5a631fd7abbc32","user":{"login":"JeetShetty","id":18449868,"avatar_url":"https://avatars.githubusercontent.com/u/18449868?v=3","gravatar_id":"","url":"https://api.github.com/users/JeetShetty","html_url":"https://github.com/JeetShetty","followers_url":"https://api.github.com/users/JeetShetty/followers","following_url":"https://api.github.com/users/JeetShetty/following{/other_user}","gists_url":"https://api.github.com/users/JeetShetty/gists{/gist_id}","starred_url":"https://api.github.com/users/JeetShetty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JeetShetty/subscriptions","organizations_url":"https://api.github.com/users/JeetShetty/orgs","repos_url":"https://api.github.com/users/JeetShetty/repos","events_url":"https://api.github.com/users/JeetShetty/events{/privacy}","received_events_url":"https://api.github.com/users/JeetShetty/received_events","type":"User","site_admin":false},"body":"How can we do this without having defined a pump_water method?","created_at":"2016-04-16T01:04:00Z","updated_at":"2016-04-16T01:04:00Z","html_url":"https://github.com/JeetShetty/GreenPiThumb/pull/1#discussion_r59959210","pull_request_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/JeetShetty/GreenPiThumb/pulls/comments/59959210"},"html":{"href":"https://github.com/JeetShetty/GreenPiThumb/pull/1#discussion_r59959210"},"pull_request":{"href":"https://api.github.com/repos/JeetShetty/GreenPiThumb/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/pulls/1","id":66416784,"html_url":"https://github.com/JeetShetty/GreenPiThumb/pull/1","diff_url":"https://github.com/JeetShetty/GreenPiThumb/pull/1.diff","patch_url":"https://github.com/JeetShetty/GreenPiThumb/pull/1.patch","issue_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/issues/1","number":1,"state":"closed","locked":false,"title":"Adding a PumpManager class","user":{"login":"mtlynch","id":7783288,"avatar_url":"https://avatars.githubusercontent.com/u/7783288?v=3","gravatar_id":"","url":"https://api.github.com/users/mtlynch","html_url":"https://github.com/mtlynch","followers_url":"https://api.github.com/users/mtlynch/followers","following_url":"https://api.github.com/users/mtlynch/following{/other_user}","gists_url":"https://api.github.com/users/mtlynch/gists{/gist_id}","starred_url":"https://api.github.com/users/mtlynch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtlynch/subscriptions","organizations_url":"https://api.github.com/users/mtlynch/orgs","repos_url":"https://api.github.com/users/mtlynch/repos","events_url":"https://api.github.com/users/mtlynch/events{/privacy}","received_events_url":"https://api.github.com/users/mtlynch/received_events","type":"User","site_admin":false},"body":"Adds a PumpManager class with unit tests. One unit test works, two fail, and\r\none is not implemented yet.","created_at":"2016-04-14T01:26:20Z","updated_at":"2016-04-16T01:04:00Z","closed_at":"2016-04-14T13:02:51Z","merged_at":"2016-04-14T13:02:51Z","merge_commit_sha":"72b5ca425caeff18515dfc05f33c9d7bb94713df","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/pulls/1/commits","review_comments_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/pulls/1/comments","review_comment_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/issues/1/comments","statuses_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/statuses/954b775fa8c0a9973d184f904e5a631fd7abbc32","head":{"label":"mtlynch:pump-manager","ref":"pump-manager","sha":"954b775fa8c0a9973d184f904e5a631fd7abbc32","user":{"login":"mtlynch","id":7783288,"avatar_url":"https://avatars.githubusercontent.com/u/7783288?v=3","gravatar_id":"","url":"https://api.github.com/users/mtlynch","html_url":"https://github.com/mtlynch","followers_url":"https://api.github.com/users/mtlynch/followers","following_url":"https://api.github.com/users/mtlynch/following{/other_user}","gists_url":"https://api.github.com/users/mtlynch/gists{/gist_id}","starred_url":"https://api.github.com/users/mtlynch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtlynch/subscriptions","organizations_url":"https://api.github.com/users/mtlynch/orgs","repos_url":"https://api.github.com/users/mtlynch/repos","events_url":"https://api.github.com/users/mtlynch/events{/privacy}","received_events_url":"https://api.github.com/users/mtlynch/received_events","type":"User","site_admin":false},"repo":{"id":56197493,"name":"GreenPiThumb","full_name":"mtlynch/GreenPiThumb","owner":{"login":"mtlynch","id":7783288,"avatar_url":"https://avatars.githubusercontent.com/u/7783288?v=3","gravatar_id":"","url":"https://api.github.com/users/mtlynch","html_url":"https://github.com/mtlynch","followers_url":"https://api.github.com/users/mtlynch/followers","following_url":"https://api.github.com/users/mtlynch/following{/other_user}","gists_url":"https://api.github.com/users/mtlynch/gists{/gist_id}","starred_url":"https://api.github.com/users/mtlynch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtlynch/subscriptions","organizations_url":"https://api.github.com/users/mtlynch/orgs","repos_url":"https://api.github.com/users/mtlynch/repos","events_url":"https://api.github.com/users/mtlynch/events{/privacy}","received_events_url":"https://api.github.com/users/mtlynch/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mtlynch/GreenPiThumb","description":"","fork":true,"url":"https://api.github.com/repos/mtlynch/GreenPiThumb","forks_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/forks","keys_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/teams","hooks_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/hooks","issue_events_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/issues/events{/number}","events_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/events","assignees_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/assignees{/user}","branches_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/branches{/branch}","tags_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/tags","blobs_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/git/refs{/sha}","trees_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/statuses/{sha}","languages_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/languages","stargazers_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/stargazers","contributors_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/contributors","subscribers_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/subscribers","subscription_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/subscription","commits_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/commits{/sha}","git_commits_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/git/commits{/sha}","comments_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/comments{/number}","issue_comment_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/issues/comments{/number}","contents_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/contents/{+path}","compare_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/merges","archive_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/downloads","issues_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/issues{/number}","pulls_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/pulls{/number}","milestones_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/milestones{/number}","notifications_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/labels{/name}","releases_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/releases{/id}","deployments_url":"https://api.github.com/repos/mtlynch/GreenPiThumb/deployments","created_at":"2016-04-14T01:21:54Z","updated_at":"2016-04-13T19:56:12Z","pushed_at":"2016-04-15T00:25:30Z","git_url":"git://github.com/mtlynch/GreenPiThumb.git","ssh_url":"git@github.com:mtlynch/GreenPiThumb.git","clone_url":"https://github.com/mtlynch/GreenPiThumb.git","svn_url":"https://github.com/mtlynch/GreenPiThumb","homepage":null,"size":7,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"JeetShetty:master","ref":"master","sha":"52564b4321354a5a8c0557f01325221971103a3c","user":{"login":"JeetShetty","id":18449868,"avatar_url":"https://avatars.githubusercontent.com/u/18449868?v=3","gravatar_id":"","url":"https://api.github.com/users/JeetShetty","html_url":"https://github.com/JeetShetty","followers_url":"https://api.github.com/users/JeetShetty/followers","following_url":"https://api.github.com/users/JeetShetty/following{/other_user}","gists_url":"https://api.github.com/users/JeetShetty/gists{/gist_id}","starred_url":"https://api.github.com/users/JeetShetty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JeetShetty/subscriptions","organizations_url":"https://api.github.com/users/JeetShetty/orgs","repos_url":"https://api.github.com/users/JeetShetty/repos","events_url":"https://api.github.com/users/JeetShetty/events{/privacy}","received_events_url":"https://api.github.com/users/JeetShetty/received_events","type":"User","site_admin":false},"repo":{"id":56181703,"name":"GreenPiThumb","full_name":"JeetShetty/GreenPiThumb","owner":{"login":"JeetShetty","id":18449868,"avatar_url":"https://avatars.githubusercontent.com/u/18449868?v=3","gravatar_id":"","url":"https://api.github.com/users/JeetShetty","html_url":"https://github.com/JeetShetty","followers_url":"https://api.github.com/users/JeetShetty/followers","following_url":"https://api.github.com/users/JeetShetty/following{/other_user}","gists_url":"https://api.github.com/users/JeetShetty/gists{/gist_id}","starred_url":"https://api.github.com/users/JeetShetty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JeetShetty/subscriptions","organizations_url":"https://api.github.com/users/JeetShetty/orgs","repos_url":"https://api.github.com/users/JeetShetty/repos","events_url":"https://api.github.com/users/JeetShetty/events{/privacy}","received_events_url":"https://api.github.com/users/JeetShetty/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JeetShetty/GreenPiThumb","description":"","fork":false,"url":"https://api.github.com/repos/JeetShetty/GreenPiThumb","forks_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/forks","keys_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/teams","hooks_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/hooks","issue_events_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/issues/events{/number}","events_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/events","assignees_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/assignees{/user}","branches_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/branches{/branch}","tags_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/tags","blobs_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/git/refs{/sha}","trees_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/statuses/{sha}","languages_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/languages","stargazers_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/stargazers","contributors_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/contributors","subscribers_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/subscribers","subscription_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/subscription","commits_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/commits{/sha}","git_commits_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/git/commits{/sha}","comments_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/comments{/number}","issue_comment_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/issues/comments{/number}","contents_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/contents/{+path}","compare_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/merges","archive_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/downloads","issues_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/issues{/number}","pulls_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/pulls{/number}","milestones_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/milestones{/number}","notifications_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/labels{/name}","releases_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/releases{/id}","deployments_url":"https://api.github.com/repos/JeetShetty/GreenPiThumb/deployments","created_at":"2016-04-13T19:56:12Z","updated_at":"2016-04-14T13:02:52Z","pushed_at":"2016-04-16T01:00:36Z","git_url":"git://github.com/JeetShetty/GreenPiThumb.git","ssh_url":"git@github.com:JeetShetty/GreenPiThumb.git","clone_url":"https://github.com/JeetShetty/GreenPiThumb.git","svn_url":"https://github.com/JeetShetty/GreenPiThumb","homepage":null,"size":8,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JeetShetty/GreenPiThumb/pulls/1"},"html":{"href":"https://github.com/JeetShetty/GreenPiThumb/pull/1"},"issue":{"href":"https://api.github.com/repos/JeetShetty/GreenPiThumb/issues/1"},"comments":{"href":"https://api.github.com/repos/JeetShetty/GreenPiThumb/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/JeetShetty/GreenPiThumb/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/JeetShetty/GreenPiThumb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JeetShetty/GreenPiThumb/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/JeetShetty/GreenPiThumb/statuses/954b775fa8c0a9973d184f904e5a631fd7abbc32"}}}}