activejob-google_cloud_tasks-http 0.2.0 → 0.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1f75ab5b15c876b764b2a30837307a55179e4b158845237b1c46867331728f0e
4
- data.tar.gz: 8c367bb1dc438647af0a164fdbe9bc7fb89055e83ce4b1a26d845f1fce9ab0a7
3
+ metadata.gz: d0bb6cb0ea1af9910818bc288867091092c51cc47a48656b7ef86043ef33e4f6
4
+ data.tar.gz: d348eae84991f77b4fd1c34be5164dec70d7e6128b304721c0893ec7e9d5cbcb
5
5
  SHA512:
6
- metadata.gz: e75a8f803782889055e447ccb0dd13dd57978a63d7adeb33a5f59da8052965db1621bb3aa432087c6d36196170be3f323068fac3a173893bb9756c05798ef8ec
7
- data.tar.gz: 23ad68ee012868e82b8baf6ae0a28fc63c8a36e061cb0fe24308a6e544fe9ab0d04e04a170e22da555720b213bedc4a2713f22128cdd6de17c38cdbdb1de8c27
6
+ metadata.gz: 02ae30fd2d6a88bc5d5727f6deb74652f2b1e725d358800bffe10fd1b026444db887a98fc2e09e7823adfd909612646853f0fa65dde576a94cfae18b67fd8e28
7
+ data.tar.gz: 260e51cef2d639de9a94008c16f5e5927a0a902f966dcf894ce0d4b9ddfb024d00b34fc5627d1e5346b1a995702e0eb8ab960d39c1a7b76a3de38035d16218b2
@@ -0,0 +1,37 @@
1
+ name: CI
2
+ on:
3
+ - push
4
+
5
+ jobs:
6
+ test:
7
+ name: Test
8
+ runs-on: ubuntu-latest
9
+ strategy:
10
+ matrix:
11
+ ruby_image:
12
+ - ruby:latest
13
+ - ruby:3.3
14
+ - ruby:3.4
15
+ bundle:
16
+ - latest
17
+ - activejob-7.2
18
+ include:
19
+ - ruby_image: ruby:2.6
20
+ bundle: activejob-5.2
21
+ - ruby_image: ruby:2.6
22
+ bundle: activejob-6.1
23
+ - ruby_image: ruby:3.0
24
+ bundle: activejob-5.2
25
+ - ruby_image: ruby:3.0
26
+ bundle: activejob-6.1
27
+ container:
28
+ image: ${{ matrix.ruby_image }}
29
+ steps:
30
+ - name: Checkout code
31
+ uses: actions/checkout@v4
32
+
33
+ - name: Install dependencies and run tests
34
+ run: |
35
+ bundle
36
+ bundle exec appraisal install
37
+ bundle exec appraisal "${{ matrix.bundle }}" rake spec
data/.gitignore CHANGED
@@ -11,3 +11,6 @@
11
11
  .rspec_status
12
12
 
13
13
  Gemfile.lock
14
+
15
+ # Appraisal
16
+ /gemfiles
data/Appraisals ADDED
@@ -0,0 +1,18 @@
1
+
2
+ if RUBY_VERSION >= '3.1'
3
+ appraise 'latest' do
4
+ gem 'activejob'
5
+ end
6
+
7
+ appraise 'activejob-7.2' do
8
+ gem 'activejob', '~> 7.2.2'
9
+ end
10
+ end
11
+
12
+ appraise 'activejob-6.1' do
13
+ gem 'activejob', '~> 6.1.4'
14
+ end
15
+
16
+ appraise 'activejob-5.2' do
17
+ gem 'activejob', '~> 5.2.6'
18
+ end
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.3.0
2
+
3
+ Now the default Google::Cloud::Tasks client uses its default API version. Fixed #15.
4
+
1
5
  ## 0.2.0
2
6
 
3
7
  This version depends on google-cloud-tasks 2.0 or later. Since google-cloud-tasks 2.0 has API changes, upgrading to this version may affect to existing adapter initialization code. If you are initializing Google::Cloud::Tasks client manually, you will have to change `Google::Cloud::Tasks.new` to `Google::Cloud::Tasks.cloud_tasks` as follows:
data/Gemfile CHANGED
@@ -4,3 +4,5 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in activejob-google_cloud_tasks-http.gemspec
6
6
  gemspec
