panoptes-client 1.2.0 → 1.2.1

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: c253f336c2bf15cc1477383fda0465cc2ca1a5a4d9a945007b229a2c577cdaef
4
- data.tar.gz: 5806a295c165f072b5f27f9d5a950154b1b1fcbdb2d93e2152cc7c497f50a15c
3
+ metadata.gz: be4a873a57d12839ddefa165331bca1454c2158b64ce0d054238a2dcb583066c
4
+ data.tar.gz: 41ffe3ed1f18dd2ab585367b1a4a82b6aba4569d31b37a89f5b3ce9063c68aed
5
5
  SHA512:
6
- metadata.gz: 1b4c3bcd21024eb0f18454cf7187d3d3f4c9f678ac2936b62353435482b0bb2b560959b10da5c247d7241430387be71aeb8c93662c58e5e9fb44d60b08b6a256
7
- data.tar.gz: 194b78af782c65bcf7b1458ed883ab037c517b8353e959bc172d3c43aefc11bc135d9d1fe27d43fcaa58e035ecf32a370442576173ecdd6cffc12794898dd8da
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
- # require "pry"
12
- # Pry.start
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']
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Panoptes
4
4
  class Client
5
- VERSION = '1.2.0'
5
+ VERSION = '1.2.1'
6
6
  end
7
7
  end
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.0
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: 2022-10-21 00:00:00.000000000 Z
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.1.4
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