lib/google/cloud/bigquery/project.rb in google-cloud-bigquery-1.0.0 vs lib/google/cloud/bigquery/project.rb in google-cloud-bigquery-1.1.0
- old
+ new
@@ -11,11 +11,10 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-require "google/cloud/env"
require "google/cloud/errors"
require "google/cloud/bigquery/service"
require "google/cloud/bigquery/credentials"
require "google/cloud/bigquery/dataset"
require "google/cloud/bigquery/job"
@@ -81,22 +80,13 @@
# bigquery.project_id #=> "my-project"
#
def project_id
service.project
end
- alias_method :project, :project_id
+ alias project project_id
##
- # @private Default project_id.
- def self.default_project_id
- ENV["BIGQUERY_PROJECT"] ||
- ENV["GOOGLE_CLOUD_PROJECT"] ||
- ENV["GCLOUD_PROJECT"] ||
- Google::Cloud.env.project_id
- end
-
- ##
# Queries data by creating a [query
# job](https://cloud.google.com/bigquery/docs/query-overview#query_jobs).
#
# When using standard SQL and passing arguments using `params`, Ruby
# types are mapped to BigQuery types as follows:
@@ -514,12 +504,12 @@
job.wait_until_done!
if job.failed?
begin
# raise to activate ruby exception cause handling
- fail job.gapi_error
- rescue => e
+ raise job.gapi_error
+ rescue StandardError => e
# wrap Google::Apis::Error with Google::Cloud::Error
raise Google::Cloud::Error.from_error(e)
end
end
@@ -665,11 +655,13 @@
expiration: nil, location: nil
ensure_service!
new_ds = Google::Apis::BigqueryV2::Dataset.new(
dataset_reference: Google::Apis::BigqueryV2::DatasetReference.new(
- project_id: project, dataset_id: dataset_id))
+ project_id: project, dataset_id: dataset_id
+ )
+ )
# Can set location only on creation, no Dataset#location method
new_ds.update! location: location unless location.nil?
updater = Dataset::Updater.new(new_ds).tap do |b|
@@ -971,10 +963,10 @@
protected
##
# Raise an error unless an active service is available.
def ensure_service!
- fail "Must have active connection" unless service
+ raise "Must have active connection" unless service
end
end
end
end
end