apadmi_grout 2.5.0 → 2.6.1

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: 8db6b7eca5ee2eb554e888bd25c267dde94978757015ed037c0d193dc372bc51
4
+ data.tar.gz: 514ebf8f1057e01d9b36867b5e6ee419c037691039f5a2165cca471c56a2bd9b
5
5
  SHA512:
6
- metadata.gz: ee076a7a629461753bf73c84ea78698ff7430afba999ff5c3695c80d9013dd36a4af3c1033198de37d9f610b2f0e6d1f1adab774f4c7fabd001124c3bb78be78
7
- data.tar.gz: 28a4867d73f83d8ab6e0ab4d28c63cdbd8f166237edb28ae305325e7b029dbe6a126526f1f388ac8fc877fe298250b6a11e54bb7ecf2623cc21bcb6ffef09049
6
+ metadata.gz: d9fc365c23f6292fe1690b8b3250e7e9dd7195854f6dceb5cb0a704fb4849c9b63c1a514e786df4b911c08805237416d59c21f191e631f3bec65273a329abff1
7
+ data.tar.gz: 0d45b1e9c056154c19733486bad4dd34ed37fb3f7da68c825a2c639eeda9514138fce722bfe546d4238ab9d24da96597ac8520796c1132f58537e79bc776fd54
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Core Changelog
2
2
 
3
+ ## [2.6.1] - 2024-01-09
4
+ * Fix: missing blank? method because ActiveSupport requires you to load the extensions explicitly from 7.1
5
+
6
+ ## [2.6.0] - 2023-09-20
7
+ * Add option to expand ADO tickets with additional information
8
+ * Add ability to assign users to ADO tickets
9
+
3
10
  ## [2.5.0] - 2023-09-20
4
11
  * Added more options to the ADO queries for more in granular filtering.
5
12
 
@@ -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.1"
6
6
  end
7
7
  end
data/lib/apadmi_grout.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "active_support/core_ext/object/blank"
4
+
3
5
  Dir[File.expand_path("apadmi/grout/**/*.rb", File.dirname(__FILE__))].sort.each do |current|
4
6
  require current
5
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
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.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Apadmi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-09-20 00:00:00.000000000 Z
11
+ date: 2024-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday