{"action":"created","comment":{"url":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/comments/29803902","id":29803902,"diff_hunk":"@@ -0,0 +1,84 @@\n+require 'json'\n+require_relative 'receipt'\n+\n+class Till\n+  attr_reader :total, :tax, :order_items,  :price_list\n+\n+  TAXRATE = 8.64\n+\n+  def initialize\n+    @business = ''\n+    @address = ''\n+    @phone = ''\n+    @total = 0\n+    @tax = 0\n+    @order_items = []\n+    @price_list = []\n+  end\n+\n+  def order(product)\n+    @total += cost(product)\n+    @tax += (TAXRATE / 100) * cost(product)\n+    order_items << product\n+  end\n+\n+  def subtotal\n+    '£' + (format '%.2f', @total)\n+  end\n+\n+  def count_all_items\n+    counts = Hash.new(0)\n+    order_items.each { |item| counts[item] += 1 }\n+    counts\n+  end\n+\n+  def cost(name)\n+    (price_list.find { |product| product.name == name }).price\n+  end\n+\n+  def count(name)\n+    count_all_items[name]\n+  end\n+\n+  def line_items\n+    line_items = []\n+    order_items.uniq.each do |item|\n+      line_items << item + ' ' + count(item).to_s +\n+        ' x £' + (format '%.2f', cost(item))\n+    end\n+    line_items\n+  end\n+\n+  def read_file(file_name)\n+    file = File.read(file_name)\n+    data_hash = JSON.parse(file)\n+    list = data_hash[0]['prices']\n+    list[0].each do |name, price|\n+      price_list << Product.new(name, price)\n+    end\n+  end\n+\n+  def read_header(file_name) # move this to till.rb\n+    file = File.read(file_name)\n+    data_hash = JSON.parse(file)\n+    @business = data_hash[0]['shopName']\n+    @address = data_hash[0]['address']\n+    @phone = data_hash[0]['phone']\n+  end\n+\n+  # def complete_receipt(receipt)\n+  #   receipt = []\n+  #   receipt.read_header('hipstercoffee.json')\n+  #   receipt.line_items = line_items\n+  #   receipt.tax = tax.round(2).to_s\n+  #   receipt.total = (total + tax).round(2).to_s\n+  # end\n+\n+  def display_receipt # move to till","path":"lib/till.rb","position":77,"original_position":77,"commit_id":"f1d5f3f8d292be8ec73691f1d020d44dd41be178","original_commit_id":"f1d5f3f8d292be8ec73691f1d020d44dd41be178","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":"Assignment Branch Condition size for display_receipt is too high. [19/15]","created_at":"2015-05-06T21:25:36Z","updated_at":"2015-05-06T21:25:36Z","html_url":"https://github.com/makersacademy/till_tech_test/pull/12#discussion_r29803902","pull_request_url":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/comments/29803902"},"html":{"href":"https://github.com/makersacademy/till_tech_test/pull/12#discussion_r29803902"},"pull_request":{"href":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/12","id":34311743,"html_url":"https://github.com/makersacademy/till_tech_test/pull/12","diff_url":"https://github.com/makersacademy/till_tech_test/pull/12.diff","patch_url":"https://github.com/makersacademy/till_tech_test/pull/12.patch","issue_url":"https://api.github.com/repos/makersacademy/till_tech_test/issues/12","number":12,"state":"open","locked":false,"title":"Version 1 completed","user":{"login":"StephanMusgrave","id":7117842,"avatar_url":"https://avatars.githubusercontent.com/u/7117842?v=3","gravatar_id":"","url":"https://api.github.com/users/StephanMusgrave","html_url":"https://github.com/StephanMusgrave","followers_url":"https://api.github.com/users/StephanMusgrave/followers","following_url":"https://api.github.com/users/StephanMusgrave/following{/other_user}","gists_url":"https://api.github.com/users/StephanMusgrave/gists{/gist_id}","starred_url":"https://api.github.com/users/StephanMusgrave/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StephanMusgrave/subscriptions","organizations_url":"https://api.github.com/users/StephanMusgrave/orgs","repos_url":"https://api.github.com/users/StephanMusgrave/repos","events_url":"https://api.github.com/users/StephanMusgrave/events{/privacy}","received_events_url":"https://api.github.com/users/StephanMusgrave/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-04-28T21:11:33Z","updated_at":"2015-05-06T21:25:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bc98e1aa604b1252d2a7c0e26a02775df9e9a1ae","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/12/commits","review_comments_url":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/12/comments","review_comment_url":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/comments{/number}","comments_url":"https://api.github.com/repos/makersacademy/till_tech_test/issues/12/comments","statuses_url":"https://api.github.com/repos/makersacademy/till_tech_test/statuses/f1d5f3f8d292be8ec73691f1d020d44dd41be178","head":{"label":"StephanMusgrave:master","ref":"master","sha":"f1d5f3f8d292be8ec73691f1d020d44dd41be178","user":{"login":"StephanMusgrave","id":7117842,"avatar_url":"https://avatars.githubusercontent.com/u/7117842?v=3","gravatar_id":"","url":"https://api.github.com/users/StephanMusgrave","html_url":"https://github.com/StephanMusgrave","followers_url":"https://api.github.com/users/StephanMusgrave/followers","following_url":"https://api.github.com/users/StephanMusgrave/following{/other_user}","gists_url":"https://api.github.com/users/StephanMusgrave/gists{/gist_id}","starred_url":"https://api.github.com/users/StephanMusgrave/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StephanMusgrave/subscriptions","organizations_url":"https://api.github.com/users/StephanMusgrave/orgs","repos_url":"https://api.github.com/users/StephanMusgrave/repos","events_url":"https://api.github.com/users/StephanMusgrave/events{/privacy}","received_events_url":"https://api.github.com/users/StephanMusgrave/received_events","type":"User","site_admin":false},"repo":{"id":34387263,"name":"till_tech_test","full_name":"StephanMusgrave/till_tech_test","owner":{"login":"StephanMusgrave","id":7117842,"avatar_url":"https://avatars.githubusercontent.com/u/7117842?v=3","gravatar_id":"","url":"https://api.github.com/users/StephanMusgrave","html_url":"https://github.com/StephanMusgrave","followers_url":"https://api.github.com/users/StephanMusgrave/followers","following_url":"https://api.github.com/users/StephanMusgrave/following{/other_user}","gists_url":"https://api.github.com/users/StephanMusgrave/gists{/gist_id}","starred_url":"https://api.github.com/users/StephanMusgrave/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StephanMusgrave/subscriptions","organizations_url":"https://api.github.com/users/StephanMusgrave/orgs","repos_url":"https://api.github.com/users/StephanMusgrave/repos","events_url":"https://api.github.com/users/StephanMusgrave/events{/privacy}","received_events_url":"https://api.github.com/users/StephanMusgrave/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/StephanMusgrave/till_tech_test","description":"Hiring week tech test","fork":true,"url":"https://api.github.com/repos/StephanMusgrave/till_tech_test","forks_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/forks","keys_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/keys{/key_id}","collaborators_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/teams","hooks_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/hooks","issue_events_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/issues/events{/number}","events_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/events","assignees_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/assignees{/user}","branches_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/branches{/branch}","tags_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/tags","blobs_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/git/refs{/sha}","trees_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/git/trees{/sha}","statuses_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/statuses/{sha}","languages_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/languages","stargazers_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/stargazers","contributors_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/contributors","subscribers_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/subscribers","subscription_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/subscription","commits_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/commits{/sha}","git_commits_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/git/commits{/sha}","comments_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/comments{/number}","issue_comment_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/issues/comments{/number}","contents_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/contents/{+path}","compare_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/compare/{base}...{head}","merges_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/merges","archive_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/downloads","issues_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/issues{/number}","pulls_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/pulls{/number}","milestones_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/milestones{/number}","notifications_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/labels{/name}","releases_url":"https://api.github.com/repos/StephanMusgrave/till_tech_test/releases{/id}","created_at":"2015-04-22T11:47:11Z","updated_at":"2015-05-06T21:25:32Z","pushed_at":"2015-05-06T21:25:32Z","git_url":"git://github.com/StephanMusgrave/till_tech_test.git","ssh_url":"git@github.com:StephanMusgrave/till_tech_test.git","clone_url":"https://github.com/StephanMusgrave/till_tech_test.git","svn_url":"https://github.com/StephanMusgrave/till_tech_test","homepage":null,"size":261,"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":"59f80ec8841f9b3ad2ff42bd1354d80781ccfcfa","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":31914698,"name":"till_tech_test","full_name":"makersacademy/till_tech_test","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/till_tech_test","description":"Hiring week tech test","fork":false,"url":"https://api.github.com/repos/makersacademy/till_tech_test","forks_url":"https://api.github.com/repos/makersacademy/till_tech_test/forks","keys_url":"https://api.github.com/repos/makersacademy/till_tech_test/keys{/key_id}","collaborators_url":"https://api.github.com/repos/makersacademy/till_tech_test/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/makersacademy/till_tech_test/teams","hooks_url":"https://api.github.com/repos/makersacademy/till_tech_test/hooks","issue_events_url":"https://api.github.com/repos/makersacademy/till_tech_test/issues/events{/number}","events_url":"https://api.github.com/repos/makersacademy/till_tech_test/events","assignees_url":"https://api.github.com/repos/makersacademy/till_tech_test/assignees{/user}","branches_url":"https://api.github.com/repos/makersacademy/till_tech_test/branches{/branch}","tags_url":"https://api.github.com/repos/makersacademy/till_tech_test/tags","blobs_url":"https://api.github.com/repos/makersacademy/till_tech_test/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/makersacademy/till_tech_test/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/makersacademy/till_tech_test/git/refs{/sha}","trees_url":"https://api.github.com/repos/makersacademy/till_tech_test/git/trees{/sha}","statuses_url":"https://api.github.com/repos/makersacademy/till_tech_test/statuses/{sha}","languages_url":"https://api.github.com/repos/makersacademy/till_tech_test/languages","stargazers_url":"https://api.github.com/repos/makersacademy/till_tech_test/stargazers","contributors_url":"https://api.github.com/repos/makersacademy/till_tech_test/contributors","subscribers_url":"https://api.github.com/repos/makersacademy/till_tech_test/subscribers","subscription_url":"https://api.github.com/repos/makersacademy/till_tech_test/subscription","commits_url":"https://api.github.com/repos/makersacademy/till_tech_test/commits{/sha}","git_commits_url":"https://api.github.com/repos/makersacademy/till_tech_test/git/commits{/sha}","comments_url":"https://api.github.com/repos/makersacademy/till_tech_test/comments{/number}","issue_comment_url":"https://api.github.com/repos/makersacademy/till_tech_test/issues/comments{/number}","contents_url":"https://api.github.com/repos/makersacademy/till_tech_test/contents/{+path}","compare_url":"https://api.github.com/repos/makersacademy/till_tech_test/compare/{base}...{head}","merges_url":"https://api.github.com/repos/makersacademy/till_tech_test/merges","archive_url":"https://api.github.com/repos/makersacademy/till_tech_test/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/makersacademy/till_tech_test/downloads","issues_url":"https://api.github.com/repos/makersacademy/till_tech_test/issues{/number}","pulls_url":"https://api.github.com/repos/makersacademy/till_tech_test/pulls{/number}","milestones_url":"https://api.github.com/repos/makersacademy/till_tech_test/milestones{/number}","notifications_url":"https://api.github.com/repos/makersacademy/till_tech_test/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/makersacademy/till_tech_test/labels{/name}","releases_url":"https://api.github.com/repos/makersacademy/till_tech_test/releases{/id}","created_at":"2015-03-09T18:16:02Z","updated_at":"2015-03-09T18:30:54Z","pushed_at":"2015-05-06T21:25:32Z","git_url":"git://github.com/makersacademy/till_tech_test.git","ssh_url":"git@github.com:makersacademy/till_tech_test.git","clone_url":"https://github.com/makersacademy/till_tech_test.git","svn_url":"https://github.com/makersacademy/till_tech_test","homepage":null,"size":47585,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":26,"mirror_url":null,"open_issues_count":14,"forks":26,"open_issues":14,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/12"},"html":{"href":"https://github.com/makersacademy/till_tech_test/pull/12"},"issue":{"href":"https://api.github.com/repos/makersacademy/till_tech_test/issues/12"},"comments":{"href":"https://api.github.com/repos/makersacademy/till_tech_test/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/makersacademy/till_tech_test/statuses/f1d5f3f8d292be8ec73691f1d020d44dd41be178"}}}}