{"action":"created","comment":{"url":"https://api.github.com/repos/wagn/wikirate/pulls/comments/44396991","id":44396991,"diff_hunk":"@@ -0,0 +1,108 @@\n+\n+require File.expand_path('../../../config/environment',  __FILE__)\n+require 'colorize'\n+\n+if ARGV.length == 0\n+  puts \"Please include a file path\".red\n+  puts \"EX: ruby script/import_metric_value.rb \"\\\n+       \"script/metric/csv/metric_to_import.csv\".green\n+  exit\n+end\n+\n+Card::Env[:protocol] = \"http://\"\n+Card::Env[:host] = \"http://wikirate.org\"\n+Card::Auth.current_id = Card.fetch_id \"Richard Mills\"\n+Card::Auth.as_bot do\n+  source_cache = Hash.new\n+  csv_file_path = ARGV[0]\n+  puts \"CSV file to import : #{csv_file_path}\"\n+  CSV.foreach(csv_file_path, encoding: 'windows-1251:utf-8', headers: true,\n+    header_converters: :symbol, converters: :all) do |row|\n+    \n+    metric_name = row[:metric]\n+    company_name = row[:company_name]\n+    year = row[:year]\n+    value = row[:value]\n+    source_url = row[:source]\n+\n+    if !Card.exists? \"#{metric_name}+#{company_name}+#{year}\" \n+      if company_name.include?\"/\"\n+        puts \"Company name with /:\\t#{company_name}\"\n+        next\n+      end\n+      \n+      sources = Array.new\n+      if source_url.start_with?(\"[\")\n+        begin\n+          sources = JSON.parse(source_url)\n+          source_url = sources[0]\n+          sources = sources[1..-1]\n+        rescue JSON::ParserError => e\n+          puts \"fail to parse json\"\n+        end\n+      end\n+\n+      subcard = {\n+        \"+metric\"=>{\"content\"=>metric_name},\n+        \"+company\"=>{\n+                      \"content\"=>\"[[#{company_name}]]\",\n+                      :type_id=>Card::PointerID\n+                    },\n+        \"+value\"=>{\"content\"=>value.to_s, :type_id=>Card::PhraseID},\n+        \"+year\"=>{\"content\"=>year.to_s, :type_id=>Card::PointerID},\n+        \"+source\"=>{\n+          \"subcards\"=>{\n+            \"new source\"=>{\n+              \"+Link\"=>{\n+                \"content\"=>source_url,","path":"script/metric/step_5_import_metric_value.rb","position":57,"original_position":57,"commit_id":"b67d5780cdfd4d80a4a19b9975355ca8a5515efe","original_commit_id":"b67d5780cdfd4d80a4a19b9975355ca8a5515efe","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":"Surrounding space missing for operator `=>`.","created_at":"2015-11-10T11:44:04Z","updated_at":"2015-11-10T11:44:04Z","html_url":"https://github.com/wagn/wikirate/pull/277#discussion_r44396991","pull_request_url":"https://api.github.com/repos/wagn/wikirate/pulls/277","_links":{"self":{"href":"https://api.github.com/repos/wagn/wikirate/pulls/comments/44396991"},"html":{"href":"https://github.com/wagn/wikirate/pull/277#discussion_r44396991"},"pull_request":{"href":"https://api.github.com/repos/wagn/wikirate/pulls/277"}}},"pull_request":{"url":"https://api.github.com/repos/wagn/wikirate/pulls/277","id":50243941,"html_url":"https://github.com/wagn/wikirate/pull/277","diff_url":"https://github.com/wagn/wikirate/pull/277.diff","patch_url":"https://github.com/wagn/wikirate/pull/277.patch","issue_url":"https://api.github.com/repos/wagn/wikirate/issues/277","number":277,"state":"open","locked":false,"title":"merge master to demo","user":{"login":"chuenlok","id":1924561,"avatar_url":"https://avatars.githubusercontent.com/u/1924561?v=3","gravatar_id":"","url":"https://api.github.com/users/chuenlok","html_url":"https://github.com/chuenlok","followers_url":"https://api.github.com/users/chuenlok/followers","following_url":"https://api.github.com/users/chuenlok/following{/other_user}","gists_url":"https://api.github.com/users/chuenlok/gists{/gist_id}","starred_url":"https://api.github.com/users/chuenlok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chuenlok/subscriptions","organizations_url":"https://api.github.com/users/chuenlok/orgs","repos_url":"https://api.github.com/users/chuenlok/repos","events_url":"https://api.github.com/users/chuenlok/events{/privacy}","received_events_url":"https://api.github.com/users/chuenlok/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-11-10T11:43:46Z","updated_at":"2015-11-10T11:44:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a3d54aae992d06effb71fe3528e42aa24dbc6f34","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/wagn/wikirate/pulls/277/commits","review_comments_url":"https://api.github.com/repos/wagn/wikirate/pulls/277/comments","review_comment_url":"https://api.github.com/repos/wagn/wikirate/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wagn/wikirate/issues/277/comments","statuses_url":"https://api.github.com/repos/wagn/wikirate/statuses/b67d5780cdfd4d80a4a19b9975355ca8a5515efe","head":{"label":"wagn:master","ref":"master","sha":"b67d5780cdfd4d80a4a19b9975355ca8a5515efe","user":{"login":"wagn","id":20722,"avatar_url":"https://avatars.githubusercontent.com/u/20722?v=3","gravatar_id":"","url":"https://api.github.com/users/wagn","html_url":"https://github.com/wagn","followers_url":"https://api.github.com/users/wagn/followers","following_url":"https://api.github.com/users/wagn/following{/other_user}","gists_url":"https://api.github.com/users/wagn/gists{/gist_id}","starred_url":"https://api.github.com/users/wagn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wagn/subscriptions","organizations_url":"https://api.github.com/users/wagn/orgs","repos_url":"https://api.github.com/users/wagn/repos","events_url":"https://api.github.com/users/wagn/events{/privacy}","received_events_url":"https://api.github.com/users/wagn/received_events","type":"User","site_admin":false},"repo":{"id":15884166,"name":"wikirate","full_name":"wagn/wikirate","owner":{"login":"wagn","id":20722,"avatar_url":"https://avatars.githubusercontent.com/u/20722?v=3","gravatar_id":"","url":"https://api.github.com/users/wagn","html_url":"https://github.com/wagn","followers_url":"https://api.github.com/users/wagn/followers","following_url":"https://api.github.com/users/wagn/following{/other_user}","gists_url":"https://api.github.com/users/wagn/gists{/gist_id}","starred_url":"https://api.github.com/users/wagn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wagn/subscriptions","organizations_url":"https://api.github.com/users/wagn/orgs","repos_url":"https://api.github.com/users/wagn/repos","events_url":"https://api.github.com/users/wagn/events{/privacy}","received_events_url":"https://api.github.com/users/wagn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wagn/wikirate","description":"","fork":false,"url":"https://api.github.com/repos/wagn/wikirate","forks_url":"https://api.github.com/repos/wagn/wikirate/forks","keys_url":"https://api.github.com/repos/wagn/wikirate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wagn/wikirate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wagn/wikirate/teams","hooks_url":"https://api.github.com/repos/wagn/wikirate/hooks","issue_events_url":"https://api.github.com/repos/wagn/wikirate/issues/events{/number}","events_url":"https://api.github.com/repos/wagn/wikirate/events","assignees_url":"https://api.github.com/repos/wagn/wikirate/assignees{/user}","branches_url":"https://api.github.com/repos/wagn/wikirate/branches{/branch}","tags_url":"https://api.github.com/repos/wagn/wikirate/tags","blobs_url":"https://api.github.com/repos/wagn/wikirate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wagn/wikirate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wagn/wikirate/git/refs{/sha}","trees_url":"https://api.github.com/repos/wagn/wikirate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wagn/wikirate/statuses/{sha}","languages_url":"https://api.github.com/repos/wagn/wikirate/languages","stargazers_url":"https://api.github.com/repos/wagn/wikirate/stargazers","contributors_url":"https://api.github.com/repos/wagn/wikirate/contributors","subscribers_url":"https://api.github.com/repos/wagn/wikirate/subscribers","subscription_url":"https://api.github.com/repos/wagn/wikirate/subscription","commits_url":"https://api.github.com/repos/wagn/wikirate/commits{/sha}","git_commits_url":"https://api.github.com/repos/wagn/wikirate/git/commits{/sha}","comments_url":"https://api.github.com/repos/wagn/wikirate/comments{/number}","issue_comment_url":"https://api.github.com/repos/wagn/wikirate/issues/comments{/number}","contents_url":"https://api.github.com/repos/wagn/wikirate/contents/{+path}","compare_url":"https://api.github.com/repos/wagn/wikirate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wagn/wikirate/merges","archive_url":"https://api.github.com/repos/wagn/wikirate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wagn/wikirate/downloads","issues_url":"https://api.github.com/repos/wagn/wikirate/issues{/number}","pulls_url":"https://api.github.com/repos/wagn/wikirate/pulls{/number}","milestones_url":"https://api.github.com/repos/wagn/wikirate/milestones{/number}","notifications_url":"https://api.github.com/repos/wagn/wikirate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wagn/wikirate/labels{/name}","releases_url":"https://api.github.com/repos/wagn/wikirate/releases{/id}","created_at":"2014-01-13T22:29:39Z","updated_at":"2015-05-08T17:01:43Z","pushed_at":"2015-11-10T11:43:46Z","git_url":"git://github.com/wagn/wikirate.git","ssh_url":"git@github.com:wagn/wikirate.git","clone_url":"https://github.com/wagn/wikirate.git","svn_url":"https://github.com/wagn/wikirate","homepage":null,"size":87185,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":3,"forks":5,"open_issues":3,"watchers":2,"default_branch":"master"}},"base":{"label":"wagn:demo","ref":"demo","sha":"a6b2df23f3beab7a27581dc628f26e436737feaf","user":{"login":"wagn","id":20722,"avatar_url":"https://avatars.githubusercontent.com/u/20722?v=3","gravatar_id":"","url":"https://api.github.com/users/wagn","html_url":"https://github.com/wagn","followers_url":"https://api.github.com/users/wagn/followers","following_url":"https://api.github.com/users/wagn/following{/other_user}","gists_url":"https://api.github.com/users/wagn/gists{/gist_id}","starred_url":"https://api.github.com/users/wagn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wagn/subscriptions","organizations_url":"https://api.github.com/users/wagn/orgs","repos_url":"https://api.github.com/users/wagn/repos","events_url":"https://api.github.com/users/wagn/events{/privacy}","received_events_url":"https://api.github.com/users/wagn/received_events","type":"User","site_admin":false},"repo":{"id":15884166,"name":"wikirate","full_name":"wagn/wikirate","owner":{"login":"wagn","id":20722,"avatar_url":"https://avatars.githubusercontent.com/u/20722?v=3","gravatar_id":"","url":"https://api.github.com/users/wagn","html_url":"https://github.com/wagn","followers_url":"https://api.github.com/users/wagn/followers","following_url":"https://api.github.com/users/wagn/following{/other_user}","gists_url":"https://api.github.com/users/wagn/gists{/gist_id}","starred_url":"https://api.github.com/users/wagn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wagn/subscriptions","organizations_url":"https://api.github.com/users/wagn/orgs","repos_url":"https://api.github.com/users/wagn/repos","events_url":"https://api.github.com/users/wagn/events{/privacy}","received_events_url":"https://api.github.com/users/wagn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wagn/wikirate","description":"","fork":false,"url":"https://api.github.com/repos/wagn/wikirate","forks_url":"https://api.github.com/repos/wagn/wikirate/forks","keys_url":"https://api.github.com/repos/wagn/wikirate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wagn/wikirate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wagn/wikirate/teams","hooks_url":"https://api.github.com/repos/wagn/wikirate/hooks","issue_events_url":"https://api.github.com/repos/wagn/wikirate/issues/events{/number}","events_url":"https://api.github.com/repos/wagn/wikirate/events","assignees_url":"https://api.github.com/repos/wagn/wikirate/assignees{/user}","branches_url":"https://api.github.com/repos/wagn/wikirate/branches{/branch}","tags_url":"https://api.github.com/repos/wagn/wikirate/tags","blobs_url":"https://api.github.com/repos/wagn/wikirate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wagn/wikirate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wagn/wikirate/git/refs{/sha}","trees_url":"https://api.github.com/repos/wagn/wikirate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wagn/wikirate/statuses/{sha}","languages_url":"https://api.github.com/repos/wagn/wikirate/languages","stargazers_url":"https://api.github.com/repos/wagn/wikirate/stargazers","contributors_url":"https://api.github.com/repos/wagn/wikirate/contributors","subscribers_url":"https://api.github.com/repos/wagn/wikirate/subscribers","subscription_url":"https://api.github.com/repos/wagn/wikirate/subscription","commits_url":"https://api.github.com/repos/wagn/wikirate/commits{/sha}","git_commits_url":"https://api.github.com/repos/wagn/wikirate/git/commits{/sha}","comments_url":"https://api.github.com/repos/wagn/wikirate/comments{/number}","issue_comment_url":"https://api.github.com/repos/wagn/wikirate/issues/comments{/number}","contents_url":"https://api.github.com/repos/wagn/wikirate/contents/{+path}","compare_url":"https://api.github.com/repos/wagn/wikirate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wagn/wikirate/merges","archive_url":"https://api.github.com/repos/wagn/wikirate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wagn/wikirate/downloads","issues_url":"https://api.github.com/repos/wagn/wikirate/issues{/number}","pulls_url":"https://api.github.com/repos/wagn/wikirate/pulls{/number}","milestones_url":"https://api.github.com/repos/wagn/wikirate/milestones{/number}","notifications_url":"https://api.github.com/repos/wagn/wikirate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wagn/wikirate/labels{/name}","releases_url":"https://api.github.com/repos/wagn/wikirate/releases{/id}","created_at":"2014-01-13T22:29:39Z","updated_at":"2015-05-08T17:01:43Z","pushed_at":"2015-11-10T11:43:46Z","git_url":"git://github.com/wagn/wikirate.git","ssh_url":"git@github.com:wagn/wikirate.git","clone_url":"https://github.com/wagn/wikirate.git","svn_url":"https://github.com/wagn/wikirate","homepage":null,"size":87185,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":3,"forks":5,"open_issues":3,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wagn/wikirate/pulls/277"},"html":{"href":"https://github.com/wagn/wikirate/pull/277"},"issue":{"href":"https://api.github.com/repos/wagn/wikirate/issues/277"},"comments":{"href":"https://api.github.com/repos/wagn/wikirate/issues/277/comments"},"review_comments":{"href":"https://api.github.com/repos/wagn/wikirate/pulls/277/comments"},"review_comment":{"href":"https://api.github.com/repos/wagn/wikirate/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wagn/wikirate/pulls/277/commits"},"statuses":{"href":"https://api.github.com/repos/wagn/wikirate/statuses/b67d5780cdfd4d80a4a19b9975355ca8a5515efe"}}}}