googleauth - Class Google::Auth::ClientId (v1.12.2)

Reference documentation and code samples for the googleauth class Google::Auth::ClientId.

Representation of an application's identity for user authorization flows.

Inherits

  • Object

Methods

.default

def self.default()

Returns the value of attribute default.

.default=

def self.default=(value)

Sets the attribute default

.from_file

def self.from_file(file) -> Google::Auth::ClientID

Constructs a Client ID from a JSON file downloaded from the Google Developers Console.

Parameter
  • file (String, File) — Path of file to read from
Returns
  • (Google::Auth::ClientID)

.from_hash

def self.from_hash(config) -> Google::Auth::ClientID

Constructs a Client ID from a previously loaded JSON file. The hash structure should match the expected JSON format.

Parameter
  • config (hash) — Parsed contents of the JSON file
Returns
  • (Google::Auth::ClientID)
Raises
  • (MISSING_TOP_LEVEL_ELEMENT_ERROR)

#id

def id() -> String

Text identifier of the client ID

Returns
  • (String)

#initialize

def initialize(id, secret) -> ClientId

Initialize the Client ID. Both id and secret must be non-nil.

Parameters
  • id (String) — Text identifier of the client ID
  • secret (String) — Secret associated with the client ID
Returns
  • (ClientId) — a new instance of ClientId

#secret

def secret() -> String

Secret associated with the client ID

Returns
  • (String)

Constants

INSTALLED_APP

value: "installed".freeze
Toplevel JSON key for the an installed app configuration. Must include client_id and client_secret subkeys if present.

WEB_APP

value: "web".freeze
Toplevel JSON key for the a webapp configuration. Must include client_id and client_secret subkeys if present.

CLIENT_ID

value: "client_id".freeze
JSON key for the client ID within an app configuration.

CLIENT_SECRET

value: "client_secret".freeze
JSON key for the client secret within an app configuration.

MISSING_TOP_LEVEL_ELEMENT_ERROR

value: "Expected top level property 'installed' or 'web' to be present.".freeze
An error message raised when none of the expected toplevel properties can be found.