{"action":"created","comment":{"url":"https://api.github.com/repos/santhoshtangudu/service_discovery/pulls/comments/31455857","id":31455857,"diff_hunk":"@@ -1,5 +1,84 @@\n+# def get_create_user_params\n+#   @input = parse_request\n+#   print @input\n+#   validates_presence_of :email_id, :password, :gender, :address\n+# end\n+\n+def get_create_address_params\n+  @input = parse_request\n+  validates_presence_of :name, :line1, :line2, :city, :state, :pincode , :phone_number\n+end\n+\n+def create_address(address_params, user_id)\n+  address_params[:user_id] = get_valid_user_id user_id\n+  address_params[:is_primary] = is_primary_address address_params\n+  address = Address.transaction do\n+    Address.create!(address_params)\n+  end\n+  return address\n+end\n+\n+def get_update_address_params\n+  @input = parse_request\n+  validates_presence_of :address_id, :address\n+end\n+\n+def get_delete_addresses_params\n+  @input = parse_request\n+  validates_presence_of :address_ids\n+end\n+\n def get_create_user_params\n   @input = parse_request\n-  print @input\n-  validates_presence_of :email_id, :password, :gender, :address\n+  validates_presence_of :email_id\n+end\n+\n+def update_user_params\n+  @user_params = {} #defining empty hash\n+  @user_params[:email_id] = @input[:email_id]\n+  if @input[:password].nil?\n+    @user_params[:password] = 'opendoors'\n+  end\n+\n+  if !@input[:gender].nil?\n+    @user_params[:gender] = @input[:gender]\n+  end\n+\n+  if !@input[:login_type].nil?\n+    @user_params[:login_type] = @input[:login_type]\n+  else\n+    @user_params[:login_type] = \"Google\"\n+  end\n+end\n+\n+def is_primary_address(address_params)\n+  if !address_params.has_key?(\"is_primary\") then\n+      return false\n+  end\n+  return true\n+end\n+\n+def update_address (user_id)\n+  existing_address = Address.where('user_id' => user_id, 'id' => @input[:address_id]).as_json;\n+  if !existing_address.empty? then\n+    validates_presence_of :name, :line1, :line2, :city, :state, :pincode , :phone_number, @input[:address]","path":"app/helpers/user_services_helper.rb","position":66,"original_position":66,"commit_id":"6d9220b92b0a70e695f1cd4c216ae503f21cebb5","original_commit_id":"6d9220b92b0a70e695f1cd4c216ae503f21cebb5","user":{"login":"santhoshtangudu","id":2149813,"avatar_url":"https://avatars.githubusercontent.com/u/2149813?v=3","gravatar_id":"","url":"https://api.github.com/users/santhoshtangudu","html_url":"https://github.com/santhoshtangudu","followers_url":"https://api.github.com/users/santhoshtangudu/followers","following_url":"https://api.github.com/users/santhoshtangudu/following{/other_user}","gists_url":"https://api.github.com/users/santhoshtangudu/gists{/gist_id}","starred_url":"https://api.github.com/users/santhoshtangudu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/santhoshtangudu/subscriptions","organizations_url":"https://api.github.com/users/santhoshtangudu/orgs","repos_url":"https://api.github.com/users/santhoshtangudu/repos","events_url":"https://api.github.com/users/santhoshtangudu/events{/privacy}","received_events_url":"https://api.github.com/users/santhoshtangudu/received_events","type":"User","site_admin":false},"body":"is there any reason ?","created_at":"2015-06-01T18:38:13Z","updated_at":"2015-06-01T18:38:13Z","html_url":"https://github.com/santhoshtangudu/service_discovery/pull/1#discussion_r31455857","pull_request_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/santhoshtangudu/service_discovery/pulls/comments/31455857"},"html":{"href":"https://github.com/santhoshtangudu/service_discovery/pull/1#discussion_r31455857"},"pull_request":{"href":"https://api.github.com/repos/santhoshtangudu/service_discovery/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/santhoshtangudu/service_discovery/pulls/1","id":34658935,"html_url":"https://github.com/santhoshtangudu/service_discovery/pull/1","diff_url":"https://github.com/santhoshtangudu/service_discovery/pull/1.diff","patch_url":"https://github.com/santhoshtangudu/service_discovery/pull/1.patch","issue_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/issues/1","number":1,"state":"open","locked":false,"title":"Address api","user":{"login":"santhoshtangudu","id":2149813,"avatar_url":"https://avatars.githubusercontent.com/u/2149813?v=3","gravatar_id":"","url":"https://api.github.com/users/santhoshtangudu","html_url":"https://github.com/santhoshtangudu","followers_url":"https://api.github.com/users/santhoshtangudu/followers","following_url":"https://api.github.com/users/santhoshtangudu/following{/other_user}","gists_url":"https://api.github.com/users/santhoshtangudu/gists{/gist_id}","starred_url":"https://api.github.com/users/santhoshtangudu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/santhoshtangudu/subscriptions","organizations_url":"https://api.github.com/users/santhoshtangudu/orgs","repos_url":"https://api.github.com/users/santhoshtangudu/repos","events_url":"https://api.github.com/users/santhoshtangudu/events{/privacy}","received_events_url":"https://api.github.com/users/santhoshtangudu/received_events","type":"User","site_admin":false},"body":"@manmeetsingh, please review the code.","created_at":"2015-05-04T18:00:26Z","updated_at":"2015-06-01T18:38:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3f3283a0bc88062ee374efaab8e397580c697032","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/pulls/1/commits","review_comments_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/pulls/1/comments","review_comment_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/pulls/comments{/number}","comments_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/issues/1/comments","statuses_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/statuses/6d9220b92b0a70e695f1cd4c216ae503f21cebb5","head":{"label":"santhoshtangudu:AddressAPI","ref":"AddressAPI","sha":"6d9220b92b0a70e695f1cd4c216ae503f21cebb5","user":{"login":"santhoshtangudu","id":2149813,"avatar_url":"https://avatars.githubusercontent.com/u/2149813?v=3","gravatar_id":"","url":"https://api.github.com/users/santhoshtangudu","html_url":"https://github.com/santhoshtangudu","followers_url":"https://api.github.com/users/santhoshtangudu/followers","following_url":"https://api.github.com/users/santhoshtangudu/following{/other_user}","gists_url":"https://api.github.com/users/santhoshtangudu/gists{/gist_id}","starred_url":"https://api.github.com/users/santhoshtangudu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/santhoshtangudu/subscriptions","organizations_url":"https://api.github.com/users/santhoshtangudu/orgs","repos_url":"https://api.github.com/users/santhoshtangudu/repos","events_url":"https://api.github.com/users/santhoshtangudu/events{/privacy}","received_events_url":"https://api.github.com/users/santhoshtangudu/received_events","type":"User","site_admin":false},"repo":{"id":33027240,"name":"service_discovery","full_name":"santhoshtangudu/service_discovery","owner":{"login":"santhoshtangudu","id":2149813,"avatar_url":"https://avatars.githubusercontent.com/u/2149813?v=3","gravatar_id":"","url":"https://api.github.com/users/santhoshtangudu","html_url":"https://github.com/santhoshtangudu","followers_url":"https://api.github.com/users/santhoshtangudu/followers","following_url":"https://api.github.com/users/santhoshtangudu/following{/other_user}","gists_url":"https://api.github.com/users/santhoshtangudu/gists{/gist_id}","starred_url":"https://api.github.com/users/santhoshtangudu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/santhoshtangudu/subscriptions","organizations_url":"https://api.github.com/users/santhoshtangudu/orgs","repos_url":"https://api.github.com/users/santhoshtangudu/repos","events_url":"https://api.github.com/users/santhoshtangudu/events{/privacy}","received_events_url":"https://api.github.com/users/santhoshtangudu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/santhoshtangudu/service_discovery","description":"","fork":false,"url":"https://api.github.com/repos/santhoshtangudu/service_discovery","forks_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/forks","keys_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/teams","hooks_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/hooks","issue_events_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/issues/events{/number}","events_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/events","assignees_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/assignees{/user}","branches_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/branches{/branch}","tags_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/tags","blobs_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/git/refs{/sha}","trees_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/statuses/{sha}","languages_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/languages","stargazers_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/stargazers","contributors_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/contributors","subscribers_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/subscribers","subscription_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/subscription","commits_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/commits{/sha}","git_commits_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/git/commits{/sha}","comments_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/comments{/number}","issue_comment_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/issues/comments{/number}","contents_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/contents/{+path}","compare_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/merges","archive_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/downloads","issues_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/issues{/number}","pulls_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/pulls{/number}","milestones_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/milestones{/number}","notifications_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/labels{/name}","releases_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/releases{/id}","created_at":"2015-03-28T09:02:22Z","updated_at":"2015-05-07T05:20:16Z","pushed_at":"2015-05-30T18:40:35Z","git_url":"git://github.com/santhoshtangudu/service_discovery.git","ssh_url":"git@github.com:santhoshtangudu/service_discovery.git","clone_url":"https://github.com/santhoshtangudu/service_discovery.git","svn_url":"https://github.com/santhoshtangudu/service_discovery","homepage":null,"size":308,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"santhoshtangudu:master","ref":"master","sha":"640641f61ba7116df9dedae54f9c53724f184fe7","user":{"login":"santhoshtangudu","id":2149813,"avatar_url":"https://avatars.githubusercontent.com/u/2149813?v=3","gravatar_id":"","url":"https://api.github.com/users/santhoshtangudu","html_url":"https://github.com/santhoshtangudu","followers_url":"https://api.github.com/users/santhoshtangudu/followers","following_url":"https://api.github.com/users/santhoshtangudu/following{/other_user}","gists_url":"https://api.github.com/users/santhoshtangudu/gists{/gist_id}","starred_url":"https://api.github.com/users/santhoshtangudu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/santhoshtangudu/subscriptions","organizations_url":"https://api.github.com/users/santhoshtangudu/orgs","repos_url":"https://api.github.com/users/santhoshtangudu/repos","events_url":"https://api.github.com/users/santhoshtangudu/events{/privacy}","received_events_url":"https://api.github.com/users/santhoshtangudu/received_events","type":"User","site_admin":false},"repo":{"id":33027240,"name":"service_discovery","full_name":"santhoshtangudu/service_discovery","owner":{"login":"santhoshtangudu","id":2149813,"avatar_url":"https://avatars.githubusercontent.com/u/2149813?v=3","gravatar_id":"","url":"https://api.github.com/users/santhoshtangudu","html_url":"https://github.com/santhoshtangudu","followers_url":"https://api.github.com/users/santhoshtangudu/followers","following_url":"https://api.github.com/users/santhoshtangudu/following{/other_user}","gists_url":"https://api.github.com/users/santhoshtangudu/gists{/gist_id}","starred_url":"https://api.github.com/users/santhoshtangudu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/santhoshtangudu/subscriptions","organizations_url":"https://api.github.com/users/santhoshtangudu/orgs","repos_url":"https://api.github.com/users/santhoshtangudu/repos","events_url":"https://api.github.com/users/santhoshtangudu/events{/privacy}","received_events_url":"https://api.github.com/users/santhoshtangudu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/santhoshtangudu/service_discovery","description":"","fork":false,"url":"https://api.github.com/repos/santhoshtangudu/service_discovery","forks_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/forks","keys_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/teams","hooks_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/hooks","issue_events_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/issues/events{/number}","events_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/events","assignees_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/assignees{/user}","branches_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/branches{/branch}","tags_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/tags","blobs_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/git/refs{/sha}","trees_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/statuses/{sha}","languages_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/languages","stargazers_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/stargazers","contributors_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/contributors","subscribers_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/subscribers","subscription_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/subscription","commits_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/commits{/sha}","git_commits_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/git/commits{/sha}","comments_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/comments{/number}","issue_comment_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/issues/comments{/number}","contents_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/contents/{+path}","compare_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/merges","archive_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/downloads","issues_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/issues{/number}","pulls_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/pulls{/number}","milestones_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/milestones{/number}","notifications_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/labels{/name}","releases_url":"https://api.github.com/repos/santhoshtangudu/service_discovery/releases{/id}","created_at":"2015-03-28T09:02:22Z","updated_at":"2015-05-07T05:20:16Z","pushed_at":"2015-05-30T18:40:35Z","git_url":"git://github.com/santhoshtangudu/service_discovery.git","ssh_url":"git@github.com:santhoshtangudu/service_discovery.git","clone_url":"https://github.com/santhoshtangudu/service_discovery.git","svn_url":"https://github.com/santhoshtangudu/service_discovery","homepage":null,"size":308,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/santhoshtangudu/service_discovery/pulls/1"},"html":{"href":"https://github.com/santhoshtangudu/service_discovery/pull/1"},"issue":{"href":"https://api.github.com/repos/santhoshtangudu/service_discovery/issues/1"},"comments":{"href":"https://api.github.com/repos/santhoshtangudu/service_discovery/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/santhoshtangudu/service_discovery/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/santhoshtangudu/service_discovery/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/santhoshtangudu/service_discovery/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/santhoshtangudu/service_discovery/statuses/6d9220b92b0a70e695f1cd4c216ae503f21cebb5"}}}}