Sha256: 27046c29190d71d85336baef5812be59012dbc370e66564d79abfa75f475e082
Contents?: true
Size: 1.75 KB
Versions: 1
Compression:
Stored size: 1.75 KB
Contents
require 'garage_client' require 'json' module BarbequeClient class Client def initialize(application:, default_queue:, endpoint:) @application = application @default_queue = default_queue @endpoint = endpoint end # @param [String] job - Job name to enqueue. # @param [Object] message - An object which is serializable as JSON. # @param optional [String] queue - A queue name to enqueue a job. # @return [Faraday::Response] def create_execution(job:, message:, queue: nil) params = { application: @application, job: job, message: message, queue: queue || @default_queue, } result = garage_client.post('/v2/job_executions', params) result.response end # @param [String] message_id - Job execution's message_id to retry # @param [Integer] delay_seconds - Retry delay in seconds. Maximum is 900s. # @return [Faraday::Response] def retry_execution(message_id:, delay_seconds: 0) result = garage_client.post( "/v1/job_executions/#{message_id}/retries", delay_seconds: delay_seconds, ) result.response end # @param [String] message_id - Job execution's message_id to check status # @param optioanl [String] fields - Response fields specification for Garage # @return [Faraday::Response] def execution(message_id:, fields: nil) params = {} if fields params[:fields] = fields end result = garage_client.get("/v1/job_executions/#{message_id}", params) result.response end private def garage_client @garage_client ||= GarageClient::Client.new( endpoint: @endpoint, path_prefix: '/', ) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
barbeque_client-0.8.2 | lib/barbeque_client/client.rb |