panoptes-client 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/bin/console +4 -4
- data/lib/panoptes/client/project_preferences.rb +23 -0
- data/lib/panoptes/client/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be4a873a57d12839ddefa165331bca1454c2158b64ce0d054238a2dcb583066c
|
4
|
+
data.tar.gz: 41ffe3ed1f18dd2ab585367b1a4a82b6aba4569d31b37a89f5b3ce9063c68aed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 676c143e37a1cc4d6fefe63212ed5d2bfd754339d0cd7ae0cf90828114c2c8d22881e8c3e5645b5738f14224e0d55d0ee4fbf2048d3b78f6097b4142e2b37071
|
7
|
+
data.tar.gz: 7d6cb2a9c0233326dd83ef257ab00ea04c5afcb1520770ed4f6c209b4021f7b3f0dcdf515bb9c3499c3fb1e864d084c02f5c8ae5e99ce8fd4ee24bba28f51020
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
# 1.2.1
|
2
|
+
* Fix: Workflow promotion via project preferences now checks to make sure it doesn't demote you by checking the workflow configs. This can be skipped by using the new set_user_workflow method.
|
3
|
+
|
1
4
|
# 1.2.0
|
2
5
|
|
3
6
|
* Relax the `faraday-panoptes` gem version constraints to allow it to upgrade
|
data/bin/console
CHANGED
@@ -8,8 +8,8 @@ require 'panoptes/client'
|
|
8
8
|
# with your gem easier. You can also use a different console, if you like.
|
9
9
|
|
10
10
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
-
|
12
|
-
|
11
|
+
require "pry"
|
12
|
+
Pry.start
|
13
13
|
|
14
|
-
require 'irb'
|
15
|
-
IRB.start
|
14
|
+
# require 'irb'
|
15
|
+
# IRB.start
|
@@ -16,6 +16,29 @@ module Panoptes
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def promote_user_to_workflow(user_id, project_id, workflow_id)
|
19
|
+
project_pref = panoptes.get('project_preferences',
|
20
|
+
user_id: user_id,
|
21
|
+
project_id: project_id).fetch('project_preferences').first
|
22
|
+
id = project_pref['id']
|
23
|
+
workflow_id_current = project_pref['settings']['workflow_id']
|
24
|
+
|
25
|
+
response = panoptes.connection.get("/api/project_preferences/#{id}")
|
26
|
+
etag = response.headers['ETag']
|
27
|
+
|
28
|
+
workflow_target = panoptes.get("/workflows/#{workflow_id}").fetch('workflows').first
|
29
|
+
level_target = workflow_target['configuration']['level'].to_i
|
30
|
+
|
31
|
+
workflow_current = panoptes.get("/workflows/#{workflow_id_current}").fetch('workflows').first
|
32
|
+
level_current = workflow_current['configuration']['level'].to_i
|
33
|
+
|
34
|
+
if level_target > level_current
|
35
|
+
panoptes.put("project_preferences/#{id}", {
|
36
|
+
project_preferences: { settings: { workflow_id: workflow_id } }
|
37
|
+
}, etag: etag)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def set_user_workflow(user_id, project_id, workflow_id)
|
19
42
|
id = panoptes.get('project_preferences',
|
20
43
|
user_id: user_id,
|
21
44
|
project_id: project_id).fetch('project_preferences').first['id']
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: panoptes-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marten Veldthuis
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2023-08-10 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: deprecate
|
@@ -207,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: '0'
|
209
209
|
requirements: []
|
210
|
-
rubygems_version: 3.
|
210
|
+
rubygems_version: 3.4.10
|
211
211
|
signing_key:
|
212
212
|
specification_version: 4
|
213
213
|
summary: API wrapper for https://panoptes.zooniverse.org
|