panoptes-client 1.1.1 → 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: dca50d5041bcc66daaaa93724829dcfc22cf23b274dab2b9d9cd970518aa6525
4
- data.tar.gz: b97521a77b9d5e45b79d8f5edaf70fc12040abf02d9047164913296e07f1f511
3
+ metadata.gz: be4a873a57d12839ddefa165331bca1454c2158b64ce0d054238a2dcb583066c
4
+ data.tar.gz: 41ffe3ed1f18dd2ab585367b1a4a82b6aba4569d31b37a89f5b3ce9063c68aed
5
5
  SHA512:
6
- metadata.gz: d14a54f1d75d8b1af316a09cc0a9c629c750d1e50e60aacc4df928192d11445b16311c08223dfad2c9762c5defdd2ced5fa77772475020350c6a1ce85362e77b
7
- data.tar.gz: dc1d5c58f876ff541fe113d35ef5837ad2c66a410e5ce0f18933550f5451fce065533ea0fc617b2ef170b396007e0b5d84c2cbb2d117ed0f8e0827a79cce56a2
6
+ metadata.gz: 676c143e37a1cc4d6fefe63212ed5d2bfd754339d0cd7ae0cf90828114c2c8d22881e8c3e5645b5738f14224e0d55d0ee4fbf2048d3b78f6097b4142e2b37071
7
+ data.tar.gz: 7d6cb2a9c0233326dd83ef257ab00ea04c5afcb1520770ed4f6c209b4021f7b3f0dcdf515bb9c3499c3fb1e864d084c02f5c8ae5e99ce8fd4ee24bba28f51020
@@ -0,0 +1,72 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: "CodeQL"
13
+
14
+ on:
15
+ push:
16
+ branches: [ "master" ]
17
+ pull_request:
18
+ schedule:
19
+ - cron: '23 9 * * 6'
20
+
21
+ jobs:
22
+ analyze:
23
+ name: Analyze
24
+ runs-on: ubuntu-latest
25
+ permissions:
26
+ actions: read
27
+ contents: read
28
+ security-events: write
29
+
30
+ strategy:
31
+ fail-fast: false
32
+ matrix:
33
+ language: [ 'ruby' ]
34
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
35
+ # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
36
+
37
+ steps:
38
+ - name: Checkout repository
39
+ uses: actions/checkout@v3
40
+
41
+ # Initializes the CodeQL tools for scanning.
42
+ - name: Initialize CodeQL
43
+ uses: github/codeql-action/init@v2
44
+ with:
45
+ languages: ${{ matrix.language }}
46
+ # If you wish to specify custom queries, you can do so here or in a config file.
47
+ # By default, queries listed here will override any specified in a config file.
48
+ # Prefix the list here with "+" to use these queries and those in the config file.
49
+
50
+ # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
51
+ # queries: security-extended,security-and-quality
52
+
53
+
54
+ # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
55
+ # If this step fails, then you should remove it and run the build manually (see below)
56
+ - name: Autobuild
57
+ uses: github/codeql-action/autobuild@v2
58
+
59
+ # ℹ️ Command-line programs to run using the OS shell.
60
+ # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
61
+
62
+ # If the Autobuild fails above, remove it and uncomment the following three lines.
63
+ # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
64
+
65
+ # - run: |
66
+ # echo "Run, Build Application using script"
67
+ # ./location_of_script_within_repo/buildscript.sh
68
+
69
+ - name: Perform CodeQL Analysis
70
+ uses: github/codeql-action/analyze@v2
71
+ with:
72
+ category: "/language:${{matrix.language}}"
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
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
+
4
+ # 1.2.0
5
+
6
+ * Relax the `faraday-panoptes` gem version constraints to allow it to upgrade
7
+
1
8
  # 1.1.1
2
9
 
3
10
  * Fix a pagination bug that skipped the first page of API results when using a block to process results. Note this did not impact the use of the paginate method without a block.
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.1.1'
5
+ VERSION = '1.2.1'
6
6
  end
7
7
  end
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.add_dependency 'deprecate'
23
23
  spec.add_dependency 'faraday'
24
- spec.add_dependency 'faraday-panoptes', '~> 0.3.0'
24
+ spec.add_dependency 'faraday-panoptes', '~> 0.3'
25
25
  spec.add_dependency 'jwt', '~> 1.5.0'
26
26
 
27
27
  spec.add_development_dependency 'bundler'
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: panoptes-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marten Veldthuis
8
8
  - Zach Wolfenbarger
9
9
  - Amy Boyer
10
- autorequire:
10
+ autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2021-12-02 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
@@ -46,14 +46,14 @@ dependencies:
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: 0.3.0
49
+ version: '0.3'
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: 0.3.0
56
+ version: '0.3'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: jwt
59
59
  requirement: !ruby/object:Gem::Requirement
@@ -138,7 +138,7 @@ dependencies:
138
138
  - - ">="
139
139
  - !ruby/object:Gem::Version
140
140
  version: '0'
141
- description:
141
+ description:
142
142
  email:
143
143
  - marten@veldthuis.com
144
144
  - zach@zooniverse.org
@@ -147,6 +147,7 @@ executables: []
147
147
  extensions: []
148
148
  extra_rdoc_files: []
149
149
  files:
150
+ - ".github/workflows/codeql-analysis.yml"
150
151
  - ".github/workflows/run_tests_CI.yml"
151
152
  - ".gitignore"
152
153
  - ".hound.yml"
@@ -191,7 +192,7 @@ homepage: https://github.com/zooniverse/panoptes-client.rb
191
192
  licenses:
192
193
  - Apache 2.0
193
194
  metadata: {}
194
- post_install_message:
195
+ post_install_message:
195
196
  rdoc_options: []
196
197
  require_paths:
197
198
  - lib
@@ -206,8 +207,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
206
207
  - !ruby/object:Gem::Version
207
208
  version: '0'
208
209
  requirements: []
209
- rubygems_version: 3.1.6
210
- signing_key:
210
+ rubygems_version: 3.4.10
211
+ signing_key:
211
212
  specification_version: 4
212
213
  summary: API wrapper for https://panoptes.zooniverse.org
213
214
  test_files: []