{"action":"created","comment":{"url":"https://api.github.com/repos/ssharba/gb-project/pulls/comments/208286953","pull_request_review_id":144064770,"id":208286953,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwODI4Njk1Mw==","diff_hunk":"@@ -0,0 +1,68 @@\n+class AsksController < ApplicationController\n+  before_action :set_ask, only: [:show, :edit, :update, :destroy]\n+  before_action :authenticate_business!, only: [:index, :new, :edit]\n+\n+\n+  def index\n+    @asks = Ask.all\n+  end\n+\n+  def show\n+  end\n+\n+  def new\n+    @ask = Ask.new\n+  end\n+\n+  def edit\n+  end\n+\n+  def create\n+    @ask = Ask.new(ask_params)\n+    business_balance = @ask.business.business_info.token_balance\n+    if @ask.total_amount > business_balance\n+      flash[:error] = 'Ask total quantity is greater than token balance'\n+      render :new\n+    else\n+      if @ask.save\n+        Business.find(current_business.id).business_info.decrement!(:token_balance, @ask.total_amount)\n+        flash[:notice] = 'Ask was successfully created.'\n+        redirect_to token_market_businesses_path\n+      else\n+        flash[:error] = @ask.errors.full_messages.to_sentence\n+        render :new\n+      end\n+    end\n+  end\n+\n+  def update\n+    business_balance = @ask.business.business_info.token_balance\n+    if @ask.total_amount > business_balance\n+      flash[:error] = 'Ask total quantity is greater than token balance'\n+      render :edit\n+    else\n+      if @ask.update(ask_params)\n+        flash[:notice] = 'Ask was successfully updated.'\n+        redirect_to token_market_businesses_path\n+      else\n+        flash[:error] = @ask.errors.full_messages.to_sentence\n+        render :edit\n+      end\n+    end\n+  end\n+\n+  def destroy","path":"app/controllers/asks_controller.rb","position":54,"original_position":54,"commit_id":"66449b4524c8ab7490e31562e55a225a86367f7a","original_commit_id":"66449b4524c8ab7490e31562e55a225a86367f7a","user":{"login":"ssharba","id":11578245,"node_id":"MDQ6VXNlcjExNTc4MjQ1","avatar_url":"https://avatars0.githubusercontent.com/u/11578245?v=4","gravatar_id":"","url":"https://api.github.com/users/ssharba","html_url":"https://github.com/ssharba","followers_url":"https://api.github.com/users/ssharba/followers","following_url":"https://api.github.com/users/ssharba/following{/other_user}","gists_url":"https://api.github.com/users/ssharba/gists{/gist_id}","starred_url":"https://api.github.com/users/ssharba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssharba/subscriptions","organizations_url":"https://api.github.com/users/ssharba/orgs","repos_url":"https://api.github.com/users/ssharba/repos","events_url":"https://api.github.com/users/ssharba/events{/privacy}","received_events_url":"https://api.github.com/users/ssharba/received_events","type":"User","site_admin":false},"body":"@kandelchy de we have delete action? if not, Please remove this method and route.","created_at":"2018-08-07T15:52:31Z","updated_at":"2018-08-07T15:54:48Z","html_url":"https://github.com/ssharba/gb-project/pull/311#discussion_r208286953","pull_request_url":"https://api.github.com/repos/ssharba/gb-project/pulls/311","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/ssharba/gb-project/pulls/comments/208286953"},"html":{"href":"https://github.com/ssharba/gb-project/pull/311#discussion_r208286953"},"pull_request":{"href":"https://api.github.com/repos/ssharba/gb-project/pulls/311"}}},"pull_request":{"url":"https://api.github.com/repos/ssharba/gb-project/pulls/311","id":205745016,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA1NzQ1MDE2","html_url":"https://github.com/ssharba/gb-project/pull/311","diff_url":"https://github.com/ssharba/gb-project/pull/311.diff","patch_url":"https://github.com/ssharba/gb-project/pull/311.patch","issue_url":"https://api.github.com/repos/ssharba/gb-project/issues/311","number":311,"state":"open","locked":false,"title":"New Bidding Procedure","user":{"login":"kandelchy","id":25944202,"node_id":"MDQ6VXNlcjI1OTQ0MjAy","avatar_url":"https://avatars0.githubusercontent.com/u/25944202?v=4","gravatar_id":"","url":"https://api.github.com/users/kandelchy","html_url":"https://github.com/kandelchy","followers_url":"https://api.github.com/users/kandelchy/followers","following_url":"https://api.github.com/users/kandelchy/following{/other_user}","gists_url":"https://api.github.com/users/kandelchy/gists{/gist_id}","starred_url":"https://api.github.com/users/kandelchy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kandelchy/subscriptions","organizations_url":"https://api.github.com/users/kandelchy/orgs","repos_url":"https://api.github.com/users/kandelchy/repos","events_url":"https://api.github.com/users/kandelchy/events{/privacy}","received_events_url":"https://api.github.com/users/kandelchy/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-08-02T14:00:20Z","updated_at":"2018-08-07T15:54:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8b275fcd8469f6c164de059c3d6aa2583cd34685","assignee":null,"assignees":[],"requested_reviewers":[{"login":"MwMaki","id":22043245,"node_id":"MDQ6VXNlcjIyMDQzMjQ1","avatar_url":"https://avatars2.githubusercontent.com/u/22043245?v=4","gravatar_id":"","url":"https://api.github.com/users/MwMaki","html_url":"https://github.com/MwMaki","followers_url":"https://api.github.com/users/MwMaki/followers","following_url":"https://api.github.com/users/MwMaki/following{/other_user}","gists_url":"https://api.github.com/users/MwMaki/gists{/gist_id}","starred_url":"https://api.github.com/users/MwMaki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MwMaki/subscriptions","organizations_url":"https://api.github.com/users/MwMaki/orgs","repos_url":"https://api.github.com/users/MwMaki/repos","events_url":"https://api.github.com/users/MwMaki/events{/privacy}","received_events_url":"https://api.github.com/users/MwMaki/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ssharba/gb-project/pulls/311/commits","review_comments_url":"https://api.github.com/repos/ssharba/gb-project/pulls/311/comments","review_comment_url":"https://api.github.com/repos/ssharba/gb-project/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ssharba/gb-project/issues/311/comments","statuses_url":"https://api.github.com/repos/ssharba/gb-project/statuses/66449b4524c8ab7490e31562e55a225a86367f7a","head":{"label":"ssharba:BK-New-Bidding","ref":"BK-New-Bidding","sha":"66449b4524c8ab7490e31562e55a225a86367f7a","user":{"login":"ssharba","id":11578245,"node_id":"MDQ6VXNlcjExNTc4MjQ1","avatar_url":"https://avatars0.githubusercontent.com/u/11578245?v=4","gravatar_id":"","url":"https://api.github.com/users/ssharba","html_url":"https://github.com/ssharba","followers_url":"https://api.github.com/users/ssharba/followers","following_url":"https://api.github.com/users/ssharba/following{/other_user}","gists_url":"https://api.github.com/users/ssharba/gists{/gist_id}","starred_url":"https://api.github.com/users/ssharba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssharba/subscriptions","organizations_url":"https://api.github.com/users/ssharba/orgs","repos_url":"https://api.github.com/users/ssharba/repos","events_url":"https://api.github.com/users/ssharba/events{/privacy}","received_events_url":"https://api.github.com/users/ssharba/received_events","type":"User","site_admin":false},"repo":{"id":126043061,"node_id":"MDEwOlJlcG9zaXRvcnkxMjYwNDMwNjE=","name":"gb-project","full_name":"ssharba/gb-project","owner":{"login":"ssharba","id":11578245,"node_id":"MDQ6VXNlcjExNTc4MjQ1","avatar_url":"https://avatars0.githubusercontent.com/u/11578245?v=4","gravatar_id":"","url":"https://api.github.com/users/ssharba","html_url":"https://github.com/ssharba","followers_url":"https://api.github.com/users/ssharba/followers","following_url":"https://api.github.com/users/ssharba/following{/other_user}","gists_url":"https://api.github.com/users/ssharba/gists{/gist_id}","starred_url":"https://api.github.com/users/ssharba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssharba/subscriptions","organizations_url":"https://api.github.com/users/ssharba/orgs","repos_url":"https://api.github.com/users/ssharba/repos","events_url":"https://api.github.com/users/ssharba/events{/privacy}","received_events_url":"https://api.github.com/users/ssharba/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ssharba/gb-project","description":null,"fork":false,"url":"https://api.github.com/repos/ssharba/gb-project","forks_url":"https://api.github.com/repos/ssharba/gb-project/forks","keys_url":"https://api.github.com/repos/ssharba/gb-project/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ssharba/gb-project/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ssharba/gb-project/teams","hooks_url":"https://api.github.com/repos/ssharba/gb-project/hooks","issue_events_url":"https://api.github.com/repos/ssharba/gb-project/issues/events{/number}","events_url":"https://api.github.com/repos/ssharba/gb-project/events","assignees_url":"https://api.github.com/repos/ssharba/gb-project/assignees{/user}","branches_url":"https://api.github.com/repos/ssharba/gb-project/branches{/branch}","tags_url":"https://api.github.com/repos/ssharba/gb-project/tags","blobs_url":"https://api.github.com/repos/ssharba/gb-project/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ssharba/gb-project/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ssharba/gb-project/git/refs{/sha}","trees_url":"https://api.github.com/repos/ssharba/gb-project/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ssharba/gb-project/statuses/{sha}","languages_url":"https://api.github.com/repos/ssharba/gb-project/languages","stargazers_url":"https://api.github.com/repos/ssharba/gb-project/stargazers","contributors_url":"https://api.github.com/repos/ssharba/gb-project/contributors","subscribers_url":"https://api.github.com/repos/ssharba/gb-project/subscribers","subscription_url":"https://api.github.com/repos/ssharba/gb-project/subscription","commits_url":"https://api.github.com/repos/ssharba/gb-project/commits{/sha}","git_commits_url":"https://api.github.com/repos/ssharba/gb-project/git/commits{/sha}","comments_url":"https://api.github.com/repos/ssharba/gb-project/comments{/number}","issue_comment_url":"https://api.github.com/repos/ssharba/gb-project/issues/comments{/number}","contents_url":"https://api.github.com/repos/ssharba/gb-project/contents/{+path}","compare_url":"https://api.github.com/repos/ssharba/gb-project/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ssharba/gb-project/merges","archive_url":"https://api.github.com/repos/ssharba/gb-project/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ssharba/gb-project/downloads","issues_url":"https://api.github.com/repos/ssharba/gb-project/issues{/number}","pulls_url":"https://api.github.com/repos/ssharba/gb-project/pulls{/number}","milestones_url":"https://api.github.com/repos/ssharba/gb-project/milestones{/number}","notifications_url":"https://api.github.com/repos/ssharba/gb-project/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ssharba/gb-project/labels{/name}","releases_url":"https://api.github.com/repos/ssharba/gb-project/releases{/id}","deployments_url":"https://api.github.com/repos/ssharba/gb-project/deployments","created_at":"2018-03-20T15:49:27Z","updated_at":"2018-08-06T15:45:58Z","pushed_at":"2018-08-07T15:42:18Z","git_url":"git://github.com/ssharba/gb-project.git","ssh_url":"git@github.com:ssharba/gb-project.git","clone_url":"https://github.com/ssharba/gb-project.git","svn_url":"https://github.com/ssharba/gb-project","homepage":null,"size":25027,"stargazers_count":1,"watchers_count":1,"language":"CSS","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":8,"license":null,"forks":0,"open_issues":8,"watchers":1,"default_branch":"dev"}},"base":{"label":"ssharba:dev","ref":"dev","sha":"c532ea4e62e7acb32ed2e21c30fa46fd43846497","user":{"login":"ssharba","id":11578245,"node_id":"MDQ6VXNlcjExNTc4MjQ1","avatar_url":"https://avatars0.githubusercontent.com/u/11578245?v=4","gravatar_id":"","url":"https://api.github.com/users/ssharba","html_url":"https://github.com/ssharba","followers_url":"https://api.github.com/users/ssharba/followers","following_url":"https://api.github.com/users/ssharba/following{/other_user}","gists_url":"https://api.github.com/users/ssharba/gists{/gist_id}","starred_url":"https://api.github.com/users/ssharba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssharba/subscriptions","organizations_url":"https://api.github.com/users/ssharba/orgs","repos_url":"https://api.github.com/users/ssharba/repos","events_url":"https://api.github.com/users/ssharba/events{/privacy}","received_events_url":"https://api.github.com/users/ssharba/received_events","type":"User","site_admin":false},"repo":{"id":126043061,"node_id":"MDEwOlJlcG9zaXRvcnkxMjYwNDMwNjE=","name":"gb-project","full_name":"ssharba/gb-project","owner":{"login":"ssharba","id":11578245,"node_id":"MDQ6VXNlcjExNTc4MjQ1","avatar_url":"https://avatars0.githubusercontent.com/u/11578245?v=4","gravatar_id":"","url":"https://api.github.com/users/ssharba","html_url":"https://github.com/ssharba","followers_url":"https://api.github.com/users/ssharba/followers","following_url":"https://api.github.com/users/ssharba/following{/other_user}","gists_url":"https://api.github.com/users/ssharba/gists{/gist_id}","starred_url":"https://api.github.com/users/ssharba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssharba/subscriptions","organizations_url":"https://api.github.com/users/ssharba/orgs","repos_url":"https://api.github.com/users/ssharba/repos","events_url":"https://api.github.com/users/ssharba/events{/privacy}","received_events_url":"https://api.github.com/users/ssharba/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ssharba/gb-project","description":null,"fork":false,"url":"https://api.github.com/repos/ssharba/gb-project","forks_url":"https://api.github.com/repos/ssharba/gb-project/forks","keys_url":"https://api.github.com/repos/ssharba/gb-project/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ssharba/gb-project/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ssharba/gb-project/teams","hooks_url":"https://api.github.com/repos/ssharba/gb-project/hooks","issue_events_url":"https://api.github.com/repos/ssharba/gb-project/issues/events{/number}","events_url":"https://api.github.com/repos/ssharba/gb-project/events","assignees_url":"https://api.github.com/repos/ssharba/gb-project/assignees{/user}","branches_url":"https://api.github.com/repos/ssharba/gb-project/branches{/branch}","tags_url":"https://api.github.com/repos/ssharba/gb-project/tags","blobs_url":"https://api.github.com/repos/ssharba/gb-project/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ssharba/gb-project/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ssharba/gb-project/git/refs{/sha}","trees_url":"https://api.github.com/repos/ssharba/gb-project/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ssharba/gb-project/statuses/{sha}","languages_url":"https://api.github.com/repos/ssharba/gb-project/languages","stargazers_url":"https://api.github.com/repos/ssharba/gb-project/stargazers","contributors_url":"https://api.github.com/repos/ssharba/gb-project/contributors","subscribers_url":"https://api.github.com/repos/ssharba/gb-project/subscribers","subscription_url":"https://api.github.com/repos/ssharba/gb-project/subscription","commits_url":"https://api.github.com/repos/ssharba/gb-project/commits{/sha}","git_commits_url":"https://api.github.com/repos/ssharba/gb-project/git/commits{/sha}","comments_url":"https://api.github.com/repos/ssharba/gb-project/comments{/number}","issue_comment_url":"https://api.github.com/repos/ssharba/gb-project/issues/comments{/number}","contents_url":"https://api.github.com/repos/ssharba/gb-project/contents/{+path}","compare_url":"https://api.github.com/repos/ssharba/gb-project/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ssharba/gb-project/merges","archive_url":"https://api.github.com/repos/ssharba/gb-project/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ssharba/gb-project/downloads","issues_url":"https://api.github.com/repos/ssharba/gb-project/issues{/number}","pulls_url":"https://api.github.com/repos/ssharba/gb-project/pulls{/number}","milestones_url":"https://api.github.com/repos/ssharba/gb-project/milestones{/number}","notifications_url":"https://api.github.com/repos/ssharba/gb-project/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ssharba/gb-project/labels{/name}","releases_url":"https://api.github.com/repos/ssharba/gb-project/releases{/id}","deployments_url":"https://api.github.com/repos/ssharba/gb-project/deployments","created_at":"2018-03-20T15:49:27Z","updated_at":"2018-08-06T15:45:58Z","pushed_at":"2018-08-07T15:42:18Z","git_url":"git://github.com/ssharba/gb-project.git","ssh_url":"git@github.com:ssharba/gb-project.git","clone_url":"https://github.com/ssharba/gb-project.git","svn_url":"https://github.com/ssharba/gb-project","homepage":null,"size":25027,"stargazers_count":1,"watchers_count":1,"language":"CSS","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":8,"license":null,"forks":0,"open_issues":8,"watchers":1,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/ssharba/gb-project/pulls/311"},"html":{"href":"https://github.com/ssharba/gb-project/pull/311"},"issue":{"href":"https://api.github.com/repos/ssharba/gb-project/issues/311"},"comments":{"href":"https://api.github.com/repos/ssharba/gb-project/issues/311/comments"},"review_comments":{"href":"https://api.github.com/repos/ssharba/gb-project/pulls/311/comments"},"review_comment":{"href":"https://api.github.com/repos/ssharba/gb-project/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ssharba/gb-project/pulls/311/commits"},"statuses":{"href":"https://api.github.com/repos/ssharba/gb-project/statuses/66449b4524c8ab7490e31562e55a225a86367f7a"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"ssharba"}}