{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/pulls/comments/33469174","id":33469174,"diff_hunk":"@@ -0,0 +1,200 @@\n+#--\n+# Copyright 2015 Google Inc. All rights reserved.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+#     http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+require \"gcloud/version\"\n+require \"google/api_client\"\n+\n+module Gcloud\n+  module Bigquery\n+    ##\n+    # Represents the connection to Bigquery,\n+    # as well as expose the API calls.\n+    class Connection #:nodoc:\n+      API_VERSION = \"v2\"\n+\n+      attr_accessor :project\n+      attr_accessor :credentials #:nodoc:\n+\n+      ##\n+      # Creates a new Connection instance.\n+      def initialize project, credentials\n+        @project = project\n+        @credentials = credentials\n+        @client = Google::APIClient.new application_name:    \"gcloud-ruby\",\n+                                        application_version: Gcloud::VERSION\n+        @client.authorization = @credentials.client\n+        @bigquery = @client.discovered_api \"bigquery\", API_VERSION\n+      end\n+\n+      ##\n+      # Lists all datasets in the specified project to which you have\n+      # been granted the READER dataset role.\n+      def list_datasets options = {}\n+        params = { projectId: @project,\n+                   all: options.delete(:all),\n+                   pageToken: options.delete(:token),\n+                   maxResults: options.delete(:max)\n+                 }.delete_if { |_, v| v.nil? }\n+\n+        @client.execute(\n+          api_method: @bigquery.datasets.list,\n+          parameters: params\n+        )\n+      end\n+\n+      ##\n+      # Returns the dataset specified by datasetID.\n+      def get_dataset dataset_id\n+        @client.execute(\n+          api_method: @bigquery.datasets.get,\n+          parameters: { projectId: @project, datasetId: dataset_id }\n+        )\n+      end\n+\n+      ##\n+      # Creates a new empty dataset.\n+      def insert_dataset options = {}","path":"lib/gcloud/bigquery/connection.rb","position":68,"original_position":68,"commit_id":"40db4a25bf0d655c84dd07a9c658b92b822d43fc","original_commit_id":"40db4a25bf0d655c84dd07a9c658b92b822d43fc","user":{"login":"jgeewax","id":112928,"avatar_url":"https://avatars.githubusercontent.com/u/112928?v=3","gravatar_id":"","url":"https://api.github.com/users/jgeewax","html_url":"https://github.com/jgeewax","followers_url":"https://api.github.com/users/jgeewax/followers","following_url":"https://api.github.com/users/jgeewax/following{/other_user}","gists_url":"https://api.github.com/users/jgeewax/gists{/gist_id}","starred_url":"https://api.github.com/users/jgeewax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgeewax/subscriptions","organizations_url":"https://api.github.com/users/jgeewax/orgs","repos_url":"https://api.github.com/users/jgeewax/repos","events_url":"https://api.github.com/users/jgeewax/events{/privacy}","received_events_url":"https://api.github.com/users/jgeewax/received_events","type":"User","site_admin":false},"body":"I know the API method is called \"insert\", but doesn't \"create\" make more sense?","created_at":"2015-06-29T14:30:05Z","updated_at":"2015-06-29T14:30:05Z","html_url":"https://github.com/GoogleCloudPlatform/gcloud-ruby/pull/176#discussion_r33469174","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/pulls/176","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/pulls/comments/33469174"},"html":{"href":"https://github.com/GoogleCloudPlatform/gcloud-ruby/pull/176#discussion_r33469174"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/pulls/176"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/pulls/176","id":38777049,"html_url":"https://github.com/GoogleCloudPlatform/gcloud-ruby/pull/176","diff_url":"https://github.com/GoogleCloudPlatform/gcloud-ruby/pull/176.diff","patch_url":"https://github.com/GoogleCloudPlatform/gcloud-ruby/pull/176.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/issues/176","number":176,"state":"open","locked":false,"title":"Add Bigquery","user":{"login":"blowmage","id":730,"avatar_url":"https://avatars.githubusercontent.com/u/730?v=3","gravatar_id":"","url":"https://api.github.com/users/blowmage","html_url":"https://github.com/blowmage","followers_url":"https://api.github.com/users/blowmage/followers","following_url":"https://api.github.com/users/blowmage/following{/other_user}","gists_url":"https://api.github.com/users/blowmage/gists{/gist_id}","starred_url":"https://api.github.com/users/blowmage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blowmage/subscriptions","organizations_url":"https://api.github.com/users/blowmage/orgs","repos_url":"https://api.github.com/users/blowmage/repos","events_url":"https://api.github.com/users/blowmage/events{/privacy}","received_events_url":"https://api.github.com/users/blowmage/received_events","type":"User","site_admin":false},"body":"Work in progress for Bigquery...","created_at":"2015-06-29T14:07:49Z","updated_at":"2015-06-29T14:30:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bc282863f415736251f8ac263cb9592c47c061a4","assignee":{"login":"blowmage","id":730,"avatar_url":"https://avatars.githubusercontent.com/u/730?v=3","gravatar_id":"","url":"https://api.github.com/users/blowmage","html_url":"https://github.com/blowmage","followers_url":"https://api.github.com/users/blowmage/followers","following_url":"https://api.github.com/users/blowmage/following{/other_user}","gists_url":"https://api.github.com/users/blowmage/gists{/gist_id}","starred_url":"https://api.github.com/users/blowmage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blowmage/subscriptions","organizations_url":"https://api.github.com/users/blowmage/orgs","repos_url":"https://api.github.com/users/blowmage/repos","events_url":"https://api.github.com/users/blowmage/events{/privacy}","received_events_url":"https://api.github.com/users/blowmage/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/pulls/176/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/pulls/176/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/issues/176/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/statuses/40db4a25bf0d655c84dd07a9c658b92b822d43fc","head":{"label":"blowmage:bigquery","ref":"bigquery","sha":"40db4a25bf0d655c84dd07a9c658b92b822d43fc","user":{"login":"blowmage","id":730,"avatar_url":"https://avatars.githubusercontent.com/u/730?v=3","gravatar_id":"","url":"https://api.github.com/users/blowmage","html_url":"https://github.com/blowmage","followers_url":"https://api.github.com/users/blowmage/followers","following_url":"https://api.github.com/users/blowmage/following{/other_user}","gists_url":"https://api.github.com/users/blowmage/gists{/gist_id}","starred_url":"https://api.github.com/users/blowmage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blowmage/subscriptions","organizations_url":"https://api.github.com/users/blowmage/orgs","repos_url":"https://api.github.com/users/blowmage/repos","events_url":"https://api.github.com/users/blowmage/events{/privacy}","received_events_url":"https://api.github.com/users/blowmage/received_events","type":"User","site_admin":false},"repo":{"id":29543910,"name":"gcloud-ruby","full_name":"blowmage/gcloud-ruby","owner":{"login":"blowmage","id":730,"avatar_url":"https://avatars.githubusercontent.com/u/730?v=3","gravatar_id":"","url":"https://api.github.com/users/blowmage","html_url":"https://github.com/blowmage","followers_url":"https://api.github.com/users/blowmage/followers","following_url":"https://api.github.com/users/blowmage/following{/other_user}","gists_url":"https://api.github.com/users/blowmage/gists{/gist_id}","starred_url":"https://api.github.com/users/blowmage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blowmage/subscriptions","organizations_url":"https://api.github.com/users/blowmage/orgs","repos_url":"https://api.github.com/users/blowmage/repos","events_url":"https://api.github.com/users/blowmage/events{/privacy}","received_events_url":"https://api.github.com/users/blowmage/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/blowmage/gcloud-ruby","description":"Google Cloud Client Library for Ruby","fork":true,"url":"https://api.github.com/repos/blowmage/gcloud-ruby","forks_url":"https://api.github.com/repos/blowmage/gcloud-ruby/forks","keys_url":"https://api.github.com/repos/blowmage/gcloud-ruby/keys{/key_id}","collaborators_url":"https://api.github.com/repos/blowmage/gcloud-ruby/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/blowmage/gcloud-ruby/teams","hooks_url":"https://api.github.com/repos/blowmage/gcloud-ruby/hooks","issue_events_url":"https://api.github.com/repos/blowmage/gcloud-ruby/issues/events{/number}","events_url":"https://api.github.com/repos/blowmage/gcloud-ruby/events","assignees_url":"https://api.github.com/repos/blowmage/gcloud-ruby/assignees{/user}","branches_url":"https://api.github.com/repos/blowmage/gcloud-ruby/branches{/branch}","tags_url":"https://api.github.com/repos/blowmage/gcloud-ruby/tags","blobs_url":"https://api.github.com/repos/blowmage/gcloud-ruby/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/blowmage/gcloud-ruby/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/blowmage/gcloud-ruby/git/refs{/sha}","trees_url":"https://api.github.com/repos/blowmage/gcloud-ruby/git/trees{/sha}","statuses_url":"https://api.github.com/repos/blowmage/gcloud-ruby/statuses/{sha}","languages_url":"https://api.github.com/repos/blowmage/gcloud-ruby/languages","stargazers_url":"https://api.github.com/repos/blowmage/gcloud-ruby/stargazers","contributors_url":"https://api.github.com/repos/blowmage/gcloud-ruby/contributors","subscribers_url":"https://api.github.com/repos/blowmage/gcloud-ruby/subscribers","subscription_url":"https://api.github.com/repos/blowmage/gcloud-ruby/subscription","commits_url":"https://api.github.com/repos/blowmage/gcloud-ruby/commits{/sha}","git_commits_url":"https://api.github.com/repos/blowmage/gcloud-ruby/git/commits{/sha}","comments_url":"https://api.github.com/repos/blowmage/gcloud-ruby/comments{/number}","issue_comment_url":"https://api.github.com/repos/blowmage/gcloud-ruby/issues/comments{/number}","contents_url":"https://api.github.com/repos/blowmage/gcloud-ruby/contents/{+path}","compare_url":"https://api.github.com/repos/blowmage/gcloud-ruby/compare/{base}...{head}","merges_url":"https://api.github.com/repos/blowmage/gcloud-ruby/merges","archive_url":"https://api.github.com/repos/blowmage/gcloud-ruby/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/blowmage/gcloud-ruby/downloads","issues_url":"https://api.github.com/repos/blowmage/gcloud-ruby/issues{/number}","pulls_url":"https://api.github.com/repos/blowmage/gcloud-ruby/pulls{/number}","milestones_url":"https://api.github.com/repos/blowmage/gcloud-ruby/milestones{/number}","notifications_url":"https://api.github.com/repos/blowmage/gcloud-ruby/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/blowmage/gcloud-ruby/labels{/name}","releases_url":"https://api.github.com/repos/blowmage/gcloud-ruby/releases{/id}","created_at":"2015-01-20T18:09:16Z","updated_at":"2015-05-08T14:15:11Z","pushed_at":"2015-06-29T14:08:20Z","git_url":"git://github.com/blowmage/gcloud-ruby.git","ssh_url":"git@github.com:blowmage/gcloud-ruby.git","clone_url":"https://github.com/blowmage/gcloud-ruby.git","svn_url":"https://github.com/blowmage/gcloud-ruby","homepage":"","size":5700,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"GoogleCloudPlatform:master","ref":"master","sha":"6423fb73e88aaf1d2e91cde9574a6eb9751bb2c1","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":20343475,"name":"gcloud-ruby","full_name":"GoogleCloudPlatform/gcloud-ruby","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/gcloud-ruby","description":"Google Cloud Client Library for Ruby","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/releases{/id}","created_at":"2014-05-30T21:47:14Z","updated_at":"2015-06-12T17:42:53Z","pushed_at":"2015-06-29T14:08:06Z","git_url":"git://github.com/GoogleCloudPlatform/gcloud-ruby.git","ssh_url":"git@github.com:GoogleCloudPlatform/gcloud-ruby.git","clone_url":"https://github.com/GoogleCloudPlatform/gcloud-ruby.git","svn_url":"https://github.com/GoogleCloudPlatform/gcloud-ruby","homepage":"https://googlecloudplatform.github.io/gcloud-ruby/","size":6096,"stargazers_count":13,"watchers_count":13,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":9,"mirror_url":null,"open_issues_count":28,"forks":9,"open_issues":28,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/pulls/176"},"html":{"href":"https://github.com/GoogleCloudPlatform/gcloud-ruby/pull/176"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/issues/176"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/issues/176/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/pulls/176/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/pulls/176/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/statuses/40db4a25bf0d655c84dd07a9c658b92b822d43fc"}}}}