Sha256: dbca4447d6c98f990a8b1c987fe3132f773bf007a8981f05dfc5373c74d14c79

Contents?: true

Size: 484 Bytes

Versions: 1

Compression:

Stored size: 484 Bytes

Contents

# frozen_string_literal: true

require_relative "client"
require_relative "object"

module Mergent
  class Task < Mergent::Object
    ATTRS = %i[id name queue status request scheduled_for created_at].freeze

    ATTRS.each do |name|
      define_method(name) do
        @_data[name]
      end
    end

    def self.create(params = {})
      data = Client.post(
        "tasks",
        { queue: Mergent::Object::DEFAULT_QUEUE }.merge(params)
      )
      new(data)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mergent-1.0.0 lib/mergent/task.rb