rails-cloud-tasks 0.0.7 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5c0ccb60060c536355871363149f8de556e58b02d291df55d97523eb7bbf19f
4
- data.tar.gz: 001f4d65d8bd99f50ff8dd26effb28d20627deff7377dd3b33aaed3bd1418e3a
3
+ metadata.gz: 952737c3d117251bc7512f2867fff43b13329baea58cefda03a1cbb202782b72
4
+ data.tar.gz: a341d110cce7e062c2b0102054f2afeaf5c407e262ed05f678119fac6917233b
5
5
  SHA512:
6
- metadata.gz: dbefd470b602eadb6e0a5b4089eb8a690fde6176a221d3c6909f2ac51778c9b5233f8a77315551355f633df46c9c430c3a1e7d68c70ebc4e39f4799c7bdfdfc2
7
- data.tar.gz: 104087dd434acb527c79044db63ad6ddd947062b69d833db7ad1984333850083b198d67dd4c5dcd33b381fe0999362173ccdd79aa36058528e8f90f5dc024eef
6
+ metadata.gz: 7907df6e3c2ccf1dc053113b50e5a06f3b1051f2ec3ca6be6c1a788ae69d60b73b5034d3a8dba89136b5a606a870243f18667064a815fa926a1d9c3fce4cac6f
7
+ data.tar.gz: e06333fe3e9770248045a35dbc7f3749b1b853e13ade2470a3ad86a9ea6ba7e7e7a7d8a05a524c5c02c33f7240928e952cd84e4b570213e042735dfd2ad9b18a
data/.rubocop.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.4
2
+ TargetRubyVersion: 2.7
3
3
  DisplayCopNames: true
4
4
  NewCops: enable
5
5
 
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.2
1
+ 2.7.4
@@ -37,7 +37,8 @@ module RailsCloudTasks
37
37
  http_request: {
38
38
  http_method: :POST,
39
39
  url: url,
40
- body: { job: job.serialize }.to_json.force_encoding('ASCII-8BIT')
40
+ body: { job: job.serialize }.to_json.force_encoding('ASCII-8BIT'),
41
+ headers: { 'Content-Type': 'application/json' }
41
42
  }.merge(auth),
42
43
  schedule_time: timestamp && Google::Protobuf::Timestamp.new.tap do |ts|
43
44
  ts.seconds = timestamp
@@ -1,7 +1,6 @@
1
1
  module RailsCloudTasks
2
2
  class Credentials
3
3
  require 'googleauth'
4
- require 'google/apis/cloudscheduler_v1'
5
4
  require 'google/apis/iamcredentials_v1'
6
5
 
7
6
  DEFAULT_SCOPES = ['https://www.googleapis.com/auth/cloud-platform'].freeze
@@ -2,6 +2,8 @@ module RailsCloudTasks
2
2
  module Instrumentation
3
3
  class Default
4
4
  def transaction_name!(*opts); end
5
+
6
+ def add_custom_attributes(custom_attributes); end
5
7
  end
6
8
  end
7
9
  end
@@ -5,6 +5,10 @@ module RailsCloudTasks
5
5
  agent.set_transaction_name(*opts)
6
6
  end
7
7
 
8
+ def add_custom_attributes(custom_attributes)
9
+ agent.add_custom_attributes(custom_attributes)
10
+ end
11
+
8
12
  def agent
9
13
  @agent ||= ::NewRelic::Agent
10
14
  end
@@ -15,5 +15,9 @@ module RailsCloudTasks
15
15
  def transaction_name!(*opts)
16
16
  agent.transaction_name!(opts)
17
17
  end
18
+
19
+ def add_custom_attributes(custom_attributes)
20
+ agent.add_custom_attributes(custom_attributes)
21
+ end
18
22
  end
19
23
  end
@@ -15,6 +15,10 @@ module RailsCloudTasks
15
15
  request = ::Rack::Request.new(env)
16
16
  job_args = extract_args(request)
