usps-support 0.2.43 → 0.2.44

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: ce6a8ceed308122b5af1c4fab691a8be0977de91a47291cbb401df2d4d74852f
4
- data.tar.gz: 6e7978ac3657c9b4f9c282dbe8c3530d9adbd729bca028c8ef0c4f74cb80e7cb
3
+ metadata.gz: b04ede6eeee252cd53b27f9d9938019e9f2a81d467ca077bab1b17087fce0bc6
4
+ data.tar.gz: aef62058741366eee1794b4ebdee5031f91ec78ee46ef60df3e277ab7ddb04aa
5
5
  SHA512:
6
- metadata.gz: '01568809ba436af913aa89571b0dcc89476d0180bdfd653e1058ecfe3d356af29ffd678af2fdb2372d470af9e66cf75f896a984d9b5613f4a495d96922a9c0e9'
7
- data.tar.gz: e98552fb139df3ce45422d7e57a20fe9b4c1e161b0c6f5e6c5f9d3f1787dd6aae38e2d718c2f68818d41194252d1722abbc4cfc09d1df86ecb6d7759d8d121ba
6
+ metadata.gz: 191a90199bdcf0509844d3e12f158e1cad908b1c8c8ad97167bc1d6c464e3ae9bc8984a094306274bcbf806bc815a8385ce849524d1bb372557d592e00f57e07
7
+ data.tar.gz: 5660fd1df623ce3988efdc5c607743095100d7a18e3815ca233bf57bf0313f2a39b728d8b308dac69c8838457f626449f631cafcb6dc4369bdf64f95d49025b8
@@ -40,13 +40,19 @@ module Usps::Support::Models
40
40
  .first
41
41
  end
42
42
 
43
- def expired? = expires_at <= Time.zone.now
44
- def expires_at = @auth[:expires_at]
45
- def permissions = @auth[:permissions]
46
- def repository_selection = @auth[:repository_selection]
43
+ def expired? = @auth.nil? || expires_at <= Time.zone.now
44
+ def expires_at = auth[:expires_at]
45
+ def permissions = auth[:permissions]
46
+ def repository_selection = auth[:repository_selection]
47
47
 
48
48
  private
49
49
 
50
+ def auth
51
+ client if @auth.nil? # Ensure @auth exists
52
+
53
+ @auth
54
+ end
55
+
50
56
  def client
51
57
  return @client if @client && !expired?
52
58
 
@@ -64,9 +70,9 @@ module Usps::Support::Models
64
70
  jwt = JWT.encode(payload, private_key, 'RS256')
65
71
  app_client = Octokit::Client.new(bearer_token: jwt)
66
72
 
67
- auth = app_client.create_app_installation_access_token(ENV['GITHUB_INSTALLATION_ID'].to_i)
68
- @auth = auth.to_h.except(:token)
69
- @client = Octokit::Client.new(access_token: auth[:token])
73
+ response = app_client.create_app_installation_access_token(ENV['GITHUB_INSTALLATION_ID'].to_i).to_h
74
+ @auth = response.except(:token)
75
+ @client = Octokit::Client.new(access_token: response[:token])
70
76
  end
71
77
  end
72
78
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Usps
4
4
  module Support
5
- VERSION = '0.2.43'
5
+ VERSION = '0.2.44'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usps-support
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.43
4
+ version: 0.2.44
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander