templates/cloud/gem/authentication.erb in gapic-generator-cloud-0.1.7 vs templates/cloud/gem/authentication.erb in gapic-generator-cloud-0.2.0
- old
+ new
@@ -26,20 +26,20 @@
```
3. Initialize the client.
```ruby
-require "<%= service.package.package_require %>"
+require "<%= gem.entrypoint_require %>"
-client = <%= service.client_name_full %>.new
+client = <%= service.create_client_call %>
```
## Credential Lookup
The <%= gem.name %> library aims to make authentication
as simple as possible, and provides several mechanisms to configure your system
-without **Service Account Credentials** directly in code.
+without requiring **Service Account Credentials** directly in code.
**Credentials** are discovered in the following order:
1. Specify credentials in method arguments
2. Specify credentials in configuration
@@ -65,49 +65,49 @@
**Credentials JSON** itself can be stored for environments such as Docker
containers where writing files is difficult or not encouraged.
The environment variables that <%= gem.name %>
checks for credentials are configured on the service Credentials class (such as
-{<%= service.credentials_name_full %>}):
+<%= service.credentials_class_xref %>):
1. `<%= gem.env_prefix %>_CREDENTIALS` - Path to JSON file, or JSON contents
2. `<%= gem.env_prefix %>_KEYFILE` - Path to JSON file, or JSON contents
3. `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents
4. `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents
5. `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file
```ruby
-require "<%= service.package.package_require %>"
+require "<%= gem.entrypoint_require %>"
ENV["<%= gem.env_prefix %>_CREDENTIALS"] = "path/to/keyfile.json"
-client = <%= service.client_name_full %>.new
+client = <%= service.create_client_call %>
```
### Configuration
The **Credentials JSON** can be configured instead of placing them in
environment variables. Either on an individual client initialization:
```ruby
-require "<%= service.package.package_require %>"
+require "<%= gem.entrypoint_require %>"
-client = <%= service.client_name_full %>.new do |config|
+client = <%= service.create_client_call %> do |config|
config.credentials = "path/to/keyfile.json"
end
```
Or configured globally for all clients:
```ruby
-require "<%= service.package.package_require %>"
+require "<%= gem.entrypoint_require %>"
-<%= service.client_name_full %>.configure do |config|
+<%= service.configure_client_call %> do |config|
config.credentials = "path/to/keyfile.json"
end
-client = <%= service.client_name_full %>.new
+client = <%= service.create_client_call %>
```
### Cloud SDK
This option allows for an easy way to authenticate during development. If
@@ -136,12 +136,12 @@
Google Cloud requires **Service Account Credentials** to
connect to the APIs. You will use the **JSON key file** to
connect to most services with <%= gem.name %>.
-If you are not running this client within [Google Cloud Platform
-environments](#google-cloud-platform-environments), you need a Google
-Developers service account.
+If you are not running this client within
+[Google Cloud Platform environments](#google-cloud-platform-environments), you
+need a Google Developers service account.
1. Visit the [Google Developers Console][dev-console].
2. Create a new project or click on an existing project.
3. Activate the slide-out navigation tray and select **API Manager**. From
here, you will enable the APIs that your application requires.