rails-cloud-tasks 0.0.4rc2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -10
- data/lib/rails-cloud-tasks.rb +1 -1
- data/lib/rails_cloud_tasks/rack/jobs.rb +2 -6
- data/lib/rails_cloud_tasks/scheduler.rb +1 -1
- data/lib/rails_cloud_tasks/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ab8eda2821b2bba5e155d3444c4cdf5fca633dd468753f4d177354e6ec1207b
|
4
|
+
data.tar.gz: 71a5080bcc0693ea95b68b416246da57e671d7fb24d3bc46a95a895e96c521a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4ed01e0744ec482ad3d3015f92b35eee118601b1d95b7e7d5e3d030a1ff5f243224f35c527574aa8f3a6e8470fab3f2981fd39607e3f4456601501dfeb636b3
|
7
|
+
data.tar.gz: 33b16e211328e0123c85381640087b2d4e1cfca7c0a0fdab0e7777cd20fb3dc148892762eebbf4ec269751b2bf0edb6c1b1f7f2e978962e8ba0d92012e05205c
|
data/README.md
CHANGED
@@ -105,23 +105,29 @@ We have support to Google Cloud Schedule. It's based on Cloud tasks, the jobs ar
|
|
105
105
|
Check out the follow sample of config file:
|
106
106
|
```yaml
|
107
107
|
# config/scheduler.yml
|
108
|
-
- name:
|
108
|
+
- name: UsersSyncJob
|
109
109
|
schedule: 0 8 * * *
|
110
110
|
description: Sync user data
|
111
111
|
time_zone: "America/Los_Angeles"
|
112
|
+
class_name: Users::SyncJob
|
112
113
|
args:
|
113
|
-
|
114
|
-
|
114
|
+
- this_first: argument
|
115
|
+
is_a: hash
|
116
|
+
- - this second argument
|
117
|
+
- is an array
|
118
|
+
- this third argument is a string
|
115
119
|
```
|
116
120
|
|
117
|
-
| attribute | description
|
118
|
-
|-------------
|
119
|
-
| name |
|
120
|
-
| schedule | The frequency to run your job. It should be a unix-cron format
|
121
|
-
| description | What this job does
|
122
|
-
| time_zone | Choose which one timezone your job must run
|
123
|
-
| args |
|
121
|
+
| attribute | description | required |
|
122
|
+
|------------- |---------------------------------------------------------------------------------- |---------- |
|
123
|
+
| name | Any descriptive name, following [Tasks naming restrictions][1] | ✓ |
|
124
|
+
| schedule | The frequency to run your job. It should be a unix-cron format | ✓ |
|
125
|
+
| description | What this job does | ✓ |
|
126
|
+
| time_zone | Choose which one timezone your job must run | ✓ |
|
127
|
+
| args | Arguments to the job execution. Important: if present, this must be an array of items. Check out the example above | 𐄂 |
|
128
|
+
| class_name | The Job class name (including namespace) | ✓ |
|
124
129
|
|
130
|
+
[1]: https://cloud.google.com/tasks/docs/reference/rpc/google.cloud.tasks.v2
|
125
131
|
|
126
132
|
|
127
133
|
|
data/lib/rails-cloud-tasks.rb
CHANGED
@@ -15,11 +15,7 @@ module RailsCloudTasks
|
|
15
15
|
request = ::Rack::Request.new(env)
|
16
16
|
job_args = extract_args(request)
|
17
17
|
|
18
|
-
|
19
|
-
job_class.perform_now(job_args)
|
20
|
-
else
|
21
|
-
job_class.perform_now
|
22
|
-
end
|
18
|
+
job_class.perform_now(*job_args)
|
23
19
|
|
24
20
|
response(200, {})
|
25
21
|
rescue Rack::InvalidPayloadError => e
|
@@ -37,7 +33,7 @@ module RailsCloudTasks
|
|
37
33
|
|
38
34
|
def extract_args(request)
|
39
35
|
body = request.body.read
|
40
|
-
JSON.parse(body)
|
36
|
+
JSON.parse(body) || []
|
41
37
|
rescue JSON::ParserError, KeyError
|
42
38
|
raise Rack::InvalidPayloadError
|
43
39
|
end
|
@@ -45,7 +45,7 @@ module RailsCloudTasks
|
|
45
45
|
description: job[:description],
|
46
46
|
time_zone: job[:time_zone],
|
47
47
|
http_target: {
|
48
|
-
uri: "#{host}#{tasks_path}/#{job[:class_name]
|
48
|
+
uri: "#{host}#{tasks_path}/#{job[:class_name]}",
|
49
49
|
http_method: 'POST',
|
50
50
|
body: job[:args].to_json
|
51
51
|
}.merge(auth)
|
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.
|
4
|
+
version: 0.0.4
|
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-03-
|
11
|
+
date: 2021-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -312,9 +312,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
312
312
|
version: '2.4'
|
313
313
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
314
314
|
requirements:
|
315
|
-
- - "
|
315
|
+
- - ">="
|
316
316
|
- !ruby/object:Gem::Version
|
317
|
-
version:
|
317
|
+
version: '0'
|
318
318
|
requirements: []
|
319
319
|
rubygems_version: 3.1.4
|
320
320
|
signing_key:
|