{"action":"created","comment":{"url":"https://api.github.com/repos/makersacademy/takeaway-challenge/pulls/comments/149216965","pull_request_review_id":74577429,"id":149216965,"diff_hunk":"@@ -0,0 +1,86 @@\n+require_relative 'menu'\n+require_relative 'dish'\n+require_relative 'order'\n+require 'twilio-ruby'\n+\n+class Takeaway\n+\n+  attr_accessor :menu\n+  attr_reader :orders\n+  LINE_WIDTH = 40\n+  ACCOUNT_SID = 'AC2443e62e2510e55905e8cb3c2d31bb8a'\n+  AUTH_TOKEN = 'ccc7f3d0b864bad7cca601f1ccbd7808'\n+\n+  def initialize(menu: Menu.new, order: Order.new)\n+    @menu = menu\n+    @orders = [order]\n+  end\n+\n+  def show_menu\n+    print_menu_title\n+    @menu.dish_list.each { |dish| print_menu_line(dish.name, dish.price) }\n+  end\n+\n+  def order(name, quantity = 1)\n+    @menu.dish_list.each do |dish|\n+      @orders[0].add(dish, quantity) if dish.name == name.to_sym\n+    end\n+  end\n+\n+  def checkout\n+    raise RuntimeError, 'Nothing was ordered' if @orders[0].cart == {}\n+    print_title\n+    @orders[0].cart.each { |k, val| print_line(k.name, k.price * val, val) }\n+    print_total\n+  end\n+\n+  def pay(sum)\n+    raise RuntimeError, 'Nothing was ordered' if @orders[0].cart == {}\n+    raise RuntimeError, 'Payment differ from total' unless sum == orders[0].total\n+    send_sms\n+    @orders[0].payed\n+    @orders.unshift(Order.new)\n+  end\n+\n+  def cancel_order\n+    @orders[0].canceled\n+    @orders.unshift(Order.new)\n+  end\n+\n+  private\n+\n+  def send_sms\n+    time = Time.new + 3600\n+    client = Twilio::REST::Client.new ACCOUNT_SID, AUTH_TOKEN\n+    message = client.messages.create(\n+      body: 'The order will be delivered before ' + time.strftime(\"%I:%M %p\"),\n+      to: '+447516988508',\n+      from: '+441704325004')\n+    puts message.sid\n+  end","path":"lib/takeaway.rb","position":60,"original_position":60,"commit_id":"aae55f158ed68234d8e7a8077b3bd2e5a76fc1d6","original_commit_id":"aae55f158ed68234d8e7a8077b3bd2e5a76fc1d6","user":{"login":"neoeno","id":1007202,"avatar_url":"https://avatars3.githubusercontent.com/u/1007202?v=4","gravatar_id":"","url":"https://api.github.com/users/neoeno","html_url":"https://github.com/neoeno","followers_url":"https://api.github.com/users/neoeno/followers","following_url":"https://api.github.com/users/neoeno/following{/other_user}","gists_url":"https://api.github.com/users/neoeno/gists{/gist_id}","starred_url":"https://api.github.com/users/neoeno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neoeno/subscriptions","organizations_url":"https://api.github.com/users/neoeno/orgs","repos_url":"https://api.github.com/users/neoeno/repos","events_url":"https://api.github.com/users/neoeno/events{/privacy}","received_events_url":"https://api.github.com/users/neoeno/received_events","type":"User","site_admin":false},"body":"This method isn't tested, but should be.","created_at":"2017-11-06T22:01:56Z","updated_at":"2017-11-06T22:09:19Z","html_url":"https://github.com/makersacademy/takeaway-challenge/pull/871#discussion_r149216965","pull_request_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/pulls/871","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/makersacademy/takeaway-challenge/pulls/comments/149216965"},"html":{"href":"https://github.com/makersacademy/takeaway-challenge/pull/871#discussion_r149216965"},"pull_request":{"href":"https://api.github.com/repos/makersacademy/takeaway-challenge/pulls/871"}}},"pull_request":{"url":"https://api.github.com/repos/makersacademy/takeaway-challenge/pulls/871","id":150740111,"html_url":"https://github.com/makersacademy/takeaway-challenge/pull/871","diff_url":"https://github.com/makersacademy/takeaway-challenge/pull/871.diff","patch_url":"https://github.com/makersacademy/takeaway-challenge/pull/871.patch","issue_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/issues/871","number":871,"state":"open","locked":false,"title":"IPbianco*takeaway-challenge","user":{"login":"IPbianco","id":26870666,"avatar_url":"https://avatars2.githubusercontent.com/u/26870666?v=4","gravatar_id":"","url":"https://api.github.com/users/IPbianco","html_url":"https://github.com/IPbianco","followers_url":"https://api.github.com/users/IPbianco/followers","following_url":"https://api.github.com/users/IPbianco/following{/other_user}","gists_url":"https://api.github.com/users/IPbianco/gists{/gist_id}","starred_url":"https://api.github.com/users/IPbianco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IPbianco/subscriptions","organizations_url":"https://api.github.com/users/IPbianco/orgs","repos_url":"https://api.github.com/users/IPbianco/repos","events_url":"https://api.github.com/users/IPbianco/events{/privacy}","received_events_url":"https://api.github.com/users/IPbianco/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-11-05T20:17:13Z","updated_at":"2017-11-06T22:09:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bba834791aee5cea71ee05b73a8f766476f436ac","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/pulls/871/commits","review_comments_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/pulls/871/comments","review_comment_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/pulls/comments{/number}","comments_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/issues/871/comments","statuses_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/statuses/aae55f158ed68234d8e7a8077b3bd2e5a76fc1d6","head":{"label":"IPbianco:master","ref":"master","sha":"aae55f158ed68234d8e7a8077b3bd2e5a76fc1d6","user":{"login":"IPbianco","id":26870666,"avatar_url":"https://avatars2.githubusercontent.com/u/26870666?v=4","gravatar_id":"","url":"https://api.github.com/users/IPbianco","html_url":"https://github.com/IPbianco","followers_url":"https://api.github.com/users/IPbianco/followers","following_url":"https://api.github.com/users/IPbianco/following{/other_user}","gists_url":"https://api.github.com/users/IPbianco/gists{/gist_id}","starred_url":"https://api.github.com/users/IPbianco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IPbianco/subscriptions","organizations_url":"https://api.github.com/users/IPbianco/orgs","repos_url":"https://api.github.com/users/IPbianco/repos","events_url":"https://api.github.com/users/IPbianco/events{/privacy}","received_events_url":"https://api.github.com/users/IPbianco/received_events","type":"User","site_admin":false},"repo":{"id":109380239,"name":"takeaway-challenge","full_name":"IPbianco/takeaway-challenge","owner":{"login":"IPbianco","id":26870666,"avatar_url":"https://avatars2.githubusercontent.com/u/26870666?v=4","gravatar_id":"","url":"https://api.github.com/users/IPbianco","html_url":"https://github.com/IPbianco","followers_url":"https://api.github.com/users/IPbianco/followers","following_url":"https://api.github.com/users/IPbianco/following{/other_user}","gists_url":"https://api.github.com/users/IPbianco/gists{/gist_id}","starred_url":"https://api.github.com/users/IPbianco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IPbianco/subscriptions","organizations_url":"https://api.github.com/users/IPbianco/orgs","repos_url":"https://api.github.com/users/IPbianco/repos","events_url":"https://api.github.com/users/IPbianco/events{/privacy}","received_events_url":"https://api.github.com/users/IPbianco/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/IPbianco/takeaway-challenge","description":"Use the Twilio Gem to order food","fork":true,"url":"https://api.github.com/repos/IPbianco/takeaway-challenge","forks_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/forks","keys_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/keys{/key_id}","collaborators_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/teams","hooks_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/hooks","issue_events_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/issues/events{/number}","events_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/events","assignees_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/assignees{/user}","branches_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/branches{/branch}","tags_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/tags","blobs_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/git/refs{/sha}","trees_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/git/trees{/sha}","statuses_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/statuses/{sha}","languages_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/languages","stargazers_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/stargazers","contributors_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/contributors","subscribers_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/subscribers","subscription_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/subscription","commits_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/commits{/sha}","git_commits_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/git/commits{/sha}","comments_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/comments{/number}","issue_comment_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/issues/comments{/number}","contents_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/contents/{+path}","compare_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/compare/{base}...{head}","merges_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/merges","archive_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/downloads","issues_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/issues{/number}","pulls_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/pulls{/number}","milestones_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/milestones{/number}","notifications_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/labels{/name}","releases_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/releases{/id}","deployments_url":"https://api.github.com/repos/IPbianco/takeaway-challenge/deployments","created_at":"2017-11-03T09:58:57Z","updated_at":"2017-11-03T09:58:59Z","pushed_at":"2017-11-06T21:21:00Z","git_url":"git://github.com/IPbianco/takeaway-challenge.git","ssh_url":"git@github.com:IPbianco/takeaway-challenge.git","clone_url":"https://github.com/IPbianco/takeaway-challenge.git","svn_url":"https://github.com/IPbianco/takeaway-challenge","homepage":null,"size":107,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"makersacademy:master","ref":"master","sha":"4376d87985d87ec0f89a9554e07a51dfe144c9b1","user":{"login":"makersacademy","id":3636186,"avatar_url":"https://avatars2.githubusercontent.com/u/3636186?v=4","gravatar_id":"","url":"https://api.github.com/users/makersacademy","html_url":"https://github.com/makersacademy","followers_url":"https://api.github.com/users/makersacademy/followers","following_url":"https://api.github.com/users/makersacademy/following{/other_user}","gists_url":"https://api.github.com/users/makersacademy/gists{/gist_id}","starred_url":"https://api.github.com/users/makersacademy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/makersacademy/subscriptions","organizations_url":"https://api.github.com/users/makersacademy/orgs","repos_url":"https://api.github.com/users/makersacademy/repos","events_url":"https://api.github.com/users/makersacademy/events{/privacy}","received_events_url":"https://api.github.com/users/makersacademy/received_events","type":"Organization","site_admin":false},"repo":{"id":27006189,"name":"takeaway-challenge","full_name":"makersacademy/takeaway-challenge","owner":{"login":"makersacademy","id":3636186,"avatar_url":"https://avatars2.githubusercontent.com/u/3636186?v=4","gravatar_id":"","url":"https://api.github.com/users/makersacademy","html_url":"https://github.com/makersacademy","followers_url":"https://api.github.com/users/makersacademy/followers","following_url":"https://api.github.com/users/makersacademy/following{/other_user}","gists_url":"https://api.github.com/users/makersacademy/gists{/gist_id}","starred_url":"https://api.github.com/users/makersacademy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/makersacademy/subscriptions","organizations_url":"https://api.github.com/users/makersacademy/orgs","repos_url":"https://api.github.com/users/makersacademy/repos","events_url":"https://api.github.com/users/makersacademy/events{/privacy}","received_events_url":"https://api.github.com/users/makersacademy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/makersacademy/takeaway-challenge","description":"Use the Twilio Gem to order food","fork":false,"url":"https://api.github.com/repos/makersacademy/takeaway-challenge","forks_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/forks","keys_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/keys{/key_id}","collaborators_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/teams","hooks_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/hooks","issue_events_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/issues/events{/number}","events_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/events","assignees_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/assignees{/user}","branches_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/branches{/branch}","tags_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/tags","blobs_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/git/refs{/sha}","trees_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/git/trees{/sha}","statuses_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/statuses/{sha}","languages_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/languages","stargazers_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/stargazers","contributors_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/contributors","subscribers_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/subscribers","subscription_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/subscription","commits_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/commits{/sha}","git_commits_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/git/commits{/sha}","comments_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/comments{/number}","issue_comment_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/issues/comments{/number}","contents_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/contents/{+path}","compare_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/compare/{base}...{head}","merges_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/merges","archive_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/downloads","issues_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/issues{/number}","pulls_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/pulls{/number}","milestones_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/milestones{/number}","notifications_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/labels{/name}","releases_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/releases{/id}","deployments_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/deployments","created_at":"2014-11-22T17:19:46Z","updated_at":"2017-03-29T21:27:13Z","pushed_at":"2017-11-06T21:21:02Z","git_url":"git://github.com/makersacademy/takeaway-challenge.git","ssh_url":"git@github.com:makersacademy/takeaway-challenge.git","clone_url":"https://github.com/makersacademy/takeaway-challenge.git","svn_url":"https://github.com/makersacademy/takeaway-challenge","homepage":null,"size":99,"stargazers_count":5,"watchers_count":5,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":792,"mirror_url":null,"archived":false,"open_issues_count":333,"forks":792,"open_issues":333,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/makersacademy/takeaway-challenge/pulls/871"},"html":{"href":"https://github.com/makersacademy/takeaway-challenge/pull/871"},"issue":{"href":"https://api.github.com/repos/makersacademy/takeaway-challenge/issues/871"},"comments":{"href":"https://api.github.com/repos/makersacademy/takeaway-challenge/issues/871/comments"},"review_comments":{"href":"https://api.github.com/repos/makersacademy/takeaway-challenge/pulls/871/comments"},"review_comment":{"href":"https://api.github.com/repos/makersacademy/takeaway-challenge/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/makersacademy/takeaway-challenge/pulls/871/commits"},"statuses":{"href":"https://api.github.com/repos/makersacademy/takeaway-challenge/statuses/aae55f158ed68234d8e7a8077b3bd2e5a76fc1d6"}},"author_association":"NONE"}}
{"actor":{"display_login":"neoeno"}}