{"action":"created","comment":{"url":"https://api.github.com/repos/PredicSis/mp_revision_observer/pulls/comments/60874360","id":60874360,"diff_hunk":"@@ -1,14 +1,47 @@\n class InstancesController < ApplicationController\n-  def index\n-    @versions = get_version\n-  end\n \n-  def get_version\n-    conn = Faraday.new(:url => 'http://model-producer-dev.sandicsis.net')\n+  #Method will later be moved to module. Parsing urls with Faraday.\n+  def call(env_url)\n+    conn = Faraday.new(:url => env_url) # Prendre l'url d'un environement\n     conn.adapter Faraday.default_adapter\n     conn.response :json\n \n-    response = conn.get '/versions.json'\n+    response = conn.get  # Parser l'url\n     response.body\n   end\n+\n+  #Récuperer les environements et utiliser la fonction sur chaque env (parser les url pour avoir un array)\n+  def index\n+    envs = Environment.where.not('url' => nil) #Array (du modele) d'objets de type environnement.\n+    @envs = envs\n+\n+    @app = Hash.new #Creer une hashmap qui stockera le nom des applications associées aux versions\n+\n+    envs.each do |e|  #Creer iteration avec un nom pour la variable locale\n+      result = call(e.url)#Mettre le résultat dans une nouvelle variable. Returning parsed list of URLs =Json objects (Json objects= hashmap).\n+\n+      result.each do |n|\n+\n+        @app[n[\"name\"]] ||= {} #Create hash if key not present. If key is present, leave hash unchanged.\n+        env_to_app =  @app[n[\"name\"]]","path":"app/controllers/instances_controller.rb","position":32,"original_position":32,"commit_id":"0e76a730f22d9f95b4d708956eb5fb863ebc9573","original_commit_id":"0e76a730f22d9f95b4d708956eb5fb863ebc9573","user":{"login":"ArmandPredicSis","id":6143928,"avatar_url":"https://avatars.githubusercontent.com/u/6143928?v=3","gravatar_id":"","url":"https://api.github.com/users/ArmandPredicSis","html_url":"https://github.com/ArmandPredicSis","followers_url":"https://api.github.com/users/ArmandPredicSis/followers","following_url":"https://api.github.com/users/ArmandPredicSis/following{/other_user}","gists_url":"https://api.github.com/users/ArmandPredicSis/gists{/gist_id}","starred_url":"https://api.github.com/users/ArmandPredicSis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArmandPredicSis/subscriptions","organizations_url":"https://api.github.com/users/ArmandPredicSis/orgs","repos_url":"https://api.github.com/users/ArmandPredicSis/repos","events_url":"https://api.github.com/users/ArmandPredicSis/events{/privacy}","received_events_url":"https://api.github.com/users/ArmandPredicSis/received_events","type":"User","site_admin":false},"body":"Unecessary assignment.","created_at":"2016-04-25T08:04:02Z","updated_at":"2016-04-25T08:04:02Z","html_url":"https://github.com/PredicSis/mp_revision_observer/pull/3#discussion_r60874360","pull_request_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/PredicSis/mp_revision_observer/pulls/comments/60874360"},"html":{"href":"https://github.com/PredicSis/mp_revision_observer/pull/3#discussion_r60874360"},"pull_request":{"href":"https://api.github.com/repos/PredicSis/mp_revision_observer/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/PredicSis/mp_revision_observer/pulls/3","id":67222232,"html_url":"https://github.com/PredicSis/mp_revision_observer/pull/3","diff_url":"https://github.com/PredicSis/mp_revision_observer/pull/3.diff","patch_url":"https://github.com/PredicSis/mp_revision_observer/pull/3.patch","issue_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/issues/3","number":3,"state":"open","locked":false,"title":"Dynamic environment versions support","user":{"login":"La-Pulga","id":18057001,"avatar_url":"https://avatars.githubusercontent.com/u/18057001?v=3","gravatar_id":"","url":"https://api.github.com/users/La-Pulga","html_url":"https://github.com/La-Pulga","followers_url":"https://api.github.com/users/La-Pulga/followers","following_url":"https://api.github.com/users/La-Pulga/following{/other_user}","gists_url":"https://api.github.com/users/La-Pulga/gists{/gist_id}","starred_url":"https://api.github.com/users/La-Pulga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/La-Pulga/subscriptions","organizations_url":"https://api.github.com/users/La-Pulga/orgs","repos_url":"https://api.github.com/users/La-Pulga/repos","events_url":"https://api.github.com/users/La-Pulga/events{/privacy}","received_events_url":"https://api.github.com/users/La-Pulga/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-04-20T16:56:25Z","updated_at":"2016-04-25T08:04:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4202b24d2dc5eb7ea27dd82e96eadbfd6229aeec","assignee":{"login":"bmurzeau","id":1092772,"avatar_url":"https://avatars.githubusercontent.com/u/1092772?v=3","gravatar_id":"","url":"https://api.github.com/users/bmurzeau","html_url":"https://github.com/bmurzeau","followers_url":"https://api.github.com/users/bmurzeau/followers","following_url":"https://api.github.com/users/bmurzeau/following{/other_user}","gists_url":"https://api.github.com/users/bmurzeau/gists{/gist_id}","starred_url":"https://api.github.com/users/bmurzeau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmurzeau/subscriptions","organizations_url":"https://api.github.com/users/bmurzeau/orgs","repos_url":"https://api.github.com/users/bmurzeau/repos","events_url":"https://api.github.com/users/bmurzeau/events{/privacy}","received_events_url":"https://api.github.com/users/bmurzeau/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/pulls/3/commits","review_comments_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/pulls/3/comments","review_comment_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/issues/3/comments","statuses_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/statuses/0e76a730f22d9f95b4d708956eb5fb863ebc9573","head":{"label":"PredicSis:tp-versions","ref":"tp-versions","sha":"0e76a730f22d9f95b4d708956eb5fb863ebc9573","user":{"login":"PredicSis","id":6170002,"avatar_url":"https://avatars.githubusercontent.com/u/6170002?v=3","gravatar_id":"","url":"https://api.github.com/users/PredicSis","html_url":"https://github.com/PredicSis","followers_url":"https://api.github.com/users/PredicSis/followers","following_url":"https://api.github.com/users/PredicSis/following{/other_user}","gists_url":"https://api.github.com/users/PredicSis/gists{/gist_id}","starred_url":"https://api.github.com/users/PredicSis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PredicSis/subscriptions","organizations_url":"https://api.github.com/users/PredicSis/orgs","repos_url":"https://api.github.com/users/PredicSis/repos","events_url":"https://api.github.com/users/PredicSis/events{/privacy}","received_events_url":"https://api.github.com/users/PredicSis/received_events","type":"Organization","site_admin":false},"repo":{"id":55709732,"name":"mp_revision_observer","full_name":"PredicSis/mp_revision_observer","owner":{"login":"PredicSis","id":6170002,"avatar_url":"https://avatars.githubusercontent.com/u/6170002?v=3","gravatar_id":"","url":"https://api.github.com/users/PredicSis","html_url":"https://github.com/PredicSis","followers_url":"https://api.github.com/users/PredicSis/followers","following_url":"https://api.github.com/users/PredicSis/following{/other_user}","gists_url":"https://api.github.com/users/PredicSis/gists{/gist_id}","starred_url":"https://api.github.com/users/PredicSis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PredicSis/subscriptions","organizations_url":"https://api.github.com/users/PredicSis/orgs","repos_url":"https://api.github.com/users/PredicSis/repos","events_url":"https://api.github.com/users/PredicSis/events{/privacy}","received_events_url":"https://api.github.com/users/PredicSis/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PredicSis/mp_revision_observer","description":"","fork":false,"url":"https://api.github.com/repos/PredicSis/mp_revision_observer","forks_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/forks","keys_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/teams","hooks_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/hooks","issue_events_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/issues/events{/number}","events_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/events","assignees_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/assignees{/user}","branches_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/branches{/branch}","tags_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/tags","blobs_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/git/refs{/sha}","trees_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/statuses/{sha}","languages_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/languages","stargazers_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/stargazers","contributors_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/contributors","subscribers_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/subscribers","subscription_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/subscription","commits_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/commits{/sha}","git_commits_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/git/commits{/sha}","comments_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/comments{/number}","issue_comment_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/issues/comments{/number}","contents_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/contents/{+path}","compare_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/merges","archive_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/downloads","issues_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/issues{/number}","pulls_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/pulls{/number}","milestones_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/milestones{/number}","notifications_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/labels{/name}","releases_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/releases{/id}","deployments_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/deployments","created_at":"2016-04-07T16:20:26Z","updated_at":"2016-04-08T11:02:31Z","pushed_at":"2016-04-22T15:59:45Z","git_url":"git://github.com/PredicSis/mp_revision_observer.git","ssh_url":"git@github.com:PredicSis/mp_revision_observer.git","clone_url":"https://github.com/PredicSis/mp_revision_observer.git","svn_url":"https://github.com/PredicSis/mp_revision_observer","homepage":null,"size":44,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"PredicSis:master","ref":"master","sha":"8116c4ec08c17380e89ea93e69e06b1948af9df0","user":{"login":"PredicSis","id":6170002,"avatar_url":"https://avatars.githubusercontent.com/u/6170002?v=3","gravatar_id":"","url":"https://api.github.com/users/PredicSis","html_url":"https://github.com/PredicSis","followers_url":"https://api.github.com/users/PredicSis/followers","following_url":"https://api.github.com/users/PredicSis/following{/other_user}","gists_url":"https://api.github.com/users/PredicSis/gists{/gist_id}","starred_url":"https://api.github.com/users/PredicSis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PredicSis/subscriptions","organizations_url":"https://api.github.com/users/PredicSis/orgs","repos_url":"https://api.github.com/users/PredicSis/repos","events_url":"https://api.github.com/users/PredicSis/events{/privacy}","received_events_url":"https://api.github.com/users/PredicSis/received_events","type":"Organization","site_admin":false},"repo":{"id":55709732,"name":"mp_revision_observer","full_name":"PredicSis/mp_revision_observer","owner":{"login":"PredicSis","id":6170002,"avatar_url":"https://avatars.githubusercontent.com/u/6170002?v=3","gravatar_id":"","url":"https://api.github.com/users/PredicSis","html_url":"https://github.com/PredicSis","followers_url":"https://api.github.com/users/PredicSis/followers","following_url":"https://api.github.com/users/PredicSis/following{/other_user}","gists_url":"https://api.github.com/users/PredicSis/gists{/gist_id}","starred_url":"https://api.github.com/users/PredicSis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PredicSis/subscriptions","organizations_url":"https://api.github.com/users/PredicSis/orgs","repos_url":"https://api.github.com/users/PredicSis/repos","events_url":"https://api.github.com/users/PredicSis/events{/privacy}","received_events_url":"https://api.github.com/users/PredicSis/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PredicSis/mp_revision_observer","description":"","fork":false,"url":"https://api.github.com/repos/PredicSis/mp_revision_observer","forks_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/forks","keys_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/teams","hooks_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/hooks","issue_events_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/issues/events{/number}","events_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/events","assignees_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/assignees{/user}","branches_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/branches{/branch}","tags_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/tags","blobs_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/git/refs{/sha}","trees_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/statuses/{sha}","languages_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/languages","stargazers_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/stargazers","contributors_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/contributors","subscribers_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/subscribers","subscription_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/subscription","commits_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/commits{/sha}","git_commits_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/git/commits{/sha}","comments_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/comments{/number}","issue_comment_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/issues/comments{/number}","contents_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/contents/{+path}","compare_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/merges","archive_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/downloads","issues_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/issues{/number}","pulls_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/pulls{/number}","milestones_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/milestones{/number}","notifications_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/labels{/name}","releases_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/releases{/id}","deployments_url":"https://api.github.com/repos/PredicSis/mp_revision_observer/deployments","created_at":"2016-04-07T16:20:26Z","updated_at":"2016-04-08T11:02:31Z","pushed_at":"2016-04-22T15:59:45Z","git_url":"git://github.com/PredicSis/mp_revision_observer.git","ssh_url":"git@github.com:PredicSis/mp_revision_observer.git","clone_url":"https://github.com/PredicSis/mp_revision_observer.git","svn_url":"https://github.com/PredicSis/mp_revision_observer","homepage":null,"size":44,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/PredicSis/mp_revision_observer/pulls/3"},"html":{"href":"https://github.com/PredicSis/mp_revision_observer/pull/3"},"issue":{"href":"https://api.github.com/repos/PredicSis/mp_revision_observer/issues/3"},"comments":{"href":"https://api.github.com/repos/PredicSis/mp_revision_observer/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/PredicSis/mp_revision_observer/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/PredicSis/mp_revision_observer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PredicSis/mp_revision_observer/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/PredicSis/mp_revision_observer/statuses/0e76a730f22d9f95b4d708956eb5fb863ebc9573"}}}}