startback-jobs 0.14.1 → 0.14.4

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: 50b0d4625a9cbb6daeb12056f04c126b497d306f036f9b914db9d843b16091b9
4
- data.tar.gz: 91fbb7ea5a2c5ac783df2f0d8664860ad0a20ee590183591fe4256a5cc244ec4
3
+ metadata.gz: 18b1367fa48e3e2cff33f130d2751325fcc27a329d8225e6770bb18ea810db3e
4
+ data.tar.gz: c25c531182d1ead333a14940a0d1cd441e8b2e0aae9767c54f1ff254726abfb3
5
5
  SHA512:
6
- metadata.gz: 382df5e021ad38cf87c16b858e092137e5ffd18e731f931839835d5f156e4eb9ba0b106bd8a4d37f8dc4fe04a4dc8ac50c207a9bed4f884d5dc25e0203db4361
7
- data.tar.gz: 59efd31b4bd47f7f4af93568a9accda0940bb7fbea13c3d060970da30c7d120b53750125841dc0475f5f830db8de16f81a6a26ea65a595dc05908d249e38fca0
6
+ metadata.gz: c870e1271dee494d530b5f5dd49657258a6103d61e6d028ba14ed702db579afd435870e21269c19378732ddec4703d944db216b1200a307aa10cf0dc07265dc3
7
+ data.tar.gz: 7d874df22d7f94641423d8e1971d5fd76fae70e4bfc4b9f339649a419cf86ce1464cc2d85c74ef8ef4d0895585154707d615c8559a5415e4cb5eb8777da16ab0
@@ -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.1
4
+ version: 0.14.4
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-15 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.1
121
+ version: 0.14.4
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.1
128
+ version: 0.14.4
129
129
  description: Asynchronous jobs on top of the Startback framework
130
130
  email: blambeau@gmail.com
131
131
  executables: []