gitlab_support_readiness 1.0.87 → 1.0.89

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: 492b67f2747706975883623623b7894c267633e2257fca754869eece07c6b2a3
4
- data.tar.gz: 99384acf0bc143692a27dd3bf11d011fc4628b44f0a3f0051192becb744f40d6
3
+ metadata.gz: 2c8835592aa238eb94c87735d75b0843b1b818763c5216d5f459760207c223ff
4
+ data.tar.gz: 53fb22b156d00e5591453c9c3bf1e7810bb26ddf9ed613afcea9a93420014e1e
5
5
  SHA512:
6
- metadata.gz: e93c5270b1c4807415955f804d1830eaf84b9faa8b1ea7452f669918e621f7a95536ffc086aac9321e82d93b50ef5e9a675e4d6db99de188cc041cd5eb653cca
7
- data.tar.gz: e6b9fbc160c9c12609ff705f5302f76f03caee381dd5fac53b8a3681e904429de655a77dcf2006b08885d8cb4af7e3cb4e245b7f8016f4d9d6b5f3005d4b3e2a
6
+ metadata.gz: 6171098ac8c59bd806af5b37a062e32f9ad539f43c5ed84a9a21f3d925cfbdf0037297517dd99abdd2c87f31e97b0fe1003edff8aea411419abbb7ae9f70ccd4
7
+ data.tar.gz: 47e02859ee9f1430b4a9ae8bd60ff3f2e6553cd1f1b3c953ce21c3f46c9ada88f235c77809f477d089f77362cf7b6520fd81a87f09b2007e7305d188bb24f02a
@@ -25,9 +25,123 @@ module Readiness
25
25
  issue.description = message(file_path)
26
26
  create = Readiness::GitLab::Issues.create!(@gitlab_client, project, issue)
27
27
  puts "Issue created: #{create.web_url}"
28
+ create_yaml_file(create, file_path) if advanced == 'no'
28
29
  exit 0
29
30
  end
30
31
 
