lib/google/cloud/firestore.rb in google-cloud-firestore-1.4.4 vs lib/google/cloud/firestore.rb in google-cloud-firestore-2.0.0
- old
+ new
@@ -31,11 +31,10 @@
#
# See {file:OVERVIEW.md Firestore Overview}.
#
module Firestore
# rubocop:disable Metrics/AbcSize
- # rubocop:disable Metrics/MethodLength
##
# Creates a new object for connecting to the Firestore service.
# Each call creates a new connection.
#
@@ -54,12 +53,10 @@
#
# The default scope is:
#
# * `https://www.googleapis.com/auth/datastore`
# @param [Integer] timeout Default timeout to use in requests. Optional.
- # @param [Hash] client_config A hash of values to override the default
- # behavior of the API client. Optional.
# @param [String] endpoint Override of the endpoint host name. Optional.
# If the param is nil, uses the default endpoint.
# @param [String] emulator_host Firestore emulator host. Optional.
# If the param is nil, uses the value of the `emulator_host` config.
# @param [String] project Alias for the `project_id` argument. Deprecated.
@@ -71,31 +68,30 @@
# @example
# require "google/cloud/firestore"
#
# firestore = Google::Cloud::Firestore.new
#
- def self.new project_id: nil, credentials: nil, scope: nil, timeout: nil,
- client_config: nil, endpoint: nil, emulator_host: nil,
- project: nil, keyfile: nil
+ def self.new project_id: nil,
+ credentials: nil,
+ scope: nil,
+ timeout: nil,
+ endpoint: nil,
+ emulator_host: nil,
+ project: nil,
+ keyfile: nil
project_id ||= (project || default_project_id)
scope ||= configure.scope
timeout ||= configure.timeout
- client_config ||= configure.client_config
endpoint ||= configure.endpoint
emulator_host ||= configure.emulator_host
if emulator_host
project_id = project_id.to_s
raise ArgumentError, "project_id is missing" if project_id.empty?
- return Firestore::Client.new(
- Firestore::Service.new(
- project_id, :this_channel_is_insecure,
- host: emulator_host, timeout: timeout,
- client_config: client_config
- )
- )
+ service = Firestore::Service.new project_id, :this_channel_is_insecure, host: emulator_host, timeout: timeout
+ return Firestore::Client.new service
end
credentials ||= (keyfile || default_credentials(scope: scope))
unless credentials.is_a? Google::Auth::Credentials
credentials = Firestore::Credentials.new credentials, scope: scope
@@ -105,20 +101,15 @@
project_id ||= credentials.project_id
end
project_id = project_id.to_s
raise ArgumentError, "project_id is missing" if project_id.empty?
- Firestore::Client.new(
- Firestore::Service.new(
- project_id, credentials,
- host: endpoint, timeout: timeout, client_config: client_config
- )
- )
+ service = Firestore::Service.new project_id, credentials, host: endpoint, timeout: timeout
+ Firestore::Client.new service
end
# rubocop:enable Metrics/AbcSize
- # rubocop:enable Metrics/MethodLength
##
# Configure the Google Cloud Firestore library.
#
# The following Firestore configuration parameters are supported:
@@ -130,11 +121,9 @@
# Google::Auth::Credentials object. (See {Firestore::Credentials}) (The
# parameter `keyfile` is considered deprecated, but may also be used.)
# * `scope` - (String, Array<String>) The OAuth 2.0 scopes controlling
# the set of resources and operations that the connection can access.
# * `timeout` - (Integer) Default timeout to use in requests.
- # * `client_config` - (Hash) A hash of values to override the default
- # behavior of the API client.
# * `endpoint` - (String) Override of the endpoint host name, or `nil`
# to use the default endpoint.
# * `emulator_host` - (String) Host name of the emulator. Defaults to
# `ENV["FIRESTORE_EMULATOR_HOST"]`
#