panoptes-client 0.3.7 → 0.3.8

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: 6dfa5396972aa397744d3069b4f9c5712519aa6e
4
- data.tar.gz: 3f6376476e116a7504464a0b8178f0a9b1af4c2c
3
+ metadata.gz: e752ecee4ee1efa079e7f52cb213e084278edd61
4
+ data.tar.gz: 2bee1af072eba3bb0416c1f2ae04abb6b5429673
5
5
  SHA512:
6
- metadata.gz: 2391ac867ebfb4a09738e0724f1b2cfdffcd5ec56bf6b9b08031cbac63e91d9a33ca8fca73b75ad6318d2c4919796203d1f4440a5576992c41c4365fdc7f1df6
7
- data.tar.gz: 5ce9d31ccd06ea81fc169e876cadbce70c53f957f81ea2b04fce48745ead872560b9dc6ec35177e21d72f9ed5a02aaf9985d869187369f10e00dce19237f04ff
6
+ metadata.gz: 95513c729ebbed6c985e3ee77b37842583ce1f55bcb1ac749eb7aad5c833444144d64f71d05aa8e8664d1ff1d8514a26b0616f7e33397cfbe39d769db279c0a7
7
+ data.tar.gz: 3f0639d4f6a50583680efac192eb6287968277a64626c062a2f5324704c2e34c410cc8ce8e5f3b46ba09d054ae6c17d51b3560a85ed85c56f96e22f63938278f
@@ -1,3 +1,7 @@
1
+ # 0.3.8
2
+
3
+ * Add client.subject(subject_id, *kwargs)
4
+
1
5
  # 0.3.7
2
6
 
3
7
  * Add client.project(project_id)
@@ -16,6 +16,23 @@ module Panoptes
16
16
  response.fetch("subjects")
17
17
  end
18
18
 
19
+ # Fetch a subject given filters (including permissions)
20
+ #
21
+ # @param subject_id [Integer]
22
+ # @param project_id [Integer]
23
+ # @return nil or the subject
24
+ def subject(subject_id, project_id: nil)
25
+ query = {}
26
+ query[:project_id] = project_id if project_id
27
+
28
+ response = panoptes.get("/subjects/#{subject_id}", query)
29
+ if response.fetch('subjects', []).count > 1
30
+ raise StandardError.new 'Unexpectedly many subjects returned'
31
+ end
32
+
33
+ response.fetch('subjects', []).fetch(0, nil)
34
+ end
35
+
19
36
  # Retire a subject for a workflow
20
37
  #
21
38
  # @todo Add this endpoint to the Apiary docs and add a see-reference here.
@@ -1,5 +1,5 @@
1
1
  module Panoptes
2
2
  class Client
3
- VERSION = "0.3.7".freeze
3
+ VERSION = "0.3.8".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.7
4
+ version: 0.3.8
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: 2018-06-07 00:00:00.000000000 Z
13
+ date: 2018-11-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: faraday