Class: Firebase::Admin::App

Inherits:
Object
  • Object
show all
Defined in:
lib/firebase/admin/app.rb,
lib/firebase/admin/auth/client.rb,
lib/firebase/admin/messaging/client.rb

Overview

An App holds configuration and state common to all Firebase services that are exposed from the SDK.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(credentials: nil, config: nil) ⇒ App

Constructs a new App.

Parameters:

  • credentials (Credentials) (defaults to: nil)

    Credentials for authenticating with Firebase.

  • config (Config) (defaults to: nil)

    Firebase configuration options.



20
21
22
23
24
25
# File 'lib/firebase/admin/app.rb', line 20

def initialize(credentials: nil, config: nil)
  @config = config || Config.from_env
  @credentials = credentials || Credentials.from_default
  @service_account_id = @config.
  @project_id = @config.project_id || @credentials.project_id
end

Instance Attribute Details

#credentialsObject (readonly)

Returns the value of attribute credentials.



12
13
14
# File 'lib/firebase/admin/app.rb', line 12

def credentials
  @credentials
end

#project_idObject (readonly)

Returns the value of attribute project_id.



12
13
14
# File 'lib/firebase/admin/app.rb', line 12

def project_id
  @project_id
end

#service_account_idObject (readonly)

Returns the value of attribute service_account_id.



12
13
14
# File 'lib/firebase/admin/app.rb', line 12

def 
  @service_account_id
end

Instance Method Details

#authFirebase::Admin::Auth::Client

Gets the auth client for this App.



119
120
121
# File 'lib/firebase/admin/auth/client.rb', line 119

def auth
  @auth_client ||= Auth::Client.new(self)
end

#messagingFirebase::Admin::Messaging::Client

Gets the Firebase Cloud Messaging client for this App.



201
202
203
# File 'lib/firebase/admin/messaging/client.rb', line 201

def messaging
  @messaging_client ||= Messaging::Client.new(self)
end