ghx 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b80c109f50e1c94cc2aa0bd727a2dbe547b66080380a2847132bc7cda0b34b8
4
- data.tar.gz: 179db655ee4d499eb53912cc3a09ebc7ff5c9100d650b4ef6567ce2a8ff9acb7
3
+ metadata.gz: 844c71686d364775951d08395893eb266f66255d9a3ad08bae723301b85fc7e9
4
+ data.tar.gz: e2ac2f47f1673a8876358ce39513193741a26a9a42a314044a35b3e6d9c553c6
5
5
  SHA512:
6
- metadata.gz: 22bbefe3f68291efca16223b120575cf64997a9f2f07cc09963f0454314c423933d4cbbaf4b5c26b267d292e560114ca71e6f8faf08e7ad84e016c70229edd3e
7
- data.tar.gz: 1082fc4c645cf94a660305ef1e0f7fdaff8c06ebd7bab58ac74d8acead82cb01cf12c8608681f8019b83ad79e479d602fab0f073270dc4d82017d997ae11f18e
6
+ metadata.gz: 2034b514c2005c54a97a7cae8b5acae0eb80993d40e03504371e4b83bffc84f642513183fb5615e132b831e1e4747e3787a767ad9ca049c5e0960b968a7caa45
7
+ data.tar.gz: 9d02fac7a48c996d82a8122249fa74902b0ba8671d93de4442c56b756794a3bcb77cceeed2e9b654c480625d8efbba91ce577b15ff349ee4afa55328758a261d
data/lib/ghx/project.rb CHANGED
@@ -48,7 +48,7 @@ module GHX
48
48
  }
49
49
  GQL
50
50
 
51
- client = GraphqlClient.new(ENV["GITHUB_TOKEN"])
51
+ client = GHX.graphql
52
52
  res = client.query(gql_query)
53
53
 
54
54
  data = JSON.parse(res.body)
@@ -177,7 +177,7 @@ module GHX
177
177
  }
178
178
  GQL
179
179
 
180
- client = GraphqlClient.new(ENV["GITHUB_TOKEN"])
180
+ client = GHX.graphql
181
181
  res = client.query(gql_query)
182
182
 
183
183
  data = JSON.parse(res.body)
@@ -87,7 +87,7 @@ module GHX
87
87
  }
88
88
  GQL
89
89
 
90
- client = GraphqlClient.new(ENV["GITHUB_TOKEN"])
90
+ client = GHX.graphql
91
91
  res = client.query(gql_query)
92
92
  GHX.logger.debug "Update text field result"
93
93
  GHX.logger.debug res
@@ -111,7 +111,7 @@ module GHX
111
111
  }
112
112
  GQL
113
113
 
114
- client = GraphqlClient.new(ENV["GITHUB_TOKEN"])
114
+ client = GHX.graphql
115
115
  res = client.query(gql_query)
116
116
  GHX.logger.debug "Update date field result"
117
117
  GHX.logger.debug res
@@ -141,7 +141,7 @@ module GHX
141
141
  }
142
142
  GQL
143
143
 
144
- client = GraphqlClient.new(ENV["GITHUB_TOKEN"])
144
+ client = GHX.graphql
145
145
  res = client.query(gql_query)
146
146
  GHX.logger.debug "Update single select field result"
147
147
  GHX.logger.debug res.body
data/lib/ghx.rb CHANGED
@@ -41,7 +41,7 @@ module GHX
41
41
  # API Key defaults to ENV["GITHUB_TOKEN"]
42
42
  # @return [Octokit::Client]
43
43
  def self.octokit
44
- @octokit ||= Octokit::Client.new(access_token: ENV["GITHUB_TOKEN"])
44
+ @octokit ||= Octokit::Client.new(access_token: octokit_token)
45
45
  end
46
46
 
47
47
  # @param octokit [Octokit::Client]
@@ -50,11 +50,21 @@ module GHX
50
50
  @octokit = octokit
51
51
  end
52
52
 
53
+ # @return [String] the API Key for the Octokit client
54
+ def self.octokit_token
55
+ @octokit_token ||= ENV["GITHUB_TOKEN"]
56
+ end
57
+
58
+ # @param new_token [String] the API Key for the Octokit client
59
+ def self.octokit_token=(new_token)
60
+ @octokit_token = new_token
61
+ end
62
+
53
63
  # Internal graphql client.
54
64
  # API Key defaults to ENV["GITHUB_TOKEN"]
55
65
  # @return [GHX::GraphqlClient]
56
66
  def self.graphql
57
- @graphql ||= GHX::GraphqlClient.new(ENV["GITHUB_GRAPHQL_TOKEN"])
67
+ @graphql ||= GHX::GraphqlClient.new(graphql_token)
58
68
  end
59
69
 
60
70
  # @param graphql [GHX::GraphqlClient]
@@ -63,11 +73,22 @@ module GHX
63
73
  @graphql = graphql
64
74
  end
65
75
 
76
+ # @return [String] the API Key for the GraphQL client
77
+ def self.graphql_token
78
+ @graphql_token ||= ENV["GITHUB_GRAPHQL_TOKEN"]
79
+ end
80
+
81
+ # @param new_token [String] the API Key for the GraphQL client
82
+ # @return [String]
83
+ def self.graphql_token=(new_token)
84
+ @graphql_token = new_token
85
+ end
86
+
66
87
  # Internal graphql client.
67
88
  # API Key defaults to ENV["GITHUB_TOKEN"]
68
89
  # @return [GHX::RestClient]
69
90
  def self.rest_client
70
- @rest_client ||= GHX::RestClient.new(ENV["GITHUB_TOKEN"])
91
+ @rest_client ||= GHX::RestClient.new(rest_client_token)
71
92
  end
72
93
 
73
94
  # @param rest_client [GHX::RestClient]
@@ -75,4 +96,15 @@ module GHX
75
96
  def self.rest_client=(rest_client)
76
97
  @rest_client = rest_client
77
98
  end
99
+
100
+ # @return [String] the API Key for the REST client
101
+ def self.rest_client_token
102
+ @rest_client_token ||= ENV["GITHUB_TOKEN"]
103
+ end
104
+
105
+ # @param new_token [String] the API Key for the REST client
106
+ # @return [String]
107
+ def self.rest_client_token=(new_token)
108
+ @rest_client_token = new_token
109
+ end
78
110
  end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module GHX
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ghx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - CompanyCam
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-23 00:00:00.000000000 Z
11
+ date: 2024-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit