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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c639cbbcef83011669667b77953c031472de6770f2a9f84bc742530c90420ef6
4
- data.tar.gz: 22aace941c9ab9957ce5b4d692c088eb9f34bb45aa6df3ab2bfc9ba51ac9c695
3
+ metadata.gz: d3efb00ad0b208362f022cc62718c3e7acf26f850007dfa899123f5b1de33250
4
+ data.tar.gz: 77b3a882f44ee407c1bc00075ba591646097adbb284f8a7429de575b43ca28a8
5
5
  SHA512:
6
- metadata.gz: 4a9c6e9b6feafc62fbd044848687685eb1882bc7e513e484a34da2c57103132440e33c1ee4c643e161f694f9a4569ba8c7d52ad41adf26e018870ec3b0d99658
7
- data.tar.gz: ff3bf75e9238f9a4861626b7372ea3abb1c2e3b27458e8108fa84c39b00c5648c1737557d2afca35f067710188d6925761f5fa4e17b6ab2cb376fdc9ff5d2398
6
+ metadata.gz: d8ff83629565645b0b6ea9c8802974d0d924f08c596f61364956b73e92bf4610f801ba41b8a9e9b486cc8c19a0db0e1f3445d1217dda66e205554c2c28e962d3
7
+ data.tar.gz: 31da736742c1b67abbdea6863f2cd090576f7f08bde0466dabee5f1cee6e088ff6428439731886d14c060207498a673b4f5171c62f7354a1212e670f9772ca2a
@@ -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 = 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
- credentials.fetch_access_token!['access_token']
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
@@ -23,7 +23,7 @@ module Maia
23
23
 
24
24
  private
25
25
  def connection
26
- @connection ||= Maia::FCM::Connection.new(@auth.project, @auth.token)
26
+ Maia::FCM::Connection.new(@auth.project, @auth.token)
27
27
  end
28
28
  end
29
29
  end
@@ -1,3 +1,3 @@
1
1
  module Maia
2
- VERSION = '5.0.0'.freeze
2
+ VERSION = '5.0.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maia
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Logan Serman