Class: ActiveJob::GoogleCloudTasks::HTTP::Adapter
- Inherits:
-
Object
- Object
- ActiveJob::GoogleCloudTasks::HTTP::Adapter
- Includes:
- Inlining
- Defined in:
- lib/active_job/google_cloud_tasks/http/adapter.rb
Instance Method Summary collapse
- #enqueue(job, attributes = {}) ⇒ Object
- #enqueue_at(job, scheduled_at) ⇒ Object
-
#initialize(project:, location:, url:, task_options: {}, client: nil) ⇒ Adapter
constructor
A new instance of Adapter.
Constructor Details
#initialize(project:, location:, url:, task_options: {}, client: nil) ⇒ Adapter
Returns a new instance of Adapter.
9 10 11 12 13 14 15 |
# File 'lib/active_job/google_cloud_tasks/http/adapter.rb', line 9 def initialize(project:, location:, url:, task_options: {}, client: nil) @project = project @location = location @url = url @task_options = @client = client end |
Instance Method Details
#enqueue(job, attributes = {}) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/active_job/google_cloud_tasks/http/adapter.rb', line 17 def enqueue(job, attributes = {}) path = client.queue_path(project: @project, location: @location, queue: job.queue_name) task = build_task(job, attributes) client.create_task parent: path, task: task end |
#enqueue_at(job, scheduled_at) ⇒ Object
24 25 26 |
# File 'lib/active_job/google_cloud_tasks/http/adapter.rb', line 24 def enqueue_at(job, scheduled_at) enqueue job, scheduled_at: scheduled_at end |