usps-support 0.2.33 → 0.2.34

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: 0fbc6292bf62cc060ed4e6a98f6b1401a4272c933e62122c4082270548714626
4
- data.tar.gz: 45ea123c687a9e4f7bd3061363a462f708be5f5afb9ffd2f86151a34c6d660fd
3
+ metadata.gz: 02f8fb6837863f1db65a53e28ea9d5024a1950f77da7b996d069bf5b590b2000
4
+ data.tar.gz: 5c8d8c959ab8d05117f1b062d0805d99a29c462c112848d71fcd4cd74677303a
5
5
  SHA512:
6
- metadata.gz: 707d6521fd4f39da121ed4f8e1b5a64c4184519f2e4843c682df242a8a01e3992cc15e6ecaac36acde4cb8cfea81e54df7d02667ca0901457568c228135254e4
7
- data.tar.gz: 75f986edbfc945c91b5c54e5aa3cd55f994976cb60bc20731e79822506d92e460255ff791826d7024a9f3ed0901f09b2fd03ee2302c26254aebece3e2d016927
6
+ metadata.gz: b26fc468f75a235640d8787872cd6dc0f404a34590ce577e6a294ce946541c9ec553d6ddcb79af75084e3ae5846d2901c25e504f00d03613f9228504500905a6
7
+ data.tar.gz: b35ed5d1aa5692066b740f2d0f11cefcbd4d604106304b0676ebfb6aa61fbad57a014e421347d8dcb181d8a9eb7dbf0cebad08db10f895d24f685366ddce3811
@@ -5,12 +5,17 @@ module Usps::Support::Models
5
5
  #
6
6
  module GitHub
7
7
  ORG = 'unitedstatespowersquadrons'
8
+ CLIENT_MUTEX = Mutex.new
8
9
 
9
10
  class << self
10
11
  def check_suites(repo, branch)
11
12
  client.check_suites_for_ref("#{ORG}/#{repo}", branch).check_suites
12
13
  end
13
14
 
15
+ def graphql(query, variables = {})
16
+ client.post('/graphql', { query:, variables: }.to_json)
17
+ end
18
+
14
19
  def check_runs(repo, check_suite_id)
15
20
  client.check_runs_for_check_suite("#{ORG}/#{repo}", check_suite_id).check_runs
16
21
  end
@@ -45,6 +50,10 @@ module Usps::Support::Models
45
50
  def client
46
51
  return @client if @client && !expired?
47
52
 
53
+ CLIENT_MUTEX.synchronize { @client && !expired? ? @client : client! }
54
+ end
55
+
56
+ def client!
48
57
  payload = {
49
58
  iat: Time.now.to_i - 60,
50
59
  exp: Time.now.to_i + (10 * 60),
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Usps
4
4
  module Support
5
- VERSION = '0.2.33'
5
+ VERSION = '0.2.34'
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.33
4
+ version: 0.2.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander