class ZendeskSupportAPI::Jobs

Jobs class - developer.zendesk.com/rest_api/docs/support/job_statuses

Public Class Methods

list(client) click to toggle source

Make a request to show all job statuses

@param client [ZendeskSupportAPI::Client] The client instance to use @return [Hash]

@example

ZendeskSupportAPI::Jobs.show_many(client, ['abc123', 'def456'])
#=> {
#=>   "job_statuses": [
#=>     {
#=>       "id": "abc123",
#=>       "status": "completed",
#=>       ...
#=>     },
#=>     {
#=>      "id": "def456",
#=>      "status": "completed",
#=>      ...
#=>     }
#=>   ]
#=> }
# File lib/zendesk_support_api/jobs.rb, line 64
def self.list(client)
  client.request(:get, 'job_statuses.json')['job_statuses']
end
show(client, id) click to toggle source

Make a request to show the job status

@param client [ZendeskSupportAPI::Client] The client instance to use @param id [String] The id of the job to check @return [Hash]

@example

client = ZendeskSupportAPI::Client.new('user', '123', 'zendesk.com/api')
ZendeskSupportAPI::Jobs.show(client, 'abc123')
#=> {
#=>   "job_status"=> {
#=>     "id"=>"abc123",
#=>     "url"=>"abc123.json",
#=>     "total"=>2,
#=>     "progress"=>2,
#=>     "status"=>"completed",
#=>     "message"=>"Completed at 2020-04-29 13:26:40 +0000",
#=>     "results"=> [
#=>       {
#=>         "id"=>369731992959,
#=>         "status"=>"Updated",
#=>         "email"=>"test@example.com"
#=>       },
#=>       {
#=>         "id"=>369728778639,
#=>         "status"=>"Updated",
#=>         "email"=>"test2@example.com"
#=>       }
#=>     ]
#=>   }
#=> }
# File lib/zendesk_support_api/jobs.rb, line 38
def self.show(client, id)
  client.request(:get, "job_statuses/#{id}.json")
end
show_many(client, ids) click to toggle source

Show many job statuses

@param client [ZendeskSupportAPI::Client] The client instance to use @param ids [Array] An Array of job IDs to show @return [Hash]

@example

ZendeskSupportAPI::Jobs.show_many(client, ['abc123', 'def456'])
#=> {
#=>   "job_statuses": [
#=>     {
#=>       "id": "abc123",
#=>       "status": "completed",
#=>       ...
#=>     },
#=>     {
#=>      "id": "def456",
#=>      "status": "completed",
#=>      ...
#=>     }
#=>   ]
#=> }
# File lib/zendesk_support_api/jobs.rb, line 91
def self.show_many(client, ids)
  client.request(:get, "job_statuses/show_many.json?ids=#{ids.join(',')}")
end