{"action":"created","comment":{"url":"https://api.github.com/repos/makersacademy/takeaway-challenge/pulls/comments/51347310","id":51347310,"diff_hunk":"@@ -0,0 +1,75 @@\n+require 'twilio-ruby'\n+\n+class Takeaway\n+  def initialize(menu)\n+    @menu = menu\n+    @basket = {}\n+    @cost = OrderCost.new\n+  end\n+\n+  attr_reader :basket\n+\n+  def total\n+    \"Total: £#{cost.total.to_f}0\"\n+  end\n+\n+  def check_total\n+    cost.total == basket_sum\n+  end\n+\n+  def menu\n+    @menu.dishes\n+  end\n+\n+  def order(dish, number=1)\n+    @basket[ordered(dish,number)] = price(dish,number)\n+    cost.add(price(dish,number))\n+    \"You have just ordered #{number}x #{dish}!\"\n+  end\n+\n+  def complete_order\n+    fail \"This order was not completed\" if !check_total\n+    send_text(message)\n+    reset\n+    \"Thank you for ordering!\"\n+  end\n+\n+  private\n+\n+  attr_reader :cost\n+\n+  def reset\n+    @basket = {}\n+    cost.reset\n+  end\n+\n+  def message\n+      message = \"Thank you for your order of £#{cost.total}0.\"\n+      message << \" Your food will be delivered within an hour.\"\n+  end\n+\n+  def basket_sum\n+    sum = 0\n+    @basket.each do |key, value|\n+      sum += value\n+    end\n+    sum\n+  end\n+\n+  def send_text(message)\n+    account_sid = 'AC5e5b5a04f84d6960beb1ea1bf718a737'\n+    auth_token = 'c104097a2e1b217674117dc8e86e6212'\n+    @client = Twilio::REST::Client.new account_sid, auth_token\n+    text = @client.account.messages.create(:body => message,\n+      :to => \"+447411127625\", :from => \"+441458570040\")","path":"lib/takeaway.rb","position":64,"original_position":64,"commit_id":"724e3a9bb58aef4383fe02c1b69c44d84909abac","original_commit_id":"724e3a9bb58aef4383fe02c1b69c44d84909abac","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Style/HashSyntax: Use the new Ruby 1.9 hash syntax. (https://github.com/bbatsov/ruby-style-guide#hash-literals)","created_at":"2016-01-30T16:43:09Z","updated_at":"2016-01-30T16:43:09Z","html_url":"https://github.com/makersacademy/takeaway-challenge/pull/261#discussion_r51347310","pull_request_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/pulls/261","_links":{"self":{"href":"https://api.github.com/repos/makersacademy/takeaway-challenge/pulls/comments/51347310"},"html":{"href":"https://github.com/makersacademy/takeaway-challenge/pull/261#discussion_r51347310"},"pull_request":{"href":"https://api.github.com/repos/makersacademy/takeaway-challenge/pulls/261"}}},"pull_request":{"url":"https://api.github.com/repos/makersacademy/takeaway-challenge/pulls/261","id":57741064,"html_url":"https://github.com/makersacademy/takeaway-challenge/pull/261","diff_url":"https://github.com/makersacademy/takeaway-challenge/pull/261.diff","patch_url":"https://github.com/makersacademy/takeaway-challenge/pull/261.patch","issue_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/issues/261","number":261,"state":"open","locked":false,"title":"Working through takeaway-challenge","user":{"login":"RPiper93","id":15065033,"avatar_url":"https://avatars.githubusercontent.com/u/15065033?v=3","gravatar_id":"","url":"https://api.github.com/users/RPiper93","html_url":"https://github.com/RPiper93","followers_url":"https://api.github.com/users/RPiper93/followers","following_url":"https://api.github.com/users/RPiper93/following{/other_user}","gists_url":"https://api.github.com/users/RPiper93/gists{/gist_id}","starred_url":"https://api.github.com/users/RPiper93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RPiper93/subscriptions","organizations_url":"https://api.github.com/users/RPiper93/orgs","repos_url":"https://api.github.com/users/RPiper93/repos","events_url":"https://api.github.com/users/RPiper93/events{/privacy}","received_events_url":"https://api.github.com/users/RPiper93/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-01-30T14:37:36Z","updated_at":"2016-01-30T16:43:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"558c4f604b4dc95a5e7b1f2e84e871e32314534e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/pulls/261/commits","review_comments_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/pulls/261/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/261/comments","statuses_url":"https://api.github.com/repos/makersacademy/takeaway-challenge/statuses/724e3a9bb58aef4383fe02c1b69c44d84909abac","head":{"label":"RPiper93:master","ref":"master","sha":"724e3a9bb58aef4383fe02c1b69c44d84909abac","user":{"login":"RPiper93","id":15065033,"avatar_url":"https://avatars.githubusercontent.com/u/15065033?v=3","gravatar_id":"","url":"https://api.github.com/users/RPiper93","html_url":"https://github.com/RPiper93","followers_url":"https://api.github.com/users/RPiper93/followers","following_url":"https://api.github.com/users/RPiper93/following{/other_user}","gists_url":"https://api.github.com/users/RPiper93/gists{/gist_id}","starred_url":"https://api.github.com/users/RPiper93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RPiper93/subscriptions","organizations_url":"https://api.github.com/users/RPiper93/orgs","repos_url":"https://api.github.com/users/RPiper93/repos","events_url":"https://api.github.com/users/RPiper93/events{/privacy}","received_events_url":"https://api.github.com/users/RPiper93/received_events","type":"User","site_admin":false},"repo":{"id":50676229,"name":"takeaway-challenge","full_name":"RPiper93/takeaway-challenge","owner":{"login":"RPiper93","id":15065033,"avatar_url":"https://avatars.githubusercontent.com/u/15065033?v=3","gravatar_id":"","url":"https://api.github.com/users/RPiper93","html_url":"https://github.com/RPiper93","followers_url":"https://api.github.com/users/RPiper93/followers","following_url":"https://api.github.com/users/RPiper93/following{/other_user}","gists_url":"https://api.github.com/users/RPiper93/gists{/gist_id}","starred_url":"https://api.github.com/users/RPiper93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RPiper93/subscriptions","organizations_url":"https://api.github.com/users/RPiper93/orgs","repos_url":"https://api.github.com/users/RPiper93/repos","events_url":"https://api.github.com/users/RPiper93/events{/privacy}","received_events_url":"https://api.github.com/users/RPiper93/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/RPiper93/takeaway-challenge","description":"Use the Twilio Gem to order food","fork":true,"url":"https://api.github.com/repos/RPiper93/takeaway-challenge","forks_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/forks","keys_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/teams","hooks_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/hooks","issue_events_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/issues/events{/number}","events_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/events","assignees_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/assignees{/user}","branches_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/branches{/branch}","tags_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/tags","blobs_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/git/refs{/sha}","trees_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/statuses/{sha}","languages_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/languages","stargazers_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/stargazers","contributors_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/contributors","subscribers_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/subscribers","subscription_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/subscription","commits_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/commits{/sha}","git_commits_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/git/commits{/sha}","comments_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/comments{/number}","issue_comment_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/issues/comments{/number}","contents_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/contents/{+path}","compare_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/merges","archive_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/downloads","issues_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/issues{/number}","pulls_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/pulls{/number}","milestones_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/milestones{/number}","notifications_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/labels{/name}","releases_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/releases{/id}","deployments_url":"https://api.github.com/repos/RPiper93/takeaway-challenge/deployments","created_at":"2016-01-29T16:45:45Z","updated_at":"2016-01-29T16:45:46Z","pushed_at":"2016-01-30T16:43:05Z","git_url":"git://github.com/RPiper93/takeaway-challenge.git","ssh_url":"git@github.com:RPiper93/takeaway-challenge.git","clone_url":"https://github.com/RPiper93/takeaway-challenge.git","svn_url":"https://github.com/RPiper93/takeaway-challenge","homepage":null,"size":58,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"makersacademy:master","ref":"master","sha":"646084412ff25d904f34e4af8d96b897247e548a","user":{"login":"makersacademy","id":3636186,"avatar_url":"https://avatars.githubusercontent.com/u/3636186?v=3","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://avatars.githubusercontent.com/u/3636186?v=3","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":"2015-08-03T10:38:46Z","pushed_at":"2016-01-30T16:43:05Z","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":2451,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":250,"mirror_url":null,"open_issues_count":52,"forks":250,"open_issues":52,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/makersacademy/takeaway-challenge/pulls/261"},"html":{"href":"https://github.com/makersacademy/takeaway-challenge/pull/261"},"issue":{"href":"https://api.github.com/repos/makersacademy/takeaway-challenge/issues/261"},"comments":{"href":"https://api.github.com/repos/makersacademy/takeaway-challenge/issues/261/comments"},"review_comments":{"href":"https://api.github.com/repos/makersacademy/takeaway-challenge/pulls/261/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/261/commits"},"statuses":{"href":"https://api.github.com/repos/makersacademy/takeaway-challenge/statuses/724e3a9bb58aef4383fe02c1b69c44d84909abac"}}}}