32
+ ##
33
+ # Create the macro YAML file
34
+ #
35
+ # @author Jason Colyer
36
+ # @since 1.0.88
37
+ def self.create_yaml_file(issue, path)
38
+ macro_project_id = if instance == 'Zendesk Global'
39
+ 53382019
40
+ else
41
+ 53561342
42
+ end
43
+ macro_project = Readiness::GitLab::Projects.find!(@gitlab_client, macro_project_id)
44
+ commit_params = {
45
+ branch: 'master',
46
+ commit_message: 'Creating new macro',
47
+ actions: [
48
+ {
49
+ file_path: path,
50
+ content: yaml_contents,
51
+ action: 'create'
52
+ }
53
+ ]
54
+ }
55
+ Readiness::GitLab::Repositories.create_commit!(@gitlab_client, macro_project, commit_params)
56
+ comment_params = {
57
+ body: macro_created_message
58
+ }
59
+ comment = Readiness::GitLab::Issues.create_comment!(@gitlab_client, project, issue, comment_params)
60
+ end
61
+
62
+ ##
63
+ # Return a String for a macro creation comment
64
+ #
65
+ # @author Jason Colyer
66
+ # @since 1.0.88
67
+ def self.macro_created_message
68
+ <<~STRING
69
+ Greetings @#{requester.username} !
70
+
71
+ Your macro has now been created on the #{instance} instance. Keep in mind a hard refresh of your Zendesk tab might be required to see the macro listed.
72
+
73
+ If using a managed content file for this new macro and you had not populated it before your submission, a placeholder file was created for you (and you will need to make a MR on it to update the macro's wording).
74
+
75
+ If you have any problems, please reopen this issue and ping the Support Readiness team for assistance.
76
+
77
+ /label ~"Readiness::Completed"
78
+
79
+ /close
80
+ STRING
81
+ end
82
+
83
+ ##
84
+ # Sets the contents for a YAML file
85
+ #
86
+ # @author Jason Colyer
87
+ # @since 1.0.88
88
+ def self.yaml_contents
89
+ {
90
+ 'title' => name,
91
+ 'active' => true,
92
+ 'description' => '',
93
+ 'actions' => determine_actions,
94
+ 'restriction' => nil,
95
+ 'contains_managed_content' => (comment != 'none')
96
+ }.to_yaml
97
+ end
98
+
99
+ ##
100
+ # Determine the actions for a YAML file
101
+ #
102
+ # @author Jason Colyer
103
+ # @since 1.0.88
104
+ def self.determine_actions
105
+ actions = []
106
+ if ticket_state != 'none'
107
+ actions.push({ 'field' => 'status', 'value' => ticket_state })
108
+ end
109
+ if assignee == 'Unassign'
110
+ actions.push({ 'field' => 'assignee_id', 'value' => '' })
111
+ end
112
+ if assignee == 'Current User'
113
+ actions.push({ 'field' => 'assignee_id', 'value' => 'current_user' })
114
+ end
115
+ if tag != 'None'
116
+ actions.push({ 'field' => 'current_tags', 'value' => tag })
117
+ end
118
+ if comment == 'Public'
119
+ actions.push({ 'field' => 'comment_mode_is_public', 'value' => true })
120
+ end
121
+ if comment == 'Private'
122
+ actions.push({ 'field' => 'comment_mode_is_public', 'value' => false })
123
+ end
124
+ actions
125
+ end
126
+
127
+ ##
128
+ # Sets the global variable ticket_state
129
+ #
130
+ # @author Jason Colyer
131
+ # @since 1.0.88
132
+ def self.ticket_state
133
+ @ticket_state ||= ENV.fetch('CREATE_MACRO_STATE', 'none')
134
+ end
135
+
136
+ ##
137
+ # Sets the global variable advanced
138
+ #
139
+ # @author Jason Colyer
140
+ # @since 1.0.88
141
+ def self.advanced
142
+ @advanced ||= ENV.fetch('CREATE_MACRO_ADVANCED', 'yes')
143
+ end
144
+
31
145
  def self.create_macro_file_if_needed
32
146
  return nil if comment == 'none'
33
147
 
@@ -161,6 +275,7 @@ module Readiness
161
275
  - Assigne change: #{assignee}
162
276
  - Tag to add: #{tag}
163
277
  - Type of comment: #{comment}
278
+ - Ticket state to set: #{ticket_state}
164
279
  - Managed content file: #{file_path.nil? ? 'N/A' : file_path}
165
280
 
166
281
  Some other details are:
@@ -10,7 +10,7 @@ module Readiness
10
10
  # @author Jason Colyer
11
11
  # @since 1.0.12
12
12
  class TicketFieldOptions < Readiness::Client
13
- attr_accessor :id, :name, :position, :value
13
+ attr_accessor :id, :name, :position, :raw_name, :value
14
14
 
15
15
  ##
16
16
  # Creates a new {Readiness::Zendesk::TicketFieldOptions} instance
@@ -25,6 +25,7 @@ module Readiness
25
25
  @id = object['id']
26
26
  @name = object['name']
27
27
  @position = object['position']
28
+ @raw_name = object['raw_name']
28
29
  @value = object['value']
29
30
  end
30
31
 
@@ -10,7 +10,7 @@ module Readiness
10
10
  # @author Jason Colyer
11
11
  # @since 1.0.0
12
12
  class TicketFields < Readiness::Client
13
- attr_accessor :active, :agent_description, :collapsed_for_agents, :custom_field_options, :description, :editable_in_portal, :id, :key, :position, :regexp_for_validation, :removable, :required, :system_field_options, :tag, :title, :title_in_portal, :type, :visible_in_portal
13
+ attr_accessor :active, :agent_description, :collapsed_for_agents, :custom_field_options, :description, :editable_in_portal, :id, :key, :position, :raw_title_in_portal, :regexp_for_validation, :removable, :required, :system_field_options, :tag, :title, :title_in_portal, :type, :visible_in_portal
14
14
 
15
15
  ##
16
16
  # Creates a new {Readiness::Zendesk::TicketFields} instance
@@ -37,6 +37,7 @@ module Readiness
37
37
  @id = object['id']
38
38
  @key = object['key']
39
39
  @position = object['position']
40
+ @raw_title_in_portal = object['raw_title_in_portal']
40
41
  @regexp_for_validation = object['regexp_for_validation']
41
42
  @removable = object['removable']
42
43
  @required = object['required']
@@ -10,7 +10,7 @@ module Readiness
10
10
  # @author Jason Colyer
11
11
  # @since 1.0.0
12
12
  class TicketForms < Readiness::Client
13
- attr_accessor :active, :agent_conditions, :default, :display_name, :end_user_conditions, :end_user_visible, :id, :in_all_brands, :name, :position, :restricted_brand_ids, :ticket_field_ids
13
+ attr_accessor :active, :agent_conditions, :default, :display_name, :end_user_conditions, :end_user_visible, :id, :in_all_brands, :name, :position, :raw_display_name, :restricted_brand_ids, :ticket_field_ids
14
14
 
15
15
  ##
16
16
  # Creates a new {Readiness::Zendesk::TicketForms} instance
@@ -32,6 +32,7 @@ module Readiness
32
32
  @in_all_brands = object['in_all_brands']
33
33
  @name = object['name']
34
34
  @position = object['position']
35
+ @raw_display_name = object['raw_display_name']
35
36
  @restricted_brand_ids = object['restricted_brand_ids']
36
37
  @ticket_field_ids = object['ticket_field_ids']
37
38
  end
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.87
4
+ version: 1.0.89
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Colyer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-30 00:00:00.000000000 Z
11
+ date: 2025-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport