gitlab_support_readiness 1.0.9 → 1.0.11
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 +4 -4
 - data/lib/support_readiness/gitlab/issues.rb +1 -1
 - data/lib/support_readiness/gitlab/repositories.rb +1 -1
 - data/lib/support_readiness/zendesk/articles.rb +56 -2
 - data/lib/support_readiness/zendesk/macros.rb +1 -1
 - data/lib/support_readiness/zendesk/tickets.rb +5 -5
 - data/lib/support_readiness/zendesk/users.rb +0 -1
 - data/lib/support_readiness/zendesk/views.rb +4 -6
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 7b80e496307fbfaa496e95ca2af86a765ec8264d08cd70c5dde730305c597d2e
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 0c1b9bf16c261245a4c8d8928d581bfe08d7b8e5dde42cee7fc55129233b42c4
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 9d38234f4a29dc2965e3544eb4e8f75830992cde999619b655ea1941c63255e1debb8aacccc841d92ecf6580a8ea2faf2d2c7edfbb9064df40fa5cd88c333977
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 7419e41c9dbbe22058e0e567dc79b26c5408b3d4766e9d618dc3dfbd494f6b6619cf1d6a312c14dbd2df852c230098b75cbb76161c0f03b586638505e20a107d
         
     | 
| 
         @@ -271,7 +271,7 @@ module Readiness 
     | 
|
| 
       271 
271 
     | 
    
         
             
                    array = []
         
     | 
| 
       272 
272 
     | 
    
         
             
                    page = 0
         
     | 
| 
       273 
273 
     | 
    
         
             
                    loop do
         
     | 
| 
       274 
     | 
    
         
            -
                      response = client.connection.get "projects/#{project.id}/issues/#{ 
     | 
| 
      
 274 
     | 
    
         
            +
                      response = client.connection.get "projects/#{project.id}/issues/#{issue.iid}/notes?per_page=100&page=#{page}"
         
     | 
| 
       275 
275 
     | 
    
         
             
                      handle_request_error(0, 'GitLab', response.status) unless response.status == 200
         
     | 
| 
       276 
276 
     | 
    
         
             
                      body = Oj.load(response.body)
         
     | 
| 
       277 
277 
     | 
    
         
             
                      array += body
         
     | 
| 
         @@ -190,7 +190,7 @@ module Readiness 
     | 
|
| 
       190 
190 
     | 
    
         
             
                  #   pp file
         
     | 
| 
       191 
191 
     | 
    
         
             
                  #   # => true
         
     | 
| 
       192 
192 
     | 
    
         
             
                  def self.delete_file!(client, project, path, params)
         
     | 
| 
       193 
     | 
    
         
            -
                    response = client.connection.delete "projects/#{project.id}/repository/files/#{CGI.escape(path)}", params 
     | 
| 
      
 193 
     | 
    
         
            +
                    response = client.connection.delete "projects/#{project.id}/repository/files/#{CGI.escape(path)}", params
         
     | 
| 
       194 
194 
     | 
    
         
             
                    handle_request_error(1, 'GitLab', response.status, { action: 'Delete file in repo', id: "#{project.id}" }) unless response.status == 204
         
     | 
| 
       195 
195 
     | 
    
         
             
                    true
         
     | 
| 
       196 
196 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -156,7 +156,7 @@ module Readiness 
     | 
|
| 
       156 
156 
     | 
    
         
             
                  end
         
     | 
| 
       157 
157 
     | 
    
         | 
| 
       158 
158 
     | 
    
         
             
                  ##
         
     | 
| 
       159 
     | 
    
         
            -
                  # Updates an article. Will exit if unsuccessful
         
     | 
| 
      
 159 
     | 
    
         
            +
                  # Updates an article (both metadata and translation). Will exit if unsuccessful
         
     | 
| 
       160 
160 
     | 
    
         
             
                  #
         
     | 
| 
       161 
161 
     | 
    
         
             
                  # @author Jason Colyer
         
     | 
| 
       162 
162 
     | 
    
         
             
                  # @since 1.0.0
         
     | 
| 
         @@ -177,11 +177,65 @@ module Readiness 
     | 
|
| 
       177 
177 
     | 
    
         
             
                  #   pp update.body
         
     | 
| 
       178 
178 
     | 
    
         
             
                  #   # => "Use a tripod and low light approved camera"
         
     | 
| 
       179 
179 
     | 
    
         
             
                  def self.update!(client, article)
         
     | 
| 
      
 180 
     | 
    
         
            +
                    update_article_metadata!(client, article)
         
     | 
| 
      
 181 
     | 
    
         
            +
                    update_article_translation!(client, article)
         
     | 
| 
      
 182 
     | 
    
         
            +
                    Articles.find!(client, article.id)
         
     | 
| 
      
 183 
     | 
    
         
            +
                  end
         
     | 
| 
      
 184 
     | 
    
         
            +
             
     | 
| 
      
 185 
     | 
    
         
            +
                  ##
         
     | 
| 
      
 186 
     | 
    
         
            +
                  # Updates an article's metadata. Will exit if unsuccessful
         
     | 
| 
      
 187 
     | 
    
         
            +
                  #
         
     | 
| 
      
 188 
     | 
    
         
            +
                  # @author Jason Colyer
         
     | 
| 
      
 189 
     | 
    
         
            +
                  # @since 1.0.10
         
     | 
| 
      
 190 
     | 
    
         
            +
                  # @param client [Object] An instance of {Readiness::Zendesk::Client}
         
     | 
| 
      
 191 
     | 
    
         
            +
                  # @param article [Object] An instance of {Readiness::Zendesk::Articles}
         
     | 
| 
      
 192 
     | 
    
         
            +
                  # @return [Object] An instance of {Readiness::Zendesk::Articles}
         
     | 
| 
      
 193 
     | 
    
         
            +
                  # @see https://developer.zendesk.com/api-reference/help_center/help-center-api/articles/#update-article Zendesk API > Articles > Update Article
         
     | 
| 
      
 194 
     | 
    
         
            +
                  # @example
         
     | 
| 
      
 195 
     | 
    
         
            +
                  #   require 'support_readiness'
         
     | 
| 
      
 196 
     | 
    
         
            +
                  #   config = Readiness::Zendesk::Configuration.new
         
     | 
| 
      
 197 
     | 
    
         
            +
                  #   config.username = 'alice@example.com'
         
     | 
| 
      
 198 
     | 
    
         
            +
                  #   config.token = 'test123abc'
         
     | 
| 
      
 199 
     | 
    
         
            +
                  #   config.url = 'https://example.zendesk.com/api/v2'
         
     | 
| 
      
 200 
     | 
    
         
            +
                  #   client = Readiness::Zendesk::Client.new(config)
         
     | 
| 
      
 201 
     | 
    
         
            +
                  #   article = Readiness::Zendesk::Articles.find!(client, 35468)
         
     | 
| 
      
 202 
     | 
    
         
            +
                  #   artricle.promoted = true
         
     | 
| 
      
 203 
     | 
    
         
            +
                  #   update = Readiness::Zendesk::Articles.update_article_metadata!(client, article)
         
     | 
| 
      
 204 
     | 
    
         
            +
                  #   pp update.promoted
         
     | 
| 
      
 205 
     | 
    
         
            +
                  #   # => true
         
     | 
| 
      
 206 
     | 
    
         
            +
                  def self.update_article_metadata!(client, article)
         
     | 
| 
       180 
207 
     | 
    
         
             
                    response = client.connection.put "help_center/articles/#{article.id}", to_nearly_clean_json_with_key(article, 'article', ['user_segment_id'])
         
     | 
| 
       181 
     | 
    
         
            -
                    handle_request_error(1, 'Zendesk', response.status, { action: 'Update article', id: article.id, message: Oj.load(response.body)}) unless response.status == 200
         
     | 
| 
      
 208 
     | 
    
         
            +
                    handle_request_error(1, 'Zendesk', response.status, { action: 'Update article metadata', id: article.id, message: Oj.load(response.body)}) unless response.status == 200
         
     | 
| 
       182 
209 
     | 
    
         
             
                    Articles.new(Oj.load(response.body)['article'])
         
     | 
| 
       183 
210 
     | 
    
         
             
                  end
         
     | 
| 
       184 
211 
     | 
    
         | 
| 
      
 212 
     | 
    
         
            +
                  ##
         
     | 
| 
      
 213 
     | 
    
         
            +
                  # Updates an article's translation. Will exit if unsuccessful
         
     | 
| 
      
 214 
     | 
    
         
            +
                  #
         
     | 
| 
      
 215 
     | 
    
         
            +
                  # @author Jason Colyer
         
     | 
| 
      
 216 
     | 
    
         
            +
                  # @since 1.0.10
         
     | 
| 
      
 217 
     | 
    
         
            +
                  # @param client [Object] An instance of {Readiness::Zendesk::Client}
         
     | 
| 
      
 218 
     | 
    
         
            +
                  # @param article [Object] An instance of {Readiness::Zendesk::Articles}
         
     | 
| 
      
 219 
     | 
    
         
            +
                  # @return [Object] An instance of {Readiness::Zendesk::Articles}
         
     | 
| 
      
 220 
     | 
    
         
            +
                  # @see https://developer.zendesk.com/api-reference/help_center/help-center-api/translations/#update-translation Zendesk API > Translations > Update Translation
         
     | 
| 
      
 221 
     | 
    
         
            +
                  # @example
         
     | 
| 
      
 222 
     | 
    
         
            +
                  #   require 'support_readiness'
         
     | 
| 
      
 223 
     | 
    
         
            +
                  #   config = Readiness::Zendesk::Configuration.new
         
     | 
| 
      
 224 
     | 
    
         
            +
                  #   config.username = 'alice@example.com'
         
     | 
| 
      
 225 
     | 
    
         
            +
                  #   config.token = 'test123abc'
         
     | 
| 
      
 226 
     | 
    
         
            +
                  #   config.url = 'https://example.zendesk.com/api/v2'
         
     | 
| 
      
 227 
     | 
    
         
            +
                  #   client = Readiness::Zendesk::Client.new(config)
         
     | 
| 
      
 228 
     | 
    
         
            +
                  #   article = Readiness::Zendesk::Articles.find!(client, 35468)
         
     | 
| 
      
 229 
     | 
    
         
            +
                  #   artricle.body = 'Contact support'
         
     | 
| 
      
 230 
     | 
    
         
            +
                  #   update = Readiness::Zendesk::Articles.update_article_translation!(client, article)
         
     | 
| 
      
 231 
     | 
    
         
            +
                  #   pp update.body
         
     | 
| 
      
 232 
     | 
    
         
            +
                  #   # => "Contact support"
         
     | 
| 
      
 233 
     | 
    
         
            +
                  def self.update_article_translation!(client, article)
         
     | 
| 
      
 234 
     | 
    
         
            +
                    response = client.connection.put "help_center/articles/#{article.id}/translations/#{article.locale}", to_nearly_clean_json_with_key(article, 'translation', ['user_segment_id'])
         
     | 
| 
      
 235 
     | 
    
         
            +
                    handle_request_error(1, 'Zendesk', response.status, { action: 'Update article translation', id: article.id, message: Oj.load(response.body)}) unless response.status == 200
         
     | 
| 
      
 236 
     | 
    
         
            +
                    Oj.load(response.body)['translation']
         
     | 
| 
      
 237 
     | 
    
         
            +
                  end
         
     | 
| 
      
 238 
     | 
    
         
            +
             
     | 
| 
       185 
239 
     | 
    
         
             
                  ##
         
     | 
| 
       186 
240 
     | 
    
         
             
                  # Archives an article. Will exit if unsuccessful
         
     | 
| 
       187 
241 
     | 
    
         
             
                  #
         
     | 
| 
         @@ -248,7 +248,7 @@ module Readiness 
     | 
|
| 
       248 
248 
     | 
    
         
             
                  #   deletes = Readiness::Zendesk::Macros.delete_many!(client, [25, 26])
         
     | 
| 
       249 
249 
     | 
    
         
             
                  #   pp deletes
         
     | 
| 
       250 
250 
     | 
    
         
             
                  #   # => true
         
     | 
| 
       251 
     | 
    
         
            -
                  def self.delete_many(client, mids)
         
     | 
| 
      
 251 
     | 
    
         
            +
                  def self.delete_many!(client, mids)
         
     | 
| 
       252 
252 
     | 
    
         
             
                    response = client.connection.delete("macros/destroy_many?ids=#{mids.join(',')}")
         
     | 
| 
       253 
253 
     | 
    
         
             
                    handle_request_error(1, 'Zendesk', response.status, { action: 'Delete many macros', message: Oj.load(response.body)}) unless response.status == 204
         
     | 
| 
       254 
254 
     | 
    
         
             
                    true
         
     | 
| 
         @@ -478,7 +478,7 @@ module Readiness 
     | 
|
| 
       478 
478 
     | 
    
         
             
                  # @param client [Object] An instance of {Readiness::Zendesk::Client}
         
     | 
| 
       479 
479 
     | 
    
         
             
                  # @param tid [Integer] The deleted ticket's ID
         
     | 
| 
       480 
480 
     | 
    
         
             
                  # @return [Object] A {Readiness::Zendesk::JobStatuses} instance
         
     | 
| 
       481 
     | 
    
         
            -
                  # @see https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#delete-ticket- 
     | 
| 
      
 481 
     | 
    
         
            +
                  # @see https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#delete-ticket-permanently Zendesk API > Tickets > Delete Ticket Permanently
         
     | 
| 
       482 
482 
     | 
    
         
             
                  # @example
         
     | 
| 
       483 
483 
     | 
    
         
             
                  #   require 'support_readiness'
         
     | 
| 
       484 
484 
     | 
    
         
             
                  #   config = Readiness::Zendesk::Configuration.new
         
     | 
| 
         @@ -517,7 +517,7 @@ module Readiness 
     | 
|
| 
       517 
517 
     | 
    
         
             
                  #   # => [33, 34]
         
     | 
| 
       518 
518 
     | 
    
         
             
                  def self.incidents(client, ticket)
         
     | 
| 
       519 
519 
     | 
    
         
             
                    array = []
         
     | 
| 
       520 
     | 
    
         
            -
                    opts = "page[size]=100 
     | 
| 
      
 520 
     | 
    
         
            +
                    opts = "page[size]=100"
         
     | 
| 
       521 
521 
     | 
    
         
             
                    loop do
         
     | 
| 
       522 
522 
     | 
    
         
             
                      response = client.connection.get("tickets/#{ticket.id}/incidents?#{opts}")
         
     | 
| 
       523 
523 
     | 
    
         
             
                      handle_request_error(0, 'Zendesk', response.status) unless response.status == 200
         
     | 
| 
         @@ -550,9 +550,9 @@ module Readiness 
     | 
|
| 
       550 
550 
     | 
    
         
             
                  #   # => [33, 34]
         
     | 
| 
       551 
551 
     | 
    
         
             
                  def self.problems(client)
         
     | 
| 
       552 
552 
     | 
    
         
             
                    array = []
         
     | 
| 
       553 
     | 
    
         
            -
                    opts = "page[size]=100 
     | 
| 
      
 553 
     | 
    
         
            +
                    opts = "page[size]=100"
         
     | 
| 
       554 
554 
     | 
    
         
             
                    loop do
         
     | 
| 
       555 
     | 
    
         
            -
                      response = client.connection.get(" 
     | 
| 
      
 555 
     | 
    
         
            +
                      response = client.connection.get("problems?#{opts}")
         
     | 
| 
       556 
556 
     | 
    
         
             
                      handle_request_error(0, 'Zendesk', response.status) unless response.status == 200
         
     | 
| 
       557 
557 
     | 
    
         
             
                      body = Oj.load(response.body)
         
     | 
| 
       558 
558 
     | 
    
         
             
                      array += body['tickets'].map { |t| Tickets.new(t) }
         
     | 
| 
         @@ -734,7 +734,7 @@ module Readiness 
     | 
|
| 
       734 
734 
     | 
    
         
             
                  #   # => 18
         
     | 
| 
       735 
735 
     | 
    
         
             
                  def self.list_suspended(client)
         
     | 
| 
       736 
736 
     | 
    
         
             
                    array = []
         
     | 
| 
       737 
     | 
    
         
            -
                    opts = "page[size]=100 
     | 
| 
      
 737 
     | 
    
         
            +
                    opts = "page[size]=100"
         
     | 
| 
       738 
738 
     | 
    
         
             
                    loop do
         
     | 
| 
       739 
739 
     | 
    
         
             
                      response = client.connection.get("suspended_tickets?#{opts}")
         
     | 
| 
       740 
740 
     | 
    
         
             
                      handle_request_error(0, 'Zendesk', response.status) unless response.status == 200
         
     | 
| 
         @@ -827,7 +827,6 @@ module Readiness 
     | 
|
| 
       827 
827 
     | 
    
         
             
                      handle_request_error(0, 'Zendesk', response.status) unless response.status == 200
         
     | 
| 
       828 
828 
     | 
    
         
             
                      body = Oj.load(response.body)
         
     | 
| 
       829 
829 
     | 
    
         
             
                      array += body['organization_memberships'].map { |o| OrganizationMemberships.new(o) }
         
     | 
| 
       830 
     | 
    
         
            -
                      break if limit != 0 && array.count >= (limit * 100)
         
     | 
| 
       831 
830 
     | 
    
         
             
                      break unless body['meta']['has_more']
         
     | 
| 
       832 
831 
     | 
    
         | 
| 
       833 
832 
     | 
    
         
             
                      opts = body['links'] ['next'].split('?').last
         
     | 
| 
         @@ -336,12 +336,10 @@ module Readiness 
     | 
|
| 
       336 
336 
     | 
    
         
             
                  def self.preview!(client, view)
         
     | 
| 
       337 
337 
     | 
    
         
             
                    converted = create_or_update_object(view)
         
     | 
| 
       338 
338 
     | 
    
         
             
                    data = {
         
     | 
| 
       339 
     | 
    
         
            -
                       
     | 
| 
       340 
     | 
    
         
            -
             
     | 
| 
       341 
     | 
    
         
            -
             
     | 
| 
       342 
     | 
    
         
            -
             
     | 
| 
       343 
     | 
    
         
            -
                      }
         
     | 
| 
       344 
     | 
    
         
            -
                    }.compact.to_json
         
     | 
| 
      
 339 
     | 
    
         
            +
                      all: converted[:all],
         
     | 
| 
      
 340 
     | 
    
         
            +
                      any: converted[:any],
         
     | 
| 
      
 341 
     | 
    
         
            +
                      output: converted[:output]
         
     | 
| 
      
 342 
     | 
    
         
            +
                    }.compact
         
     | 
| 
       345 
343 
     | 
    
         
             
                    response = client.connection.post 'views/preview', { view: data }.to_json
         
     | 
| 
       346 
344 
     | 
    
         
             
                    handle_request_error(1, 'Zendesk', response.status, { action: 'Preview a view', message: Oj.load(response.body)}) unless response.status == 200
         
     | 
| 
       347 
345 
     | 
    
         
             
                    Oj.load(response.body)
         
     |