Class: Maia::FCM::Credentials
- Inherits:
-
Object
- Object
- Maia::FCM::Credentials
- Defined in:
- lib/maia/fcm/credentials.rb
Constant Summary collapse
- SCOPE =
'https://www.googleapis.com/auth/firebase.messaging'.freeze
Instance Method Summary collapse
-
#initialize(path = ENV['GOOGLE_APPLICATION_CREDENTIALS']) ⇒ Credentials
constructor
A new instance of Credentials.
- #project ⇒ Object
- #to_h ⇒ Object
- #token ⇒ Object
Constructor Details
#initialize(path = ENV['GOOGLE_APPLICATION_CREDENTIALS']) ⇒ Credentials
Returns a new instance of Credentials.
8 9 10 |
# File 'lib/maia/fcm/credentials.rb', line 8 def initialize(path = ENV['GOOGLE_APPLICATION_CREDENTIALS']) @path = path end |
Instance Method Details
#project ⇒ Object
12 13 14 |
# File 'lib/maia/fcm/credentials.rb', line 12 def project to_h['project_id'] end |
#to_h ⇒ Object
20 21 22 |
# File 'lib/maia/fcm/credentials.rb', line 20 def to_h @to_h ||= JSON.parse file.read end |
#token ⇒ Object
16 17 18 |
# File 'lib/maia/fcm/credentials.rb', line 16 def token credentials.fetch_access_token!['access_token'] end |