gitlab_support_readiness 1.0.99 → 1.0.100

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: 8dc7fd990882686085701557b01aace06ccec7bac9cc9da3511d7b376c887491
4
- data.tar.gz: cbbbadf995335829623eff125c745c04c532fee08ffac889db18689f29a0dbbc
3
+ metadata.gz: bd668f8279a038f07a29196b03ca2508735409f05d5f37ac21ddedd696f03d45
4
+ data.tar.gz: 3a654bd592244b2f4f590f5eacb237178338ca95bb95552797f50c112164b87f
5
5
  SHA512:
6
- metadata.gz: ecc2ec436986dc13f4e2c332ad71100e240c4adeb6c93fb7561b0b5ed1a5403913d000dbde07cd3054f13bebf0306cdf7e5853d974c3023e342c909fa73f962b
7
- data.tar.gz: 7b2b27ef716d35190cc29643c61adbb22b944e8ba629b5fd5113fb0a6ec44d541227b9f8d4ef2ed8b23ff6d7cdd5a1627a257b2e4cd090a8fe83acfb455f7708
6
+ metadata.gz: 931ae18f681cb58209121d7fd288d53be5a27d488e0b1f84a8fdb74aaa63e2429c0f19cc9cee198a9ef70b927350ff54c000b475bef34ff9426eb63631647530
7
+ data.tar.gz: 174bd0322a0b07654678e58b6ef4ac7eb54e8113e824d7295758c4f5dd531ca6a2caa5cbea0e2aa317400eb1a2c5d6cb673bbb26d0d3874fe37337e0ab2c6dad
@@ -20,6 +20,7 @@ module Readiness
20
20
  # @param verbose [Boolean] Whether you want a detailed report or not
21
21
  # @return [Hash]
22
22
  def self.compare(zendesk_client, location = 'data', verbose = false)
23
+ @zendesk_client = zendesk_client
23
24
  @locales = Zendesk::Locales.list(zendesk_client)
24
25
  @from_repo = gather(location)
25
26
  @from_zendesk = Zendesk::DynamicContent.list(zendesk_client)
@@ -183,11 +184,14 @@ module Readiness
183
184
  # pp repo.count
184
185
  # # => 2
185
186
  def self.gather(location)
187
+ @ticket_fields = Readiness::Zendesk::TicketFields.list(@zendesk_client)
188
+ @ticket_forms = Readiness::Zendesk::TicketForms.list(@zendesk_client)
186
189
  @errors = []
187
190
  @location = location
188
191
  array = []
189
192
  Dir["#{@location}/*.yaml"].each do |f|
190
193
  object = YAML.safe_load_file(f)
194
+ object = convert_names_to_ids(object)
191
195
  data = {
192
196
  item: Zendesk::DynamicContent.new(object),
193
197
  variants: object['variants'].map { |v| Zendesk::DynamicContentVariants.new(v) }
@@ -199,6 +203,24 @@ module Readiness
199
203
  array
200
204
  end
201
205
 
206
+ ##
207
+ # Converts various user Strings to the proper ID value
208
+ #
209
+ # @author Jason Colyer
210
+ # @since 1.0.100
211
+ # @param content [Hash] The dynamic content information from the YAML file
212
+ # @return [Hash]
213
+ def self.convert_names_to_ids(dynamic_content)
214
+ dynamic_content['variants'].each_with_index do |v, i|
215
+ if v['content'] =~ /\[Form\:\ .*\]/
216
+ name = v['content'].split('[Form: ').last.split(']').first
217
+ ticket_form = Readiness::Zendesk::TicketForms.find_by_name(@zendesk_client, name, @ticket_forms)
218
+ dynamic_content['variants'][i]['content'] = v['content'].gsub("[Form: #{ticket_form.name}]", ticket_form.id.to_s)
219
+ end
220
+ end
221
+ dynamic_content
222
+ end
223
+
202
224
  ##
203
225
  # Outputs an error report and exits with a status code of 1
204
226
  #
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab_support_readiness
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.99
4
+ version: 1.0.100
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Colyer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-09 00:00:00.000000000 Z
11
+ date: 2025-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport