maia 5.0.0 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/maia/fcm/credentials.rb +7 -4
- data/lib/maia/fcm/gateway.rb +1 -1
- data/lib/maia/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3efb00ad0b208362f022cc62718c3e7acf26f850007dfa899123f5b1de33250
|
4
|
+
data.tar.gz: 77b3a882f44ee407c1bc00075ba591646097adbb284f8a7429de575b43ca28a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8ff83629565645b0b6ea9c8802974d0d924f08c596f61364956b73e92bf4610f801ba41b8a9e9b486cc8c19a0db0e1f3445d1217dda66e205554c2c28e962d3
|
7
|
+
data.tar.gz: 31da736742c1b67abbdea6863f2cd090576f7f08bde0466dabee5f1cee6e088ff6428439731886d14c060207498a673b4f5171c62f7354a1212e670f9772ca2a
|
data/lib/maia/fcm/credentials.rb
CHANGED
@@ -5,16 +5,19 @@ module Maia
|
|
5
5
|
class Credentials
|
6
6
|
SCOPE = 'https://www.googleapis.com/auth/firebase.messaging'.freeze
|
7
7
|
|
8
|
-
def initialize(path = ENV['GOOGLE_APPLICATION_CREDENTIALS'])
|
9
|
-
@path
|
8
|
+
def initialize(path = ENV['GOOGLE_APPLICATION_CREDENTIALS'], cache: Rails.cache)
|
9
|
+
@path = path
|
10
|
+
@cache = cache
|
10
11
|
end
|
11
12
|
|
12
13
|
def project
|
13
|
-
to_h['project_id']
|
14
|
+
@project ||= to_h['project_id']
|
14
15
|
end
|
15
16
|
|
16
17
|
def token
|
17
|
-
|
18
|
+
@cache.fetch('maia-fcm-token', expires_in: 1.hour) do
|
19
|
+
credentials.fetch_access_token!['access_token']
|
20
|
+
end
|
18
21
|
end
|
19
22
|
|
20
23
|
def to_h
|
data/lib/maia/fcm/gateway.rb
CHANGED
data/lib/maia/version.rb
CHANGED