7
+
8
+ gem 'appraisal'
data/README.md CHANGED
@@ -28,8 +28,8 @@ Configure an adapter instance and pass it to Active Job:
28
28
  Rails.application.config.active_job.queue_adapter = ActiveJob::GoogleCloudTasks::HTTP::Adapter.new(
29
29
  project: 'a-gcp-project-name',
30
30
  location: 'asia-northeast1',
31
- url: 'https://an-endpoint-to-perform-jobs.a.run.app/_jobs',
32
- client: Google::Cloud::Tasks.cloud_tasks(version: :v2beta3), # optional
31
+ url: 'https://hibariya.org/',
32
+ client: Google::Cloud::Tasks.cloud_tasks, # optional
33
33
  task_options: { # optional
34
34
  oidc_token: {
35
35
  service_account_email: 'cloudrun-invoker@a-gcp-project-name.iam.gserviceaccount.com'
@@ -75,10 +75,10 @@ unless ARGV.include?("assets:precompile") # prevents running on assets:precompil
75
75
  project: 'my-project',
76
76
  location: 'europe-west2',
77
77
  url: 'https://www.example.com/jobs',
78
- client: Google::Cloud::Tasks.cloud_tasks(
79
- version: :v2beta3,
80
- credentials: JSON.parse(ENV["GOOGLE_CLOUD_PRODUCTION_KEYFILE"]) # this will cause an error if the environment variable does not exist
81
- )
78
+ client: Google::Cloud::Tasks.cloud_tasks { |config|
79
+ # this will cause an error if the environment variable does not exist
80
+ config.credentials = JSON.parse(ENV["GOOGLE_CLOUD_PRODUCTION_KEYFILE"])
81
+ }
82
82
  )
83
83
  end
84
84
  ```
@@ -23,6 +23,8 @@ Gem::Specification.new do |spec|
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ["lib"]
25
25
 
26
+ spec.required_ruby_version = '>= 2.6.0'
27
+
26
28
  spec.add_runtime_dependency "activejob"
27
29
  spec.add_runtime_dependency "google-cloud-tasks", ">= 2.0.0"
28
30
  spec.add_runtime_dependency "rack"
@@ -6,12 +6,18 @@ module ActiveJob
6
6
  module GoogleCloudTasks
7
7
  module HTTP
8
8
  class Adapter
9
- def initialize(project:, location:, url:, task_options: {}, client: nil)
9
+ def initialize(project:, location:, url:, task_options: {}, client: nil, enqueue_after_transaction_commit: false)
10
10
  @project = project
11
11
  @location = location
12
12
  @url = url
13
13
  @task_options = task_options
14
14
  @client = client
15
+ @enqueue_after_transaction_commit = enqueue_after_transaction_commit
16
+ end
17
+
18
+ # Method expected in Rails 7.2 and later
19
+ def enqueue_after_transaction_commit?
20
+ @enqueue_after_transaction_commit
15
21
  end
16
22
 
17
23
  def enqueue(job, attributes = {})
@@ -28,7 +34,7 @@ module ActiveJob
28
34
  private
29
35
 
30
36
  def client
31
- @client ||= Google::Cloud::Tasks.cloud_tasks(version: :v2beta3)
37
+ @client ||= Google::Cloud::Tasks.cloud_tasks
32
38
  end
33
39
 
34
40
  def build_task(job, attributes)
@@ -4,6 +4,11 @@ module ActiveJob
4
4
  module GoogleCloudTasks
5
5
  module HTTP
6
6
  module Inlining
7
+ # Method expected in Rails 7.2 and later
8
+ def enqueue_after_transaction_commit?
9
+ false
10
+ end
11
+
7
12
  def enqueue(job, *)
8
13
  ActiveJob::Base.execute job.serialize
9
14
  end
@@ -1,7 +1,7 @@
1
1
  module ActiveJob
2
2
  module GoogleCloudTasks
3
3
  module HTTP
4
- VERSION = "0.2.0"
4
+ VERSION = "0.4.0"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activejob-google_cloud_tasks-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - hibariya
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-31 00:00:00.000000000 Z
11
+ date: 2025-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob
@@ -101,10 +101,11 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
- - ".github/workflows/verify.yml"
104
+ - ".github/workflows/ci.yml"
105
105
  - ".gitignore"
106
106
  - ".rspec"
107
107
  - ".travis.yml"
108
+ - Appraisals
108
109
  - CHANGELOG.md
109
110
  - CODE_OF_CONDUCT.md
110
111
  - Gemfile
@@ -132,14 +133,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
132
133
  requirements:
133
134
  - - ">="
134
135
  - !ruby/object:Gem::Version
135
- version: '0'
136
+ version: 2.6.0
136
137
  required_rubygems_version: !ruby/object:Gem::Requirement
137
138
  requirements:
138
139
  - - ">="
139
140
  - !ruby/object:Gem::Version
140
141
  version: '0'
141
142
  requirements: []
142
- rubygems_version: 3.1.2
143
+ rubygems_version: 3.5.11
143
144
  signing_key:
144
145
  specification_version: 4
145
146
  summary: ActiveJob adapter for Google Cloud Tasks HTTP targets.
@@ -1,18 +0,0 @@
1
- name: Verify
2
- on:
3
- - push
4
-
5
- jobs:
6
- tests:
7
- name: Tests
8
- runs-on: ubuntu-latest
9
- container:
10
- image: ruby
11
- steps:
12
- - name: Checkout code
13
- uses: actions/checkout@v2
14
-
15
- - name: Install dependencies and run tests
16
- run: |
17
- bundle
18
- rake spec