ghx 0.3.0 → 0.4.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: 2b80c109f50e1c94cc2aa0bd727a2dbe547b66080380a2847132bc7cda0b34b8
4
- data.tar.gz: 179db655ee4d499eb53912cc3a09ebc7ff5c9100d650b4ef6567ce2a8ff9acb7
3
+ metadata.gz: 948d5726a41976965d9b591775265fa9eb3591192dbcb652694a20cb3944b3e7
4
+ data.tar.gz: f3b9eda9dfa11184d65936833070b7bc93fd26b008048fce43a0ba9651a3f7f2
5
5
  SHA512:
6
- metadata.gz: 22bbefe3f68291efca16223b120575cf64997a9f2f07cc09963f0454314c423933d4cbbaf4b5c26b267d292e560114ca71e6f8faf08e7ad84e016c70229edd3e
7
- data.tar.gz: 1082fc4c645cf94a660305ef1e0f7fdaff8c06ebd7bab58ac74d8acead82cb01cf12c8608681f8019b83ad79e479d602fab0f073270dc4d82017d997ae11f18e
6
+ metadata.gz: 0f90bce155118ed913561fa83ce4557f8cd825746bb251e2ecc8241ae32a46206e3db61fe630aec8917e57235b4bb7817d9ee26d06100e05f5b5dc1227d4150c
7
+ data.tar.gz: d367007665fae5e55de920615b912c7da109a552a935511d45a8f050666d7396664f8e1f7631ed9744651e27c54515af4713829c0f547f49865d7b0c9e44b03a
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
@@ -185,7 +185,7 @@ module GHX
185
185
  end
186
186
 
187
187
  def normalized_field_value_name(name)
188
- name.tr(" ", "_").downcase
188
+ name.tr(" ", "_").tr("-", "_").downcase
189
189
  end
190
190
 
191
191
  # Extracts the value from the field based on the field's data type. Thank you GraphQL for making this totally asinine.
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.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,13 @@
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.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - CompanyCam
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-05-23 00:00:00.000000000 Z
10
+ date: 2025-02-19 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: octokit
@@ -117,7 +116,6 @@ homepage: https://github.com/companycam/ghx
117
116
  licenses:
118
117
  - MIT
119
118
  metadata: {}
120
- post_install_message:
121
119
  rdoc_options: []
122
120
  require_paths:
123
121
  - lib
@@ -132,8 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
130
  - !ruby/object:Gem::Version
133
131
  version: '0'
134
132
  requirements: []
135
- rubygems_version: 3.5.10
136
- signing_key:
133
+ rubygems_version: 3.6.2
137
134
  specification_version: 4
138
135
  summary: Wrapper around some GitHub API calls
139
136
  test_files: []