Class: AnalyticsOps::ServiceAccount

Inherits:
Object
  • Object
show all
Defined in:
lib/analytics_ops/service_account.rb,
sig/analytics_ops.rbs

Overview

The single supported Google authentication source.

Defined Under Namespace

Classes: Store

Constant Summary collapse

MAX_KEY_BYTES =

Returns:

  • (Integer)
64 * 1024
READ_SCOPE =

Returns:

  • (String)
"https://www.googleapis.com/auth/analytics.readonly"
EDIT_SCOPE =

Returns:

  • (String)
"https://www.googleapis.com/auth/analytics.edit"
BIGQUERY_SCOPE =

Returns:

  • (String)
"https://www.googleapis.com/auth/bigquery.readonly"
ACCESS_SCOPES =

Returns:

  • (Hash[Symbol, Array[String]])
{
  read: [READ_SCOPE].freeze,
  edit: [READ_SCOPE, EDIT_SCOPE].freeze,
  bigquery: [BIGQUERY_SCOPE].freeze
}.freeze
REQUIRED_FIELDS =
%w[type client_email private_key token_uri].freeze
CONTROL_CHARACTERS =
/[\u0000-\u001f\u007f]/

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ ServiceAccount

Returns a new instance of ServiceAccount.

Parameters:

  • path (String)


28
29
30
31
32
33
# File 'lib/analytics_ops/service_account.rb', line 28

def initialize(path)
  @path = validated_path(path).freeze
  validate_key!
  @security_warnings = key_security_warnings.map { |warning| warning.dup.freeze }.freeze
  freeze
end

Instance Attribute Details

#pathString (readonly)

Returns the value of attribute path.

Returns:

  • (String)


22
23
24
# File 'lib/analytics_ops/service_account.rb', line 22

def path
  @path
end

#security_warningsArray[String] (readonly)

Returns the value of attribute security_warnings.

Returns:

  • (Array[String])


22
23
24
# File 'lib/analytics_ops/service_account.rb', line 22

def security_warnings
  @security_warnings
end

Class Method Details

.load(path: nil, store: Store.new, connection: nil, config: nil, profile: nil) ⇒ Object



24
25
26
# File 'lib/analytics_ops/service_account.rb', line 24

def self.load(path: nil, store: Store.new, connection: nil, config: nil, profile: nil)
  new(path || store.read(name: connection, config:, profile:))
end