camundapi 0.2.2 → 0.3.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: ce0cf37d91eec603cb9216880295149771497066ac77871a734a59716546ee49
4
- data.tar.gz: 022cb7c04439b91d2fcdf6ee35035ff97e855f08929582c0a9cac48ebc4ee223
3
+ metadata.gz: 9a9a80f74a40b0a353fa872cb1b00b6fb87545097ff6338a56954210ed2100f3
4
+ data.tar.gz: c760415520a8e03d0caf266c5d26edb4b9a9d67b6341032b212ac51d51b53883
5
5
  SHA512:
6
- metadata.gz: 679049daecee8de3048185a48e9740a038b42e0aab3f2e9b86648fd0b7c369bf88ba323ca20a42a75defbc26bde6e0fece53b1b281ec09ed83cf253042baea40
7
- data.tar.gz: 1317daf88a5fe6718b3164f316bd5e6a850a119aadc922178547372c4844d6a5fa0a7394ea0cb10d9ae92c8ec2801a2f98bbd47626f916435cd5d7df561abe69
6
+ metadata.gz: 0d80dba9fe8a1336b323a00ec8ff6634243ce57622e46215cd24a390be95acc3dc832b7711139dbd6410250ca1422ef7b6cda42375314ad6786145c115618607
7
+ data.tar.gz: 34510bbe8e7de92622b38701ad3514abb5823c64b4ae0b176a8f5a4755ca7a5899fe96e9d666f22383e165a5d335140382877ac38e808a79a6e95561805c887a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.3.0] - 2022-06-09
4
+
5
+ - Breaking change in `Camunda::Tasklist::UserTasks`: now uses the REST API instead of the graphql API.
6
+
3
7
  ## [0.2.2] - 2022-09-12
4
8
 
5
9
  - Add `Zeebe::Jobs.add_error` so an error can be added to a job.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- camundapi (0.2.2)
4
+ camundapi (0.3.0)
5
5
  json
6
6
  net-sftp
7
7
  rest-client (~> 2.0)
@@ -14,22 +14,22 @@ GEM
14
14
  diff-lcs (1.5.0)
15
15
  domain_name (0.5.20190701)
16
16
  unf (>= 0.0.5, < 1.0.0)
17
- google-protobuf (3.21.5-x86_64-darwin)
18
- googleapis-common-protos-types (1.4.0)
17
+ google-protobuf (3.23.2-x86_64-darwin)
18
+ googleapis-common-protos-types (1.6.0)
19
19
  google-protobuf (~> 3.14)
20
- grpc (1.48.0-x86_64-darwin)
21
- google-protobuf (~> 3.19)
20
+ grpc (1.55.0-x86_64-darwin)
21
+ google-protobuf (~> 3.23)
22
22
  googleapis-common-protos-types (~> 1.0)
23
23
  http-accept (1.7.0)
24
24
  http-cookie (1.0.5)
25
25
  domain_name (~> 0.5)
26
- json (2.6.2)
26
+ json (2.6.3)
27
27
  mime-types (3.4.1)
28
28
  mime-types-data (~> 3.2015)
29
- mime-types-data (3.2022.0105)
30
- net-sftp (3.0.0)
31
- net-ssh (>= 5.0.0, < 7.0.0)
32
- net-ssh (6.1.0)
29
+ mime-types-data (3.2023.0218.1)
30
+ net-sftp (4.0.0)
31
+ net-ssh (>= 5.0.0, < 8.0.0)
32
+ net-ssh (7.1.0)
33
33
  netrc (0.11.0)
34
34
  parallel (1.22.1)
35
35
  parser (3.1.2.0)
@@ -81,6 +81,7 @@ GEM
81
81
 
82
82
  PLATFORMS
83
83
  x86_64-darwin-20
84
+ x86_64-darwin-21
84
85
 
85
86
  DEPENDENCIES
86
87
  camundapi!
@@ -16,6 +16,7 @@ module Camunda
16
16
 
17
17
  def self.post(endpoint, params = {})
18
18
  url = build_url(endpoint)
