{"action":"created","comment":{"url":"https://api.github.com/repos/ManageIQ/azure-armrest/pulls/comments/34509740","id":34509740,"diff_hunk":"@@ -209,14 +209,71 @@ def providers\n \n       # Returns information about the specific provider +namespace+.\n       #\n-      def provider_info(namespace)\n-        url = url_with_api_version(@base_url, 'providers', namespace)\n+      def provider_info(provider)\n+        url = url_with_api_version(@base_url, 'providers', provider)\n         response = rest_get(url)\n         JSON.parse(response.body)\n       end\n \n       alias geo_locations provider_info\n \n+      # Returns a list of all locations for all resource types of the given\n+      # +provider+. If you do not specify a provider, then the locations for\n+      # all providers will be returned.\n+      #\n+      # If you need individual details on a per-provider basis, use the\n+      # provider_info method instead.\n+      #--\n+      # TODO: I think a 7-day cache may be wise here as the overall list of\n+      # locations is unlikely to change from day to day.\n+      #\n+      def locations(provider = nil)\n+        array = []\n+\n+        if provider\n+          info = provider_info(provider)\n+          info['resourceTypes'].map{ |rt| array << rt['locations'] }\n+        else\n+          threads = []\n+\n+          providers.each do |provider_hash|\n+            provider = provider_hash['namespace']\n+            threads << Thread.new{\n+              info = provider_info(provider)\n+              info['resourceTypes'].map{ |rt| array << rt['locations'] }\n+            }\n+          end\n+\n+          threads.each(&:join)\n+        end\n+\n+        array.flatten!\n+        array.uniq!\n+        array.delete(\"\") # Seems to pickup blank elements for some reason.\n+\n+        array\n+      end\n+\n+      # Returns an array of publishers for the given +region+ and +provider+,\n+      # or \"Microsoft.Compute\" if no provider is given.\n+      #\n+      # Examples:\n+      #\n+      #   arm.publishers('eastus')\n+      #   arm.publishers('eastus', 'Microsoft.ClassicCompute')\n+      #\n+      def publishers(region, provider = 'Microsoft.Compute', subscription_id = @subscription_id)\n+        @api_version = '2015-06-15'","path":"lib/azure/armrest/armrest_manager.rb","position":60,"original_position":60,"commit_id":"bcbc4b37da979e709c721103b5b28fc0fcd2de4b","original_commit_id":"bcbc4b37da979e709c721103b5b28fc0fcd2de4b","user":{"login":"djberg96","id":78529,"avatar_url":"https://avatars.githubusercontent.com/u/78529?v=3","gravatar_id":"","url":"https://api.github.com/users/djberg96","html_url":"https://github.com/djberg96","followers_url":"https://api.github.com/users/djberg96/followers","following_url":"https://api.github.com/users/djberg96/following{/other_user}","gists_url":"https://api.github.com/users/djberg96/gists{/gist_id}","starred_url":"https://api.github.com/users/djberg96/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djberg96/subscriptions","organizations_url":"https://api.github.com/users/djberg96/orgs","repos_url":"https://api.github.com/users/djberg96/repos","events_url":"https://api.github.com/users/djberg96/events{/privacy}","received_events_url":"https://api.github.com/users/djberg96/received_events","type":"User","site_admin":false},"body":"Putting what in a const var? The default provider?","created_at":"2015-07-13T20:48:14Z","updated_at":"2015-07-13T20:48:14Z","html_url":"https://github.com/ManageIQ/azure-armrest/pull/32#discussion_r34509740","pull_request_url":"https://api.github.com/repos/ManageIQ/azure-armrest/pulls/32","_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/azure-armrest/pulls/comments/34509740"},"html":{"href":"https://github.com/ManageIQ/azure-armrest/pull/32#discussion_r34509740"},"pull_request":{"href":"https://api.github.com/repos/ManageIQ/azure-armrest/pulls/32"}}},"pull_request":{"url":"https://api.github.com/repos/ManageIQ/azure-armrest/pulls/32","id":39716560,"html_url":"https://github.com/ManageIQ/azure-armrest/pull/32","diff_url":"https://github.com/ManageIQ/azure-armrest/pull/32.diff","patch_url":"https://github.com/ManageIQ/azure-armrest/pull/32.patch","issue_url":"https://api.github.com/repos/ManageIQ/azure-armrest/issues/32","number":32,"state":"open","locked":false,"title":"Add locations and publishers methods","user":{"login":"djberg96","id":78529,"avatar_url":"https://avatars.githubusercontent.com/u/78529?v=3","gravatar_id":"","url":"https://api.github.com/users/djberg96","html_url":"https://github.com/djberg96","followers_url":"https://api.github.com/users/djberg96/followers","following_url":"https://api.github.com/users/djberg96/following{/other_user}","gists_url":"https://api.github.com/users/djberg96/gists{/gist_id}","starred_url":"https://api.github.com/users/djberg96/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djberg96/subscriptions","organizations_url":"https://api.github.com/users/djberg96/orgs","repos_url":"https://api.github.com/users/djberg96/repos","events_url":"https://api.github.com/users/djberg96/events{/privacy}","received_events_url":"https://api.github.com/users/djberg96/received_events","type":"User","site_admin":false},"body":"This adds two new methods, locations and publishers. The locations method returns just a plain array of locations, either on a per-provider basis or the locations for all providers. The publishers method returns a list of publishers (in the form of JSON objects), which can be narrowed by provider and region.","created_at":"2015-07-10T19:30:24Z","updated_at":"2015-07-13T20:48:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"27072557fbb3ae6693e7f83625ac945077ad485e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ManageIQ/azure-armrest/pulls/32/commits","review_comments_url":"https://api.github.com/repos/ManageIQ/azure-armrest/pulls/32/comments","review_comment_url":"https://api.github.com/repos/ManageIQ/azure-armrest/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ManageIQ/azure-armrest/issues/32/comments","statuses_url":"https://api.github.com/repos/ManageIQ/azure-armrest/statuses/bcbc4b37da979e709c721103b5b28fc0fcd2de4b","head":{"label":"djberg96:api_tweaks","ref":"api_tweaks","sha":"bcbc4b37da979e709c721103b5b28fc0fcd2de4b","user":{"login":"djberg96","id":78529,"avatar_url":"https://avatars.githubusercontent.com/u/78529?v=3","gravatar_id":"","url":"https://api.github.com/users/djberg96","html_url":"https://github.com/djberg96","followers_url":"https://api.github.com/users/djberg96/followers","following_url":"https://api.github.com/users/djberg96/following{/other_user}","gists_url":"https://api.github.com/users/djberg96/gists{/gist_id}","starred_url":"https://api.github.com/users/djberg96/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djberg96/subscriptions","organizations_url":"https://api.github.com/users/djberg96/orgs","repos_url":"https://api.github.com/users/djberg96/repos","events_url":"https://api.github.com/users/djberg96/events{/privacy}","received_events_url":"https://api.github.com/users/djberg96/received_events","type":"User","site_admin":false},"repo":{"id":37276845,"name":"azure-armrest","full_name":"djberg96/azure-armrest","owner":{"login":"djberg96","id":78529,"avatar_url":"https://avatars.githubusercontent.com/u/78529?v=3","gravatar_id":"","url":"https://api.github.com/users/djberg96","html_url":"https://github.com/djberg96","followers_url":"https://api.github.com/users/djberg96/followers","following_url":"https://api.github.com/users/djberg96/following{/other_user}","gists_url":"https://api.github.com/users/djberg96/gists{/gist_id}","starred_url":"https://api.github.com/users/djberg96/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djberg96/subscriptions","organizations_url":"https://api.github.com/users/djberg96/orgs","repos_url":"https://api.github.com/users/djberg96/repos","events_url":"https://api.github.com/users/djberg96/events{/privacy}","received_events_url":"https://api.github.com/users/djberg96/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/djberg96/azure-armrest","description":"Ruby interface for Azure using the new REST API","fork":true,"url":"https://api.github.com/repos/djberg96/azure-armrest","forks_url":"https://api.github.com/repos/djberg96/azure-armrest/forks","keys_url":"https://api.github.com/repos/djberg96/azure-armrest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/djberg96/azure-armrest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/djberg96/azure-armrest/teams","hooks_url":"https://api.github.com/repos/djberg96/azure-armrest/hooks","issue_events_url":"https://api.github.com/repos/djberg96/azure-armrest/issues/events{/number}","events_url":"https://api.github.com/repos/djberg96/azure-armrest/events","assignees_url":"https://api.github.com/repos/djberg96/azure-armrest/assignees{/user}","branches_url":"https://api.github.com/repos/djberg96/azure-armrest/branches{/branch}","tags_url":"https://api.github.com/repos/djberg96/azure-armrest/tags","blobs_url":"https://api.github.com/repos/djberg96/azure-armrest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/djberg96/azure-armrest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/djberg96/azure-armrest/git/refs{/sha}","trees_url":"https://api.github.com/repos/djberg96/azure-armrest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/djberg96/azure-armrest/statuses/{sha}","languages_url":"https://api.github.com/repos/djberg96/azure-armrest/languages","stargazers_url":"https://api.github.com/repos/djberg96/azure-armrest/stargazers","contributors_url":"https://api.github.com/repos/djberg96/azure-armrest/contributors","subscribers_url":"https://api.github.com/repos/djberg96/azure-armrest/subscribers","subscription_url":"https://api.github.com/repos/djberg96/azure-armrest/subscription","commits_url":"https://api.github.com/repos/djberg96/azure-armrest/commits{/sha}","git_commits_url":"https://api.github.com/repos/djberg96/azure-armrest/git/commits{/sha}","comments_url":"https://api.github.com/repos/djberg96/azure-armrest/comments{/number}","issue_comment_url":"https://api.github.com/repos/djberg96/azure-armrest/issues/comments{/number}","contents_url":"https://api.github.com/repos/djberg96/azure-armrest/contents/{+path}","compare_url":"https://api.github.com/repos/djberg96/azure-armrest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/djberg96/azure-armrest/merges","archive_url":"https://api.github.com/repos/djberg96/azure-armrest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/djberg96/azure-armrest/downloads","issues_url":"https://api.github.com/repos/djberg96/azure-armrest/issues{/number}","pulls_url":"https://api.github.com/repos/djberg96/azure-armrest/pulls{/number}","milestones_url":"https://api.github.com/repos/djberg96/azure-armrest/milestones{/number}","notifications_url":"https://api.github.com/repos/djberg96/azure-armrest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/djberg96/azure-armrest/labels{/name}","releases_url":"https://api.github.com/repos/djberg96/azure-armrest/releases{/id}","created_at":"2015-06-11T17:55:30Z","updated_at":"2015-06-11T17:55:30Z","pushed_at":"2015-07-13T19:42:42Z","git_url":"git://github.com/djberg96/azure-armrest.git","ssh_url":"git@github.com:djberg96/azure-armrest.git","clone_url":"https://github.com/djberg96/azure-armrest.git","svn_url":"https://github.com/djberg96/azure-armrest","homepage":null,"size":213,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"ManageIQ:master","ref":"master","sha":"68dd1840022d60c1e7a1a7a770d6bb300594e542","user":{"login":"ManageIQ","id":1125575,"avatar_url":"https://avatars.githubusercontent.com/u/1125575?v=3","gravatar_id":"","url":"https://api.github.com/users/ManageIQ","html_url":"https://github.com/ManageIQ","followers_url":"https://api.github.com/users/ManageIQ/followers","following_url":"https://api.github.com/users/ManageIQ/following{/other_user}","gists_url":"https://api.github.com/users/ManageIQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ManageIQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManageIQ/subscriptions","organizations_url":"https://api.github.com/users/ManageIQ/orgs","repos_url":"https://api.github.com/users/ManageIQ/repos","events_url":"https://api.github.com/users/ManageIQ/events{/privacy}","received_events_url":"https://api.github.com/users/ManageIQ/received_events","type":"Organization","site_admin":false},"repo":{"id":35620488,"name":"azure-armrest","full_name":"ManageIQ/azure-armrest","owner":{"login":"ManageIQ","id":1125575,"avatar_url":"https://avatars.githubusercontent.com/u/1125575?v=3","gravatar_id":"","url":"https://api.github.com/users/ManageIQ","html_url":"https://github.com/ManageIQ","followers_url":"https://api.github.com/users/ManageIQ/followers","following_url":"https://api.github.com/users/ManageIQ/following{/other_user}","gists_url":"https://api.github.com/users/ManageIQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ManageIQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManageIQ/subscriptions","organizations_url":"https://api.github.com/users/ManageIQ/orgs","repos_url":"https://api.github.com/users/ManageIQ/repos","events_url":"https://api.github.com/users/ManageIQ/events{/privacy}","received_events_url":"https://api.github.com/users/ManageIQ/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ManageIQ/azure-armrest","description":"Ruby interface for Azure using the new REST API","fork":false,"url":"https://api.github.com/repos/ManageIQ/azure-armrest","forks_url":"https://api.github.com/repos/ManageIQ/azure-armrest/forks","keys_url":"https://api.github.com/repos/ManageIQ/azure-armrest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ManageIQ/azure-armrest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ManageIQ/azure-armrest/teams","hooks_url":"https://api.github.com/repos/ManageIQ/azure-armrest/hooks","issue_events_url":"https://api.github.com/repos/ManageIQ/azure-armrest/issues/events{/number}","events_url":"https://api.github.com/repos/ManageIQ/azure-armrest/events","assignees_url":"https://api.github.com/repos/ManageIQ/azure-armrest/assignees{/user}","branches_url":"https://api.github.com/repos/ManageIQ/azure-armrest/branches{/branch}","tags_url":"https://api.github.com/repos/ManageIQ/azure-armrest/tags","blobs_url":"https://api.github.com/repos/ManageIQ/azure-armrest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ManageIQ/azure-armrest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ManageIQ/azure-armrest/git/refs{/sha}","trees_url":"https://api.github.com/repos/ManageIQ/azure-armrest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ManageIQ/azure-armrest/statuses/{sha}","languages_url":"https://api.github.com/repos/ManageIQ/azure-armrest/languages","stargazers_url":"https://api.github.com/repos/ManageIQ/azure-armrest/stargazers","contributors_url":"https://api.github.com/repos/ManageIQ/azure-armrest/contributors","subscribers_url":"https://api.github.com/repos/ManageIQ/azure-armrest/subscribers","subscription_url":"https://api.github.com/repos/ManageIQ/azure-armrest/subscription","commits_url":"https://api.github.com/repos/ManageIQ/azure-armrest/commits{/sha}","git_commits_url":"https://api.github.com/repos/ManageIQ/azure-armrest/git/commits{/sha}","comments_url":"https://api.github.com/repos/ManageIQ/azure-armrest/comments{/number}","issue_comment_url":"https://api.github.com/repos/ManageIQ/azure-armrest/issues/comments{/number}","contents_url":"https://api.github.com/repos/ManageIQ/azure-armrest/contents/{+path}","compare_url":"https://api.github.com/repos/ManageIQ/azure-armrest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ManageIQ/azure-armrest/merges","archive_url":"https://api.github.com/repos/ManageIQ/azure-armrest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ManageIQ/azure-armrest/downloads","issues_url":"https://api.github.com/repos/ManageIQ/azure-armrest/issues{/number}","pulls_url":"https://api.github.com/repos/ManageIQ/azure-armrest/pulls{/number}","milestones_url":"https://api.github.com/repos/ManageIQ/azure-armrest/milestones{/number}","notifications_url":"https://api.github.com/repos/ManageIQ/azure-armrest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ManageIQ/azure-armrest/labels{/name}","releases_url":"https://api.github.com/repos/ManageIQ/azure-armrest/releases{/id}","created_at":"2015-05-14T15:51:27Z","updated_at":"2015-06-11T17:52:00Z","pushed_at":"2015-07-13T19:43:16Z","git_url":"git://github.com/ManageIQ/azure-armrest.git","ssh_url":"git@github.com:ManageIQ/azure-armrest.git","clone_url":"https://github.com/ManageIQ/azure-armrest.git","svn_url":"https://github.com/ManageIQ/azure-armrest","homepage":null,"size":388,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":4,"forks":5,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/azure-armrest/pulls/32"},"html":{"href":"https://github.com/ManageIQ/azure-armrest/pull/32"},"issue":{"href":"https://api.github.com/repos/ManageIQ/azure-armrest/issues/32"},"comments":{"href":"https://api.github.com/repos/ManageIQ/azure-armrest/issues/32/comments"},"review_comments":{"href":"https://api.github.com/repos/ManageIQ/azure-armrest/pulls/32/comments"},"review_comment":{"href":"https://api.github.com/repos/ManageIQ/azure-armrest/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ManageIQ/azure-armrest/pulls/32/commits"},"statuses":{"href":"https://api.github.com/repos/ManageIQ/azure-armrest/statuses/bcbc4b37da979e709c721103b5b28fc0fcd2de4b"}}}}