apadmi_grout 2.5.0 → 2.6.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: fe89f35f8c3b54c1f9e69bd1f0fe9d18c38ccab135960467d5df0753a4eb1fdc
4
- data.tar.gz: '0982cf4af81f777753799820e9a0cad205f5e052f8e7ae48765b2366c61f23b3'
3
+ metadata.gz: af094b716e2764d75b2f0729c40c82e2bb2ffe13f2775a2e2d6480540c471922
4
+ data.tar.gz: 7ab7d36c4e120a348ee74e2e67386fd1f497d40c5bb684951777edef79caf5c8
5
5
  SHA512:
6
- metadata.gz: ee076a7a629461753bf73c84ea78698ff7430afba999ff5c3695c80d9013dd36a4af3c1033198de37d9f610b2f0e6d1f1adab774f4c7fabd001124c3bb78be78
7
- data.tar.gz: 28a4867d73f83d8ab6e0ab4d28c63cdbd8f166237edb28ae305325e7b029dbe6a126526f1f388ac8fc877fe298250b6a11e54bb7ecf2623cc21bcb6ffef09049
6
+ metadata.gz: 586a0f1eaf5d0ca433ad18a9c09965da229459bd172a217e04d1ee74a82cfc349cd7841093b40b29f8762bbf37310f3a0a423731bfd1ded2e55697f32663c0a5
7
+ data.tar.gz: f77fb691459927030db6f936f5768aa69fd72b5906c23f044bc8e885a6a7084a9bd20c723a5736008a0f42800d955ffd935e8200200bb8ea9c6ec882bcd92e2f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Core Changelog
2
2
 
3
+ ## [2.6.0] - 2023-09-20
4
+ * Add option to expand ADO tickets with additional information
5
+ * Add ability to assign users to ADO tickets
6
+
3
7
  ## [2.5.0] - 2023-09-20
4
8
  * Added more options to the ADO queries for more in granular filtering.
5
9
 
@@ -4,7 +4,12 @@ module Apadmi
4
4
  module Grout
5
5
  AdoConfig = Struct.new(
6
6
  :flag_tag,
7
+ :expand_type,
7
8
  keyword_init: true
8
- )
9
+ ) do
10
+ def initialize(flag_tag:, expand_type: "none")
11
+ super
12
+ end
13
+ end
9
14
  end
10
15
  end
@@ -24,7 +24,7 @@ module Apadmi
24
24
 
25
25
  keys = keys.map { |k| sanitise_key(k) } # Allows supporting raw keys, and keys prefixed with a hash which is common ADO practice
26
26
 
27
- res = @network_service.do_get("/wit/workitems?ids=#{keys.join(",")}&errorPolicy=omit&api-version=7.1-preview.2")
27
+ res = @network_service.do_get("/wit/workitems?ids=#{keys.join(",")}&$expand=#{@ado_config.expand_type}&errorPolicy=omit&api-version=7.1-preview.2")
28
28
  parsed = JSON.parse(res.body)
29
29
  items = parsed["value"]
30
30
 
@@ -82,6 +82,12 @@ module Apadmi
82
82
  @network_service.do_post("/wit/workitems/#{key}/comments?#{API_VERSION_PARAM}-preview.3", payload.to_json)
83
83
  end
84
84
 
85
+ # @param String key
86
+ # @param [Array<Hash>] payload
87
+ def update_ticket(key, payload)
88
+ @network_service.do_patch("/wit/workitems/#{key}?#{API_VERSION_PARAM}", payload.to_json)
89
+ end
90
+
85
91
  # @param [String] key
86
92
  # @param [String] tag
87
93
  def add_tag(key, tag)
@@ -90,7 +96,7 @@ module Apadmi
90
96
  "path" => "/fields/System.Tags",
91
97
  "value" => tag
92
98
  }]
93
- @network_service.do_patch("/wit/workitems/#{key}?#{API_VERSION_PARAM}", payload.to_json)
99
+ update_ticket(key, payload)
94
100
  end
95
101
 
96
102
  # @param [String] key
@@ -104,7 +110,7 @@ module Apadmi
104
110
  "path" => "/fields/System.Tags",
105
111
  "value" => new_tags.join("; ")
106
112
  }]
107
- @network_service.do_patch("/wit/workitems/#{key}?#{API_VERSION_PARAM}", payload.to_json)
113
+ update_ticket(key, payload)
108
114
  end
109
115
 
110
116
  # @param [String] key
@@ -132,7 +138,7 @@ module Apadmi
132
138
  "path" => "/fields/Microsoft.VSTS.Build.IntegrationBuild",
133
139
  "value" => versions.join("; ")
134
140
  }]
135
- @network_service.do_patch("/wit/workitems/#{key}?#{API_VERSION_PARAM}", payload.to_json)
141
+ update_ticket(key, payload)
136
142
  end
137
143
 
138
144
  # @param [String] key
@@ -153,7 +159,27 @@ module Apadmi
153
159
  "path" => "/fields/System.State",
154
160
  "value" => state_name
155
161
  }]
156
- @network_service.do_patch("/wit/workitems/#{key}?#{API_VERSION_PARAM}", payload.to_json)
162
+ update_ticket(key, payload)
163
+ end
164
+
165
+ # @param [String] key
166
+ # @param [String] user
167
+ def assign_to_user(key, user)
168
+ key = sanitise_key(key)
169
+
170
+ payload = if user
171
+ [{
172
+ "op": "add",
173
+ "path": "/fields/System.AssignedTo",
174
+ "value": user
175
+ }]
176
+ else
177
+ [{
178
+ "op": "remove",
179
+ "path": "/fields/System.AssignedTo"
180
+ }]
181
+ end
182
+ update_ticket(key, payload)
157
183
  end
158
184
 
159
185
  # @param [String] key
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Apadmi
4
4
  module Grout
5
- VERSION = "2.5.0"
5
+ VERSION = "2.6.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apadmi_grout
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Apadmi