19
+
19
20
  response = RestClient.post(
20
21
  url,
21
22
  params.to_json,
@@ -25,6 +26,18 @@ module Camunda
25
26
  JSON.parse(response.body) if response.code == 200
26
27
  end
27
28
 
29
+ def self.patch(endpoint, params = {})
30
+ url = build_url(endpoint)
31
+
32
+ response = RestClient.patch(
33
+ url,
34
+ params.to_json,
35
+ headers
36
+ )
37
+
38
+ JSON.parse(response.body)
39
+ end
40
+
28
41
  def self.build_url(endpoint, params = {})
29
42
  url = "#{base_url}/#{Camunda.api_version}/#{endpoint}"
30
43
  url += "?#{URI.encode_www_form(params)}" unless params.empty?
@@ -41,3 +54,12 @@ module Camunda
41
54
  end
42
55
  end
43
56
  end
57
+
58
+ # Zeebe::Client::GatewayProtocol::ActivatedJob: key: 4503599775908706,
59
+ # type: "pre-offboarding-inform-slack-dev",
60
+ # processInstanceKey: 4503599775908700,
61
+ # bpmnProcessId: "pre-offboarding-automated-steps-dev",
62
+ # processDefinitionVersion: 2, processDefinitionKey: 2251799962638940,
63
+ # elementId: "Activity_1yisk0d", elementInstanceKey: 4503599775908705, customHeaders: "{}",
64
+ # worker: "offboarding:inform_offboarding_channel", retries: 1, deadline: 1686334733449,
65
+ # variables: "{"employee_id":2641841204932640877}">
@@ -2,18 +2,13 @@
2
2
 
3
3
  module Camunda
4
4
  module Tasklist
5
- class API
6
- def self.post(params = {})
7
- response = RestClient.post(Camunda.tasklist_base_url, params.to_json, headers)
8
- JSON.parse(response.body)
5
+ class API < ::Camunda::BaseAPI
6
+ def self.base_url
7
+ Camunda.tasklist_base_url
9
8
  end
10
9
 
11
- def self.headers
12
- oauth_token = Camunda::Tasklist::OAuthToken.create
13
- {
14
- authorization: "Bearer #{oauth_token['access_token']}",
15
- 'Content-Type': 'application/json'
16
- }
10
+ def self.oauth_token
11
+ Camunda::Tasklist::OAuthToken.create['access_token']
17
12
  end
18
13
  end
19
14
  end
@@ -3,31 +3,16 @@
3
3
  module Camunda
4
4
  module Tasklist
5
5
  class UserTasks < API
6
- def self.all # rubocop:disable Metrics:MethodLength
7
- query = "{
8
- tasks(query: { state: CREATED })
9
- {
10
- id
11
- taskDefinitionId
12
- name
13
- taskState
14
- assignee
15
- taskState
16
- formKey
17
- processDefinitionId
18
- completionTime
19
- processName
20
- variables {
21
- name
22
- value
23
- }
24
- }
25
- }"
26
- post(query: query)['data']['tasks']
6
+ def self.all(params = {})
7
+ post('tasks/search', params)
27
8
  end
28
9
 
29
- def self.run_mutation(mutation)
30
- post(query: mutation)
10
+ def self.complete_task(task_id, variables = {})
11
+ patch("tasks/#{task_id}/complete", variables)
12
+ end
13
+
14
+ def self.variables(task_id, params = {})
15
+ post("tasks/#{task_id}/variables/search", params)
31
16
  end
32
17
  end
33
18
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Camunda
4
- VERSION = '0.2.2'
4
+ VERSION = '0.3.0'
5
5
  end
@@ -22,3 +22,4 @@ module Camunda
22
22
  end
23
23
  end
24
24
  end
25
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: camundapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lien Van Den Steen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-12 00:00:00.000000000 Z
11
+ date: 2023-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
136
  - !ruby/object:Gem::Version
137
137
  version: '0'
138
138
  requirements: []
139
- rubygems_version: 3.2.31
139
+ rubygems_version: 3.3.26
140
140
  signing_key:
141
141
  specification_version: 4
142
142
  summary: Ruby wrapper for Camunda's API's