17
17
 
18
+ RailsCloudTasks::Instrumentation.add_custom_attributes(
19
+ { request_body: job_args }
20
+ )
21
+
18
22
  job_class.perform_now(*job_args)
19
23
 
20
24
  response(200, {})
@@ -13,6 +13,10 @@ module RailsCloudTasks
13
13
  "RailsCloudTasks/#{job['job_class']}/perform_now"
14
14
  )
15
15
 
16
+ RailsCloudTasks::Instrumentation.add_custom_attributes(
17
+ { request_body: job['arguments'] }
18
+ )
19
+
16
20
  ActiveJob::Base.execute(job)
17
21
  response(200, {})
18
22
  rescue Rack::InvalidPayloadError => e
@@ -25,9 +25,10 @@ module RailsCloudTasks
25
25
  end
26
26
 
27
27
  def client
28
- @client ||= Google::Cloud::Scheduler.cloud_scheduler.configure do |config|
29
- config.credentials = credentials.generate(service_account_email)
30
- end
28
+ configure = lambda { |client|
29
+ client.configure.credentials = credentials.generate(service_account_email)
30
+ }
31
+ @client ||= Google::Cloud::Scheduler.cloud_scheduler.tap(&configure)
31
32
  end
32
33
 
33
34
  protected
@@ -1,3 +1,3 @@
1
1
  module RailsCloudTasks
2
- VERSION = '0.0.7'.freeze
2
+ VERSION = '0.0.10'.freeze
3
3
  end
@@ -17,13 +17,12 @@ Gem::Specification.new do |spec|
17
17
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
18
  spec.require_paths = ['lib']
19
19
 
20
- spec.required_ruby_version = '>= 2.4'
20
+ spec.required_ruby_version = '>= 2.7'
21
21
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
22
22
  f.match(%r{^(test|spec|features)/})
23
23
  end
24
24
 
25
25
  spec.add_dependency 'activesupport', '>= 4'
26
- spec.add_dependency 'google-apis-cloudscheduler_v1'
27
26
  spec.add_dependency 'google-apis-iamcredentials_v1'
28
27
  spec.add_dependency 'google-cloud-scheduler', '>= 2'
29
28
  spec.add_dependency 'google-cloud-tasks', '>= 2'
@@ -41,4 +40,7 @@ Gem::Specification.new do |spec|
41
40
  spec.add_development_dependency 'shoulda-matchers'
42
41
  spec.add_development_dependency 'simplecov'
43
42
  spec.add_development_dependency 'webmock'
43
+ spec.metadata = {
44
+ 'rubygems_mfa_required' => 'true'
45
+ }
44
46
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-cloud-tasks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guilherme Araújo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-01 00:00:00.000000000 Z
11
+ date: 2021-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4'
27
- - !ruby/object:Gem::Dependency
28
- name: google-apis-cloudscheduler_v1
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: google-apis-iamcredentials_v1
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -300,7 +286,8 @@ files:
300
286
  homepage: http://github.com/flamingo-run/rails-cloud-tasks
301
287
  licenses:
302
288
  - Apache License 2.0
303
- metadata: {}
289
+ metadata:
290
+ rubygems_mfa_required: 'true'
304
291
  post_install_message:
305
292
  rdoc_options: []
306
293
  require_paths:
@@ -309,14 +296,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
309
296
  requirements:
310
297
  - - ">="
311
298
  - !ruby/object:Gem::Version
312
- version: '2.4'
299
+ version: '2.7'
313
300
  required_rubygems_version: !ruby/object:Gem::Requirement
314
301
  requirements:
315
302
  - - ">="
316
303
  - !ruby/object:Gem::Version
317
304
  version: '0'
318
305
  requirements: []
319
- rubygems_version: 3.1.4
306
+ rubygems_version: 3.1.6
320
307
  signing_key:
321
308
  specification_version: 4
322
309
  summary: Rails Cloud Tasks