panoptes-client 0.3.5 → 0.3.6

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
  SHA1:
3
- metadata.gz: d28db2d4a5889665f4804084304330802e0d6886
4
- data.tar.gz: 3e70ceb4603b7f208bd1e395fab840e4ea2807ab
3
+ metadata.gz: 89ee396e9d5d582ce684a5c1d32f3341b6757e35
4
+ data.tar.gz: 5420c9d981e2e119d645943878d8c856f384d06f
5
5
  SHA512:
6
- metadata.gz: c7dbcbfac4214e079c968df2e81f2923b59b8250bc3aab8778f68b53cf11428a80165ea15d1b62250fd6e3f3ee232cfa2a191a54528be4ab4c40504015b928af
7
- data.tar.gz: cdaec50e7c1608f24f791741f85e98ec1ce81cde7d7ae99c704efb664e76ac9019b86a53e0e0e3bf039064244d706db7f7f702307ed2af3ac34951455cc83bf5
6
+ metadata.gz: 1600fba32b1c616153c58dc661c762abf98bba509bd0773117e6d7fe579050d97f5cd9b5cf56cd23d1514ea795f135a49d7583aa7da15063a889d0f2c0f5164b
7
+ data.tar.gz: 20027bd022aa23c56ad328f2f0a51ca5f1781318e21a8945d741e5f83e13584b17cbcd6fe0f5d163fbf8babc0dbecf0ecb6e3238c668677ad4dcae1d8dddbe11
@@ -8,8 +8,10 @@ require 'panoptes/client/comments'
8
8
  require 'panoptes/client/discussions'
9
9
  require 'panoptes/client/me'
10
10
  require 'panoptes/client/projects'
11
+ require 'panoptes/client/project_preferences'
11
12
  require 'panoptes/client/subject_sets'
12
13
  require 'panoptes/client/subjects'
14
+ require 'panoptes/client/users'
13
15
  require 'panoptes/client/user_groups'
14
16
  require 'panoptes/client/version'
15
17
  require 'panoptes/client/workflows'
@@ -22,8 +24,10 @@ module Panoptes
22
24
  include Panoptes::Client::Classifications
23
25
  include Panoptes::Client::Collections
24
26
  include Panoptes::Client::Projects
27
+ include Panoptes::Client::ProjectPreferences
25
28
  include Panoptes::Client::Subjects
26
29
  include Panoptes::Client::SubjectSets
30
+ include Panoptes::Client::Users
27
31
  include Panoptes::Client::UserGroups
28
32
  include Panoptes::Client::Workflows
29
33
 
@@ -0,0 +1,33 @@
1
+
2
+ module Panoptes
3
+ class Client
4
+ module ProjectPreferences
5
+ def project_preferences(id)
6
+ response = panoptes.get("project_preferences/#{id}")
7
+ response.fetch("project_preferences").first
8
+ end
9
+
10
+ def user_project_preferences(user_id, project_id)
11
+ response = panoptes.get("project_preferences", {
12
+ user_id: user_id,
13
+ project_id: project_id
14
+ })
15
+ response.fetch("project_preferences").first
16
+ end
17
+
18
+ def promote_user_to_workflow(user_id, project_id, workflow_id)
19
+ id = panoptes.get("project_preferences", {
20
+ user_id: user_id,
21
+ project_id: project_id
22
+ }).fetch("project_preferences").first["id"]
23
+
24
+ response = panoptes.connection.get("/api/project_preferences/#{id}")
25
+ etag = response.headers["ETag"]
26
+
27
+ panoptes.put("project_preferences/#{id}", {
28
+ project_preferences: { settings: { workflow_id: workflow_id } }
29
+ }, etag: etag)
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,10 @@
1
+ module Panoptes
2
+ class Client
3
+ module Users
4
+ def user(user_id)
5
+ response = panoptes.get("users/#{user_id}")
6
+ response.fetch("users").find{ |i| i.fetch("id").to_s == user_id.to_s }
7
+ end
8
+ end
9
+ end
10
+ end
@@ -1,5 +1,5 @@
1
1
  module Panoptes
2
2
  class Client
3
- VERSION = "0.3.5".freeze
3
+ VERSION = "0.3.6".freeze
4
4
  end
5
5
  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: 0.3.5
4
+ version: 0.3.6
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: 2017-11-17 00:00:00.000000000 Z
13
+ date: 2018-02-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: faraday
@@ -156,10 +156,12 @@ files:
156
156
  - lib/panoptes/client/comments.rb
157
157
  - lib/panoptes/client/discussions.rb
158
158
  - lib/panoptes/client/me.rb
159
+ - lib/panoptes/client/project_preferences.rb
159
160
  - lib/panoptes/client/projects.rb
160
161
  - lib/panoptes/client/subject_sets.rb
161
162
  - lib/panoptes/client/subjects.rb
162
163
  - lib/panoptes/client/user_groups.rb
164
+ - lib/panoptes/client/users.rb
163
165
  - lib/panoptes/client/version.rb
164
166
  - lib/panoptes/client/workflows.rb
165
167
  - lib/panoptes/endpoints/base_endpoint.rb