startback-jobs 0.14.2 → 0.15.0

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: c9b501e66349f183dec67c089b7aab36e893c96e6597436dd39a9e381576c8b5
4
- data.tar.gz: 61a9f034e5d0ade09d7ad377bbfe11d8808ee4c16e01e0c586ff92a447c3e4bb
3
+ metadata.gz: f355a340246acd89939dca1ee250b189c430f3844e774e4e573b9edd3f6531cb
4
+ data.tar.gz: eaf96b3cd334b13e12521459f355a778abbc99dc9a23b3a442d8aa12d23545c8
5
5
  SHA512:
6
- metadata.gz: 62c37dc1c33c88b16bca36b836863fade63680de675b78a7ddf7c12c3f9d921b87318dd403d2cfe25344d49620b3e9aecb961c2c618cb8a94e6f06311ef1750d
7
- data.tar.gz: 2c925ab92b9d286f5b2fa81f4fc0401f90c2c3b215e9d0b7423aae30c3dbd9688e96771d20e037caba6319988ad2b018515a01addc777522a34f3c5244a4b8a0
6
+ metadata.gz: 8e7e7133aa8e0ab4bfc5ced420683f0c08928bce35dcd7598f90ed4f114868e3906e323633aa8d22b656cc21b6fa5b85e1d8bdadf7fa386a32bbc25f8f6b33b0
7
+ data.tar.gz: b7cf7fe35fb975c394baa1e0dceb7c3e26a14b4e224879c4ccc09d482ecf080ec70d34a8526c95b83fdd5fe1e6a800b80fd86a52de90b240963a4ac3f2474ea8
@@ -2,6 +2,11 @@ module Startback
2
2
  module Jobs
3
3
  class Api < Startback::Web::Api
4
4
 
5
+ get %r{/([^\/]+)/?} do |id|
6
+ job = context.factor(Services).get_job!(id: id)
7
+ serve 'Job', job
8
+ end
9
+
5
10
  get %r{/([^\/]+)/result/?} do |id|
6
11
  job = context.factor(Services).get_job!(id: id)
7
12
  Support::JobResult.for(job).api_serve(self)
@@ -21,6 +21,7 @@ module Startback
21
21
  services.update_job!(input, {
22
22
  opResult: op_result,
23
23
  isReady: true,
24
+ strategy: 'Embedded',
24
25
  })
25
26
 
26
27
  op_result
@@ -5,7 +5,11 @@ module Startback
5
5
  class Embedded < JobResult
6
6
 
7
7
  def api_serve(api)
8
- [200, {}, [job.opResult]]
8
+ [
9
+ 200,
10
+ {"Content-Type" => "application/json"},
11
+ [job.opResult.to_json]
12
+ ]
9
13
  end
10
14
 
11
15
  end # class Embedded
@@ -68,7 +68,7 @@ module Startback
68
68
  let(:override) do
69
69
  {
70
70
  isReady: true,
71
- opResult: 'Hello!!',
71
+ opResult: { "foo" => 'Hello!!' },
72
72
  strategy: 'Embedded'
73
73
  }
74
74
  end
@@ -76,7 +76,7 @@ module Startback
76
76
  it 'works fine' do
77
77
  res = subject
78
78
  expect(res.status).to eql(200)
79
- expect(res.body).to eql("Hello!!")
79
+ expect(res.body).to eql({ "foo" => 'Hello!!' }.to_json)
80
80
  end
81
81
  end
82
82
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: startback-jobs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.2
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernard Lambeau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-08 00:00:00.000000000 Z
11
+ date: 2022-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -118,14 +118,14 @@ dependencies:
118
118
  requirements:
119
119
  - - '='
120
120
  - !ruby/object:Gem::Version
121
- version: 0.14.2
121
+ version: 0.15.0
122
122
  type: :runtime
123
123
  prerelease: false
124
124
  version_requirements: !ruby/object:Gem::Requirement
125
125
  requirements:
126
126
  - - '='
127
127
  - !ruby/object:Gem::Version
128
- version: 0.14.2
128
+ version: 0.15.0
129
129
  description: Asynchronous jobs on top of the Startback framework
130
130
  email: blambeau@gmail.com
131
131
  executables: []