panoptes-client 1.0.0.pre → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/run_tests_CI.yml +17 -0
- data/.hound.yml +2 -2
- data/.rubocop.yml +9 -0
- data/CHANGELOG.md +21 -0
- data/Dockerfile +22 -0
- data/Gemfile +2 -0
- data/README.md +23 -3
- data/Rakefile +6 -4
- data/bin/console +4 -3
- data/docker-compose.yml +11 -0
- data/lib/panoptes/client/authentication.rb +13 -11
- data/lib/panoptes/client/cellect.rb +2 -0
- data/lib/panoptes/client/classifications.rb +12 -10
- data/lib/panoptes/client/collections.rb +8 -1
- data/lib/panoptes/client/comments.rb +5 -3
- data/lib/panoptes/client/discussions.rb +4 -2
- data/lib/panoptes/client/me.rb +3 -1
- data/lib/panoptes/client/project_preferences.rb +12 -13
- data/lib/panoptes/client/projects.rb +29 -12
- data/lib/panoptes/client/subject_sets.rb +8 -6
- data/lib/panoptes/client/subjects.rb +9 -8
- data/lib/panoptes/client/user_groups.rb +11 -9
- data/lib/panoptes/client/users.rb +3 -1
- data/lib/panoptes/client/version.rb +3 -1
- data/lib/panoptes/client/workflows.rb +11 -4
- data/lib/panoptes/client.rb +8 -6
- data/lib/panoptes/endpoints/base_endpoint.rb +7 -4
- data/lib/panoptes/endpoints/json_api_endpoint.rb +11 -1
- data/lib/panoptes/endpoints/json_endpoint.rb +3 -1
- data/lib/panoptes/session.rb +3 -2
- data/lib/panoptes/talk_client.rb +2 -0
- data/lib/panoptes-client.rb +2 -0
- data/panoptes-client.gemspec +18 -17
- metadata +25 -23
- data/.ruby-style.yml +0 -206
- data/.travis.yml +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dca50d5041bcc66daaaa93724829dcfc22cf23b274dab2b9d9cd970518aa6525
|
4
|
+
data.tar.gz: b97521a77b9d5e45b79d8f5edaf70fc12040abf02d9047164913296e07f1f511
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d14a54f1d75d8b1af316a09cc0a9c629c750d1e50e60aacc4df928192d11445b16311c08223dfad2c9762c5defdd2ced5fa77772475020350c6a1ce85362e77b
|
7
|
+
data.tar.gz: dc1d5c58f876ff541fe113d35ef5837ad2c66a410e5ce0f18933550f5451fce065533ea0fc617b2ef170b396007e0b5d84c2cbb2d117ed0f8e0827a79cce56a2
|
@@ -0,0 +1,17 @@
|
|
1
|
+
name: Zooni CI
|
2
|
+
on:
|
3
|
+
pull_request:
|
4
|
+
push: { branches: master }
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
name: Run Tests
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
steps:
|
10
|
+
- uses: actions/checkout@v2
|
11
|
+
- name: Setup Ruby
|
12
|
+
uses: ruby/setup-ruby@v1
|
13
|
+
with:
|
14
|
+
ruby-version: 2.7
|
15
|
+
bundler-cache: true
|
16
|
+
- name: Run tests
|
17
|
+
run: bundle exec rspec
|
data/.hound.yml
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
config_file: .
|
1
|
+
rubocop:
|
2
|
+
config_file: .rubocop.yml
|
data/.rubocop.yml
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
+
# 1.1.1
|
2
|
+
|
3
|
+
* 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.
|
4
|
+
|
5
|
+
```ruby
|
6
|
+
# impacted
|
7
|
+
client.paginate('/subjects', {}) { |initial_page, page| .. }
|
8
|
+
# not impacted
|
9
|
+
all_page_results = client.paginate('/subjects', {})
|
10
|
+
```
|
11
|
+
|
12
|
+
# 1.1.0
|
13
|
+
|
14
|
+
* Add method to get single collection
|
15
|
+
|
16
|
+
# 1.0.0
|
17
|
+
|
18
|
+
* Refactor of authentication code public interface
|
19
|
+
* Remove deprecated `current_user` method
|
20
|
+
* Stable API release
|
21
|
+
|
1
22
|
# 0.4.0
|
2
23
|
|
3
24
|
* Additional methods for interacting with JWT
|
data/Dockerfile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
FROM ruby:2.7-slim
|
2
|
+
|
3
|
+
WORKDIR /panoptes-client
|
4
|
+
|
5
|
+
RUN apt-get update && apt-get -y upgrade && \
|
6
|
+
apt-get install --no-install-recommends -y \
|
7
|
+
build-essential \
|
8
|
+
# git is required for installing gems from git repos
|
9
|
+
git \
|
10
|
+
nano \
|
11
|
+
vim
|
12
|
+
|
13
|
+
ADD ./Gemfile /panoptes-client/
|
14
|
+
ADD ./panoptes-client.gemspec /panoptes-client/
|
15
|
+
ADD ./lib/panoptes/client/version.rb /panoptes-client/lib/panoptes/client/
|
16
|
+
ADD .git/ /panoptes-client/
|
17
|
+
|
18
|
+
RUN bundle config --global jobs `cat /proc/cpuinfo | grep processor | wc -l | xargs -I % expr % - 1` && bundle install
|
19
|
+
|
20
|
+
ADD ./ /panoptes-client
|
21
|
+
|
22
|
+
CMD ["bundle", "exec", "rspec"]
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Panoptes::Client
|
2
2
|
|
3
|
-
[![Build Status](https://
|
3
|
+
[![Build Status](https://github.com/zooniverse/panoptes-client.rb/actions/workflows/run_tests_CI.yml/badge.svg?)
|
4
4
|
[![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/github/zooniverse/panoptes-client.rb/)
|
5
5
|
|
6
6
|
## Installation
|
@@ -13,12 +13,22 @@ gem 'panoptes-client'
|
|
13
13
|
|
14
14
|
In general, this library is supposed to be a thin, flat layer over our [HTTP-based API](http://docs.panoptes.apiary.io/). All public API methods can be found on the `Client` object.
|
15
15
|
|
16
|
-
**A lot of methods are still missing.
|
16
|
+
**A lot of methods are still missing. You can either issue a PR adding the one you need, or use the generic `get` / `post` methods on `Client`.**
|
17
17
|
|
18
18
|
|
19
19
|
## Development
|
20
20
|
|
21
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake
|
21
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
22
|
+
|
23
|
+
Alternatively use docker and docker-compose to get your dev env setup.
|
24
|
+
|
25
|
+
``` bash
|
26
|
+
docker-compose build # to build your dev docker image
|
27
|
+
docker-compose up # to run the tests in the dev container
|
28
|
+
|
29
|
+
# or run an interactive bash session in the dev container
|
30
|
+
docker-compose run --service-ports --rm panoptes-client bash
|
31
|
+
```
|
22
32
|
|
23
33
|
The test suite uses VCR to record HTTP requests, so if you're not making any new requests you should be fine with the existing cassettes. If you are, the test suite uses environment variables to pull in authentication credentials. You'll need to [create an OAuth application on staging](https://panoptes-staging.zooniverse.org/oauth/applications), and set the following env vars:
|
24
34
|
|
@@ -34,6 +44,16 @@ We recommend [Direnv](https://github.com/direnv/direnv) as good utility to allow
|
|
34
44
|
|
35
45
|
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/panoptes-client. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
46
|
|
47
|
+
## Publishing
|
48
|
+
|
49
|
+
Follow these steps for publishing changes to the panoptes-client.rb ruby gem.
|
50
|
+
|
51
|
+
1. Make sure changes have been outlined in CHANGELOG.md, and version has been updated in lib/panoptes/client/version.rb. Reference [Semantic Versioning](https://semver.org/) for guidance on how to update the version number.
|
52
|
+
2. Tag a release when your PR has been merged into master. Use [this guide](https://help.github.com/en/github/administering-a-repository/managing-releases-in-a-repository) for reference on how to create release tags. Set the version number (e.g. v1.1.1) as the tag name. Select the master branch as the target branch. In the release description, list out the changes that have been made just as you did in CHANGELOG.md. Do not select pre-release unless it’s not yet ready for production, and then click ‘Publish Release’.
|
53
|
+
3. Once the release tag is set, check out the release branch locally and test to make sure everything is working as expected, run tests and make sure they pass. Use the following command to check out a branch via its tag: `git checkout tags/<tag>`
|
54
|
+
4. Create the package by running `rake build`. This will build the new version of the panoptes gem (e.g. panoptes-client-1.1.1.gem) into the pkg directory. Once you’ve done this, run `bundler console` to make sure everything works as expected. For more details on packaging and distributing ruby gems, check out [this article](https://www.digitalocean.com/community/tutorials/how-to-package-and-distribute-ruby-applications-as-a-gem-using-rubygems).
|
55
|
+
5. To publish the gem, use the command `[sudo] gem push [gem file]`. You’ll need to enter your rubygem.org credentials. Make sure you are one of the owners of the gem, or else you will not have permission to publish. You should see the version updated shortly on https://rubygems.org/gems/panoptes-client. And that’s it!
|
56
|
+
|
37
57
|
|
38
58
|
## License
|
39
59
|
|
data/Rakefile
CHANGED
@@ -1,13 +1,15 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
|
5
|
+
require 'rspec/core/rake_task'
|
4
6
|
RSpec::Core::RakeTask.new(:spec)
|
5
7
|
|
6
8
|
require 'yard'
|
7
9
|
YARD::Rake::YardocTask.new do |t|
|
8
|
-
t.files = ['lib/**/*.rb']
|
10
|
+
t.files = ['lib/**/*.rb'] # optional
|
9
11
|
t.options = ['--any', '--extra', '--opts'] # optional
|
10
12
|
t.stats_options = ['--list-undoc'] # optional
|
11
13
|
end
|
12
14
|
|
13
|
-
task :
|
15
|
+
task default: :spec
|
data/bin/console
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
|
-
require
|
4
|
-
require
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'panoptes/client'
|
5
6
|
|
6
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
8
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +11,5 @@ require "panoptes/client"
|
|
10
11
|
# require "pry"
|
11
12
|
# Pry.start
|
12
13
|
|
13
|
-
require
|
14
|
+
require 'irb'
|
14
15
|
IRB.start
|
data/docker-compose.yml
ADDED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'deprecate'
|
2
4
|
|
3
5
|
module Panoptes
|
@@ -53,11 +55,6 @@ module Panoptes
|
|
53
55
|
token_contents.fetch('admin', false)
|
54
56
|
end
|
55
57
|
|
56
|
-
def current_user
|
57
|
-
token_contents
|
58
|
-
end
|
59
|
-
deprecate :current_user, :token_contents, 2019, 7
|
60
|
-
|
61
58
|
private
|
62
59
|
|
63
60
|
def ensure_authenticated
|
@@ -87,14 +84,19 @@ module Panoptes
|
|
87
84
|
|
88
85
|
def public_key_for_env(env)
|
89
86
|
case env.to_s
|
90
|
-
when
|
91
|
-
|
92
|
-
when
|
93
|
-
|
94
|
-
else
|
95
|
-
nil
|
87
|
+
when 'staging'
|
88
|
+
key_file_path('doorkeeper-jwt-staging.pub')
|
89
|
+
when 'production'
|
90
|
+
key_file_path('doorkeeper-jwt-production.pub')
|
96
91
|
end
|
97
92
|
end
|
93
|
+
|
94
|
+
def key_file_path(file_name)
|
95
|
+
File.expand_path(
|
96
|
+
File.join('..', '..', '..', '..', 'data', file_name),
|
97
|
+
__FILE__
|
98
|
+
)
|
99
|
+
end
|
98
100
|
end
|
99
101
|
end
|
100
102
|
end
|
@@ -1,20 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Panoptes
|
2
4
|
class Client
|
3
5
|
module Classifications
|
4
6
|
def get_subject_classifications(subject_id, workflow_id)
|
5
|
-
panoptes.paginate(
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
panoptes.paginate('/classifications/project', {
|
8
|
+
admin: true,
|
9
|
+
workflow_id: workflow_id,
|
10
|
+
subject_id: subject_id
|
11
|
+
}, resource: 'classifications')
|
10
12
|
end
|
11
13
|
|
12
14
|
def get_user_classifications(user_id, workflow_id)
|
13
|
-
panoptes.paginate(
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
panoptes.paginate('/classifications/project', {
|
16
|
+
admin: true,
|
17
|
+
workflow_id: workflow_id,
|
18
|
+
user_id: user_id
|
19
|
+
}, resource: 'classifications')
|
18
20
|
end
|
19
21
|
end
|
20
22
|
end
|
@@ -1,8 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Panoptes
|
2
4
|
class Client
|
3
5
|
module Collections
|
6
|
+
def collection(collection_id)
|
7
|
+
response = panoptes.get("/collections/#{collection_id}")
|
8
|
+
response['collections'].first
|
9
|
+
end
|
10
|
+
|
4
11
|
def add_subjects_to_collection(collection_id, subject_ids)
|
5
|
-
panoptes.post("/collections/#{collection_id}/links/subjects",subjects: subject_ids)
|
12
|
+
panoptes.post("/collections/#{collection_id}/links/subjects", subjects: subject_ids)
|
6
13
|
end
|
7
14
|
end
|
8
15
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Panoptes
|
2
4
|
class Client
|
3
5
|
module Comments
|
@@ -7,9 +9,9 @@ module Panoptes
|
|
7
9
|
# @param focus_type [String] filter by focussable type
|
8
10
|
# @return list of discussions
|
9
11
|
def create_comment(discussion_id:, body:)
|
10
|
-
user_id = token_contents[
|
11
|
-
response = talk.post(
|
12
|
-
response.fetch(
|
12
|
+
user_id = token_contents['id']
|
13
|
+
response = talk.post('/comments', comments: { discussion_id: discussion_id, body: body, user_id: user_id })
|
14
|
+
response.fetch('comments')[0]
|
13
15
|
end
|
14
16
|
end
|
15
17
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Panoptes
|
2
4
|
class Client
|
3
5
|
module Discussions
|
@@ -11,8 +13,8 @@ module Panoptes
|
|
11
13
|
query[:focus_id] = focus_id
|
12
14
|
query[:focus_type] = focus_type
|
13
15
|
|
14
|
-
response = talk.get(
|
15
|
-
response.fetch(
|
16
|
+
response = talk.get('/discussions', query)
|
17
|
+
response.fetch('discussions')
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
data/lib/panoptes/client/me.rb
CHANGED
@@ -1,32 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
3
|
module Panoptes
|
3
4
|
class Client
|
4
5
|
module ProjectPreferences
|
5
6
|
def project_preferences(id)
|
6
7
|
response = panoptes.get("project_preferences/#{id}")
|
7
|
-
response.fetch(
|
8
|
+
response.fetch('project_preferences').first
|
8
9
|
end
|
9
10
|
|
10
11
|
def user_project_preferences(user_id, project_id)
|
11
|
-
response = panoptes.get(
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
response.fetch("project_preferences").first
|
12
|
+
response = panoptes.get('project_preferences',
|
13
|
+
user_id: user_id,
|
14
|
+
project_id: project_id)
|
15
|
+
response.fetch('project_preferences').first
|
16
16
|
end
|
17
17
|
|
18
18
|
def promote_user_to_workflow(user_id, project_id, workflow_id)
|
19
|
-
id = panoptes.get(
|
20
|
-
|
21
|
-
|
22
|
-
}).fetch("project_preferences").first["id"]
|
19
|
+
id = panoptes.get('project_preferences',
|
20
|
+
user_id: user_id,
|
21
|
+
project_id: project_id).fetch('project_preferences').first['id']
|
23
22
|
|
24
23
|
response = panoptes.connection.get("/api/project_preferences/#{id}")
|
25
|
-
etag = response.headers[
|
24
|
+
etag = response.headers['ETag']
|
26
25
|
|
27
26
|
panoptes.put("project_preferences/#{id}", {
|
28
|
-
|
29
|
-
|
27
|
+
project_preferences: { settings: { workflow_id: workflow_id } }
|
28
|
+
}, etag: etag)
|
30
29
|
end
|
31
30
|
end
|
32
31
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Panoptes
|
2
4
|
class Client
|
3
5
|
module Projects
|
@@ -10,7 +12,7 @@ module Panoptes
|
|
10
12
|
params = {}
|
11
13
|
params[:search] = search if search
|
12
14
|
|
13
|
-
panoptes.paginate(
|
15
|
+
panoptes.paginate('/projects', params)['projects']
|
14
16
|
end
|
15
17
|
|
16
18
|
# Fetches the specified project
|
@@ -20,7 +22,7 @@ module Panoptes
|
|
20
22
|
# @return [Hash] The requested project
|
21
23
|
def project(project_id)
|
22
24
|
response = panoptes.get("/projects/#{project_id}")
|
23
|
-
response.fetch(
|
25
|
+
response.fetch('projects').find { |i| i.fetch('id').to_s == project_id.to_s }
|
24
26
|
end
|
25
27
|
|
26
28
|
# Starts a background process to generate a new CSV export of all the classifications in the project.
|
@@ -28,8 +30,9 @@ module Panoptes
|
|
28
30
|
# @param project_id [Integer] the id of the project to export
|
29
31
|
# @return [Hash] the medium information where the export will be stored when it's generated
|
30
32
|
def create_classifications_export(project_id)
|
31
|
-
params =
|
32
|
-
|
33
|
+
params = export_params('text/csv')
|
34
|
+
path = export_path(project_id, 'classifications_export')
|
35
|
+
panoptes.post(path, params)['media'].first
|
33
36
|
end
|
34
37
|
|
35
38
|
# Starts a background process to generate a new CSV export of all the subjects in the project.
|
@@ -37,8 +40,9 @@ module Panoptes
|
|
37
40
|
# @param project_id [Integer] the id of the project to export
|
38
41
|
# @return [Hash] the medium information where the export will be stored when it's generated
|
39
42
|
def create_subjects_export(project_id)
|
40
|
-
params =
|
41
|
-
|
43
|
+
params = export_params('text/csv')
|
44
|
+
path = export_path(project_id, 'subjects_export')
|
45
|
+
panoptes.post(path, params)['media'].first
|
42
46
|
end
|
43
47
|
|
44
48
|
# Starts a background process to generate a new CSV export of all the workflows in the project.
|
@@ -46,8 +50,9 @@ module Panoptes
|
|
46
50
|
# @param project_id [Integer] the id of the project to export
|
47
51
|
# @return [Hash] the medium information where the export will be stored when it's generated
|
48
52
|
def create_workflows_export(project_id)
|
49
|
-
params =
|
50
|
-
|
53
|
+
params = export_params('text/csv')
|
54
|
+
path = export_path(project_id, 'workflows_export')
|
55
|
+
panoptes.post(path, params)['media'].first
|
51
56
|
end
|
52
57
|
|
53
58
|
# Starts a background process to generate a new CSV export of all the workflow_contents in the project.
|
@@ -55,8 +60,9 @@ module Panoptes
|
|
55
60
|
# @param project_id [Integer] the id of the project to export
|
56
61
|
# @return [Hash] the medium information where the export will be stored when it's generated
|
57
62
|
def create_workflow_contents_export(project_id)
|
58
|
-
params =
|
59
|
-
|
63
|
+
params = export_params('text/csv')
|
64
|
+
path = export_path(project_id, 'workflow_contents_export')
|
65
|
+
panoptes.post(path, params)['media'].first
|
60
66
|
end
|
61
67
|
|
62
68
|
# Starts a background process to generate a new CSV export of the aggretation results of the project.
|
@@ -64,8 +70,19 @@ module Panoptes
|
|
64
70
|
# @param project_id [Integer] the id of the project to export
|
65
71
|
# @return [Hash] the medium information where the export will be stored when it's generated
|
66
72
|
def create_aggregations_export(project_id)
|
67
|
-
params =
|
68
|
-
|
73
|
+
params = export_params('application/x-gzip')
|
74
|
+
path = export_path(project_id, 'aggregations_export')
|
75
|
+
panoptes.post(path, params)['media'].first
|
76
|
+
end
|
77
|
+
|
78
|
+
private
|
79
|
+
|
80
|
+
def export_params(content_type)
|
81
|
+
{ media: { content_type: content_type, metadata: { recipients: [] } } }
|
82
|
+
end
|
83
|
+
|
84
|
+
def export_path(project_id, export_type)
|
85
|
+
"/projects/#{project_id}/#{export_type}"
|
69
86
|
end
|
70
87
|
end
|
71
88
|
end
|
@@ -1,22 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Panoptes
|
2
4
|
class Client
|
3
5
|
module SubjectSets
|
4
6
|
def subject_set(subject_set_id)
|
5
7
|
response = panoptes.get("/subject_sets/#{subject_set_id}")
|
6
|
-
response.fetch(
|
8
|
+
response.fetch('subject_sets').find { |i| i.fetch('id').to_s == subject_set_id.to_s }
|
7
9
|
end
|
8
10
|
|
9
11
|
def create_subject_set(attributes)
|
10
|
-
response = panoptes.post(
|
11
|
-
response.fetch(
|
12
|
+
response = panoptes.post('/subject_sets', subject_sets: attributes)
|
13
|
+
response.fetch('subject_sets').first
|
12
14
|
end
|
13
15
|
|
14
16
|
def update_subject_set(subject_set_id, attributes)
|
15
17
|
response = panoptes.connection.get("/api/subject_sets/#{subject_set_id}")
|
16
|
-
etag = response.headers[
|
18
|
+
etag = response.headers['ETag']
|
17
19
|
|
18
|
-
response = panoptes.put("/subject_sets/#{subject_set_id}", {subject_sets: attributes}, etag: etag)
|
19
|
-
response.fetch(
|
20
|
+
response = panoptes.put("/subject_sets/#{subject_set_id}", { subject_sets: attributes }, etag: etag)
|
21
|
+
response.fetch('subject_sets').first
|
20
22
|
end
|
21
23
|
|
22
24
|
def add_subjects_to_subject_set(subject_set_id, subject_ids)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Panoptes
|
2
4
|
class Client
|
3
5
|
module Subjects
|
@@ -12,8 +14,8 @@ module Panoptes
|
|
12
14
|
|
13
15
|
raise 'Must filter on at least one of subject_set_id, workflow_id' if query.empty?
|
14
16
|
|
15
|
-
response = panoptes.paginate(
|
16
|
-
response.fetch(
|
17
|
+
response = panoptes.paginate('/subjects', query)
|
18
|
+
response.fetch('subjects')
|
17
19
|
end
|
18
20
|
|
19
21
|
# Fetch a subject given filters (including permissions)
|
@@ -27,7 +29,7 @@ module Panoptes
|
|
27
29
|
|
28
30
|
response = panoptes.get("/subjects/#{subject_id}", query)
|
29
31
|
if response.fetch('subjects', []).count > 1
|
30
|
-
raise StandardError
|
32
|
+
raise StandardError, 'Unexpectedly many subjects returned'
|
31
33
|
end
|
32
34
|
|
33
35
|
response.fetch('subjects', []).fetch(0, nil)
|
@@ -40,11 +42,10 @@ module Panoptes
|
|
40
42
|
# @param subject_id [Integer] the ID of a subject associated with that workflow (through one of the assigned subject_sets)
|
41
43
|
# @return nothing
|
42
44
|
def retire_subject(workflow_id, subject_id, reason: nil)
|
43
|
-
panoptes.post("/workflows/#{workflow_id}/retired_subjects",
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
})
|
45
|
+
panoptes.post("/workflows/#{workflow_id}/retired_subjects",
|
46
|
+
admin: true,
|
47
|
+
subject_id: subject_id,
|
48
|
+
retirement_reason: reason)
|
48
49
|
true
|
49
50
|
end
|
50
51
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Panoptes
|
2
4
|
class Client
|
3
5
|
module UserGroups
|
@@ -7,20 +9,20 @@ module Panoptes
|
|
7
9
|
# @param name [String] The name of the user group. Must be unique for the entirity of Zooniverse.
|
8
10
|
# @return [Hash] The created user group.
|
9
11
|
def create_user_group(name)
|
10
|
-
panoptes.post(
|
11
|
-
|
12
|
-
|
12
|
+
panoptes.post('/user_groups', user_groups: {
|
13
|
+
name: name
|
14
|
+
})['user_groups'][0]
|
13
15
|
end
|
14
16
|
|
15
17
|
def user_groups
|
16
|
-
panoptes.get(
|
18
|
+
panoptes.get('/user_groups')['user_groups']
|
17
19
|
end
|
18
20
|
|
19
21
|
def join_user_group(user_group_id, user_id, join_token:)
|
20
|
-
panoptes.post(
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
panoptes.post('/memberships', memberships: {
|
23
|
+
join_token: join_token,
|
24
|
+
links: { user: user_id, user_group: user_group_id }
|
25
|
+
})['memberships'][0]
|
24
26
|
end
|
25
27
|
|
26
28
|
def remove_user_from_user_group(user_group_id, user_id)
|
@@ -29,7 +31,7 @@ module Panoptes
|
|
29
31
|
|
30
32
|
def delete_user_group(user_group_id)
|
31
33
|
response = panoptes.connection.get("/api/user_groups/#{user_group_id}")
|
32
|
-
etag = response.headers[
|
34
|
+
etag = response.headers['ETag']
|
33
35
|
|
34
36
|
panoptes.delete("/user_groups/#{user_group_id}", {}, etag: etag)
|
35
37
|
end
|
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Panoptes
|
2
4
|
class Client
|
3
5
|
module Users
|
4
6
|
def user(user_id)
|
5
7
|
response = panoptes.get("users/#{user_id}")
|
6
|
-
response.fetch(
|
8
|
+
response.fetch('users').find { |i| i.fetch('id').to_s == user_id.to_s }
|
7
9
|
end
|
8
10
|
end
|
9
11
|
end
|
@@ -1,18 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Panoptes
|
2
4
|
class Client
|
3
5
|
module Workflows
|
4
6
|
def workflow(workflow_id)
|
5
7
|
response = panoptes.get("/workflows/#{workflow_id}")
|
6
|
-
response.fetch(
|
8
|
+
response.fetch('workflows').find do |i|
|
9
|
+
i.fetch('id').to_s == workflow_id.to_s
|
10
|
+
end
|
7
11
|
end
|
8
12
|
|
9
13
|
def create_workflow(attributes)
|
10
|
-
response = panoptes.post(
|
11
|
-
response.fetch(
|
14
|
+
response = panoptes.post('/workflows', workflows: attributes)
|
15
|
+
response.fetch('workflows').first
|
12
16
|
end
|
13
17
|
|
14
18
|
def add_subject_set_to_workflow(workflow_id, subject_set_id)
|
15
|
-
panoptes.post(
|
19
|
+
panoptes.post(
|
20
|
+
"/workflows/#{workflow_id}/links/subject_sets",
|
21
|
+
subject_sets: subject_set_id
|
22
|
+
)
|
16
23
|
end
|
17
24
|
end
|
18
25
|
end
|
data/lib/panoptes/client.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'panoptes/endpoints/json_api_endpoint'
|
2
4
|
require 'panoptes/endpoints/json_endpoint'
|
3
5
|
|
@@ -66,19 +68,19 @@ module Panoptes
|
|
66
68
|
|
67
69
|
def panoptes_url
|
68
70
|
case env
|
69
|
-
when :production, 'production'
|
70
|
-
'https://panoptes.zooniverse.org'
|
71
|
+
when :production, 'production'
|
72
|
+
'https://panoptes.zooniverse.org'
|
71
73
|
else
|
72
|
-
'https://panoptes-staging.zooniverse.org'
|
74
|
+
'https://panoptes-staging.zooniverse.org'
|
73
75
|
end
|
74
76
|
end
|
75
77
|
|
76
78
|
def talk_url
|
77
79
|
case env
|
78
|
-
when :production, 'production'
|
79
|
-
'https://talk.zooniverse.org'
|
80
|
+
when :production, 'production'
|
81
|
+
'https://talk.zooniverse.org'
|
80
82
|
else
|
81
|
-
'https://talk-staging.zooniverse.org'
|
83
|
+
'https://talk-staging.zooniverse.org'
|
82
84
|
end
|
83
85
|
end
|
84
86
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'faraday'
|
2
4
|
require 'faraday_middleware'
|
3
5
|
require 'faraday/panoptes'
|
@@ -58,7 +60,10 @@ module Panoptes
|
|
58
60
|
end
|
59
61
|
|
60
62
|
def request(method, path, *args)
|
61
|
-
|
63
|
+
if prefix
|
64
|
+
sep = path[0] == '/' ? nil : '/'
|
65
|
+
path = "#{prefix}#{sep}#{path}"
|
66
|
+
end
|
62
67
|
handle_response connection.send(method, path, *args)
|
63
68
|
end
|
64
69
|
|
@@ -83,9 +88,7 @@ module Panoptes
|
|
83
88
|
faraday.request :json
|
84
89
|
faraday.response :json
|
85
90
|
faraday.adapter Faraday.default_adapter
|
86
|
-
if @params
|
87
|
-
faraday.params = @params
|
88
|
-
end
|
91
|
+
faraday.params = @params if @params
|
89
92
|
end
|
90
93
|
end
|
91
94
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'base_endpoint'
|
2
4
|
|
3
5
|
module Panoptes
|
@@ -8,17 +10,25 @@ module Panoptes
|
|
8
10
|
resource = path.split('/').last if resource.nil?
|
9
11
|
data = last_response = get(path, query)
|
10
12
|
|
11
|
-
|
13
|
+
# ensure we yield the first page of data
|
14
|
+
yield data, last_response if block_given?
|
15
|
+
|
16
|
+
# while we have more result set pages
|
17
|
+
while (next_path = last_response['meta'][resource]['next_href'])
|
18
|
+
# fetch next page of data
|
12
19
|
last_response = get(next_path, query)
|
13
20
|
if block_given?
|
21
|
+
# if we pass a block then yield the first page and current page responses
|
14
22
|
yield data, last_response
|
15
23
|
else
|
24
|
+
# add to the data representation of all result set pages
|
16
25
|
data[resource].concat(last_response[resource]) if data[resource].is_a?(Array)
|
17
26
|
data['meta'][resource].merge!(last_response['meta'][resource])
|
18
27
|
data['links'].merge!(last_response['links'])
|
19
28
|
end
|
20
29
|
end
|
21
30
|
|
31
|
+
# return the data results for when we don't use a block to process response pages
|
22
32
|
data
|
23
33
|
end
|
24
34
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'base_endpoint'
|
2
4
|
|
3
5
|
module Panoptes
|
@@ -7,7 +9,7 @@ module Panoptes
|
|
7
9
|
# @see Panoptes::Endpoints::BaseEndpoint#initialize
|
8
10
|
def initialize(auth: {}, url: nil, prefix: nil, &config)
|
9
11
|
super auth: auth, url: url, prefix: prefix do |faraday|
|
10
|
-
|
12
|
+
yield(faraday) if config
|
11
13
|
faraday.request :json
|
12
14
|
faraday.response :json
|
13
15
|
faraday.adapter Faraday.default_adapter
|
data/lib/panoptes/session.rb
CHANGED
data/lib/panoptes/talk_client.rb
CHANGED
data/lib/panoptes-client.rb
CHANGED
data/panoptes-client.gemspec
CHANGED
@@ -1,31 +1,32 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'panoptes/client/version'
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
8
|
+
spec.name = 'panoptes-client'
|
8
9
|
spec.version = Panoptes::Client::VERSION
|
9
10
|
spec.authors = ['Marten Veldthuis', 'Zach Wolfenbarger', 'Amy Boyer']
|
10
11
|
spec.email = ['marten@veldthuis.com', 'zach@zooniverse.org', 'amy@zooniverse.org']
|
11
12
|
|
12
|
-
spec.summary =
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
13
|
+
spec.summary = 'API wrapper for https://panoptes.zooniverse.org'
|
14
|
+
spec.homepage = 'https://github.com/zooniverse/panoptes-client.rb'
|
15
|
+
spec.license = 'Apache 2.0'
|
15
16
|
|
16
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
-
spec.bindir =
|
18
|
+
spec.bindir = 'exe'
|
18
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
-
spec.require_paths = [
|
20
|
+
spec.require_paths = ['lib']
|
20
21
|
|
21
|
-
spec.add_dependency
|
22
|
-
spec.add_dependency
|
23
|
-
spec.add_dependency
|
24
|
-
spec.add_dependency
|
22
|
+
spec.add_dependency 'deprecate'
|
23
|
+
spec.add_dependency 'faraday'
|
24
|
+
spec.add_dependency 'faraday-panoptes', '~> 0.3.0'
|
25
|
+
spec.add_dependency 'jwt', '~> 1.5.0'
|
25
26
|
|
26
|
-
spec.add_development_dependency
|
27
|
-
spec.add_development_dependency
|
28
|
-
spec.add_development_dependency
|
29
|
-
spec.add_development_dependency
|
30
|
-
spec.add_development_dependency
|
27
|
+
spec.add_development_dependency 'bundler'
|
28
|
+
spec.add_development_dependency 'rake'
|
29
|
+
spec.add_development_dependency 'rspec'
|
30
|
+
spec.add_development_dependency 'timecop'
|
31
|
+
spec.add_development_dependency 'yard'
|
31
32
|
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.
|
4
|
+
version: 1.1.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: 2021-12-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: deprecate
|
@@ -72,58 +72,58 @@ dependencies:
|
|
72
72
|
name: bundler
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
|
-
- - "
|
75
|
+
- - ">="
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: '
|
77
|
+
version: '0'
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
|
-
- - "
|
82
|
+
- - ">="
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version: '
|
84
|
+
version: '0'
|
85
85
|
- !ruby/object:Gem::Dependency
|
86
86
|
name: rake
|
87
87
|
requirement: !ruby/object:Gem::Requirement
|
88
88
|
requirements:
|
89
|
-
- - "
|
89
|
+
- - ">="
|
90
90
|
- !ruby/object:Gem::Version
|
91
|
-
version: '
|
91
|
+
version: '0'
|
92
92
|
type: :development
|
93
93
|
prerelease: false
|
94
94
|
version_requirements: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
|
-
- - "
|
96
|
+
- - ">="
|
97
97
|
- !ruby/object:Gem::Version
|
98
|
-
version: '
|
98
|
+
version: '0'
|
99
99
|
- !ruby/object:Gem::Dependency
|
100
100
|
name: rspec
|
101
101
|
requirement: !ruby/object:Gem::Requirement
|
102
102
|
requirements:
|
103
|
-
- - "
|
103
|
+
- - ">="
|
104
104
|
- !ruby/object:Gem::Version
|
105
|
-
version: '
|
105
|
+
version: '0'
|
106
106
|
type: :development
|
107
107
|
prerelease: false
|
108
108
|
version_requirements: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
|
-
- - "
|
110
|
+
- - ">="
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version: '
|
112
|
+
version: '0'
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: timecop
|
115
115
|
requirement: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
|
-
- - "
|
117
|
+
- - ">="
|
118
118
|
- !ruby/object:Gem::Version
|
119
|
-
version: 0
|
119
|
+
version: '0'
|
120
120
|
type: :development
|
121
121
|
prerelease: false
|
122
122
|
version_requirements: !ruby/object:Gem::Requirement
|
123
123
|
requirements:
|
124
|
-
- - "
|
124
|
+
- - ">="
|
125
125
|
- !ruby/object:Gem::Version
|
126
|
-
version: 0
|
126
|
+
version: '0'
|
127
127
|
- !ruby/object:Gem::Dependency
|
128
128
|
name: yard
|
129
129
|
requirement: !ruby/object:Gem::Requirement
|
@@ -147,13 +147,14 @@ executables: []
|
|
147
147
|
extensions: []
|
148
148
|
extra_rdoc_files: []
|
149
149
|
files:
|
150
|
+
- ".github/workflows/run_tests_CI.yml"
|
150
151
|
- ".gitignore"
|
151
152
|
- ".hound.yml"
|
152
153
|
- ".rspec"
|
153
|
-
- ".
|
154
|
-
- ".travis.yml"
|
154
|
+
- ".rubocop.yml"
|
155
155
|
- CHANGELOG.md
|
156
156
|
- CODE_OF_CONDUCT.md
|
157
|
+
- Dockerfile
|
157
158
|
- Gemfile
|
158
159
|
- LICENSE.txt
|
159
160
|
- README.md
|
@@ -162,6 +163,7 @@ files:
|
|
162
163
|
- bin/setup
|
163
164
|
- data/doorkeeper-jwt-production.pub
|
164
165
|
- data/doorkeeper-jwt-staging.pub
|
166
|
+
- docker-compose.yml
|
165
167
|
- lib/panoptes-client.rb
|
166
168
|
- lib/panoptes/client.rb
|
167
169
|
- lib/panoptes/client/authentication.rb
|
@@ -200,11 +202,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
200
202
|
version: '0'
|
201
203
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
202
204
|
requirements:
|
203
|
-
- - "
|
205
|
+
- - ">="
|
204
206
|
- !ruby/object:Gem::Version
|
205
|
-
version:
|
207
|
+
version: '0'
|
206
208
|
requirements: []
|
207
|
-
rubygems_version: 3.
|
209
|
+
rubygems_version: 3.1.6
|
208
210
|
signing_key:
|
209
211
|
specification_version: 4
|
210
212
|
summary: API wrapper for https://panoptes.zooniverse.org
|
data/.ruby-style.yml
DELETED
@@ -1,206 +0,0 @@
|
|
1
|
-
inherit_from: .rubocop_todo.yml
|
2
|
-
|
3
|
-
AllCops:
|
4
|
-
Exclude:
|
5
|
-
- "vendor/**/*"
|
6
|
-
- "db/schema.rb"
|
7
|
-
UseCache: false
|
8
|
-
|
9
|
-
Style/DotPosition:
|
10
|
-
Description: Checks the position of the dot in multi-line method calls.
|
11
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains
|
12
|
-
Enabled: true
|
13
|
-
EnforcedStyle: leading
|
14
|
-
SupportedStyles:
|
15
|
-
- leading
|
16
|
-
- trailing
|
17
|
-
Style/FileName:
|
18
|
-
Description: Use snake_case for source file names.
|
19
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files
|
20
|
-
Enabled: true
|
21
|
-
Exclude: []
|
22
|
-
Style/GuardClause:
|
23
|
-
Description: Check for conditionals that can be replaced with guard clauses
|
24
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
|
25
|
-
Enabled: false
|
26
|
-
MinBodyLength: 1
|
27
|
-
Style/IfUnlessModifier:
|
28
|
-
Description: Favor modifier if/unless usage when you have a single-line body.
|
29
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier
|
30
|
-
Enabled: false
|
31
|
-
MaxLineLength: 80
|
32
|
-
Style/OptionHash:
|
33
|
-
Description: Don't use option hashes when you can use keyword arguments.
|
34
|
-
Enabled: false
|
35
|
-
Style/ParallelAssignment:
|
36
|
-
Enabled: false
|
37
|
-
Style/PercentLiteralDelimiters:
|
38
|
-
Description: Use `%`-literal delimiters consistently
|
39
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-literal-braces
|
40
|
-
Enabled: false
|
41
|
-
PreferredDelimiters:
|
42
|
-
"%": "()"
|
43
|
-
"%i": "()"
|
44
|
-
"%q": "()"
|
45
|
-
"%Q": "()"
|
46
|
-
"%r": "{}"
|
47
|
-
"%s": "()"
|
48
|
-
"%w": "()"
|
49
|
-
"%W": "()"
|
50
|
-
"%x": "()"
|
51
|
-
Style/PredicateName:
|
52
|
-
Description: Check the names of predicate methods.
|
53
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
|
54
|
-
Enabled: true
|
55
|
-
NamePrefix:
|
56
|
-
- is_
|
57
|
-
- has_
|
58
|
-
- have_
|
59
|
-
NamePrefixBlacklist:
|
60
|
-
- is_
|
61
|
-
Exclude:
|
62
|
-
- spec/**/*
|
63
|
-
Style/RaiseArgs:
|
64
|
-
Description: Checks the arguments passed to raise/fail.
|
65
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#exception-class-messages
|
66
|
-
Enabled: false
|
67
|
-
EnforcedStyle: exploded
|
68
|
-
SupportedStyles:
|
69
|
-
- compact
|
70
|
-
- exploded
|
71
|
-
Style/SignalException:
|
72
|
-
Description: Checks for proper usage of fail and raise.
|
73
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#fail-method
|
74
|
-
Enabled: false
|
75
|
-
EnforcedStyle: semantic
|
76
|
-
SupportedStyles:
|
77
|
-
- only_raise
|
78
|
-
- only_fail
|
79
|
-
- semantic
|
80
|
-
Style/SingleLineBlockParams:
|
81
|
-
Description: Enforces the names of some block params.
|
82
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#reduce-blocks
|
83
|
-
Enabled: false
|
84
|
-
Methods:
|
85
|
-
- reduce:
|
86
|
-
- a
|
87
|
-
- e
|
88
|
-
- inject:
|
89
|
-
- a
|
90
|
-
- e
|
91
|
-
Style/SingleLineMethods:
|
92
|
-
Description: Avoid single-line methods.
|
93
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-single-line-methods
|
94
|
-
Enabled: false
|
95
|
-
AllowIfMethodIsEmpty: true
|
96
|
-
Metrics/AbcSize:
|
97
|
-
Description: A calculated magnitude based on number of assignments, branches, and
|
98
|
-
conditions.
|
99
|
-
Enabled: false
|
100
|
-
Max: 15
|
101
|
-
Metrics/ClassLength:
|
102
|
-
Description: Avoid classes longer than 100 lines of code.
|
103
|
-
Enabled: false
|
104
|
-
CountComments: false
|
105
|
-
Max: 100
|
106
|
-
Metrics/LineLength:
|
107
|
-
Enabled: false
|
108
|
-
Metrics/ModuleLength:
|
109
|
-
CountComments: false
|
110
|
-
Max: 100
|
111
|
-
Description: Avoid modules longer than 100 lines of code.
|
112
|
-
Enabled: false
|
113
|
-
Metrics/CyclomaticComplexity:
|
114
|
-
Description: A complexity metric that is strongly correlated to the number of test
|
115
|
-
cases needed to validate a method.
|
116
|
-
Enabled: false
|
117
|
-
Max: 6
|
118
|
-
Metrics/MethodLength:
|
119
|
-
Description: Avoid methods longer than 10 lines of code.
|
120
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#short-methods
|
121
|
-
Enabled: false
|
122
|
-
CountComments: false
|
123
|
-
Max: 10
|
124
|
-
Metrics/ParameterLists:
|
125
|
-
Description: Avoid parameter lists longer than three or four parameters.
|
126
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#too-many-params
|
127
|
-
Enabled: false
|
128
|
-
Max: 5
|
129
|
-
CountKeywordArgs: true
|
130
|
-
Metrics/PerceivedComplexity:
|
131
|
-
Description: A complexity metric geared towards measuring complexity for a human
|
132
|
-
reader.
|
133
|
-
Enabled: false
|
134
|
-
Max: 7
|
135
|
-
Lint/AssignmentInCondition:
|
136
|
-
Description: Don't use assignment in conditions.
|
137
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition
|
138
|
-
Enabled: false
|
139
|
-
AllowSafeAssignment: true
|
140
|
-
Style/InlineComment:
|
141
|
-
Description: Avoid inline comments.
|
142
|
-
Enabled: false
|
143
|
-
Style/AccessorMethodName:
|
144
|
-
Description: Check the naming of accessor methods for get_/set_.
|
145
|
-
Enabled: false
|
146
|
-
Style/Alias:
|
147
|
-
Description: Use alias_method instead of alias.
|
148
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#alias-method
|
149
|
-
Enabled: false
|
150
|
-
Style/Documentation:
|
151
|
-
Description: Document classes and non-namespace modules.
|
152
|
-
Enabled: false
|
153
|
-
Style/DoubleNegation:
|
154
|
-
Description: Checks for uses of double negation (!!).
|
155
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-bang-bang
|
156
|
-
Enabled: false
|
157
|
-
Style/EachWithObject:
|
158
|
-
Description: Prefer `each_with_object` over `inject` or `reduce`.
|
159
|
-
Enabled: false
|
160
|
-
Style/EmptyLiteral:
|
161
|
-
Description: Prefer literals to Array.new/Hash.new/String.new.
|
162
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#literal-array-hash
|
163
|
-
Enabled: false
|
164
|
-
Style/ModuleFunction:
|
165
|
-
Description: Checks for usage of `extend self` in modules.
|
166
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#module-function
|
167
|
-
Enabled: false
|
168
|
-
Style/OneLineConditional:
|
169
|
-
Description: Favor the ternary operator(?:) over if/then/else/end constructs.
|
170
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#ternary-operator
|
171
|
-
Enabled: false
|
172
|
-
Style/PerlBackrefs:
|
173
|
-
Description: Avoid Perl-style regex back references.
|
174
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers
|
175
|
-
Enabled: false
|
176
|
-
Style/Send:
|
177
|
-
Description: Prefer `Object#__send__` or `Object#public_send` to `send`, as `send`
|
178
|
-
may overlap with existing methods.
|
179
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#prefer-public-send
|
180
|
-
Enabled: false
|
181
|
-
Style/SpecialGlobalVars:
|
182
|
-
Description: Avoid Perl-style global variables.
|
183
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms
|
184
|
-
Enabled: false
|
185
|
-
Style/VariableInterpolation:
|
186
|
-
Description: Don't interpolate global, instance and class variables directly in
|
187
|
-
strings.
|
188
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#curlies-interpolate
|
189
|
-
Enabled: false
|
190
|
-
Style/WhenThen:
|
191
|
-
Description: Use when x then ... for one-line cases.
|
192
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#one-line-cases
|
193
|
-
Enabled: false
|
194
|
-
Lint/EachWithObjectArgument:
|
195
|
-
Description: Check for immutable argument given to each_with_object.
|
196
|
-
Enabled: true
|
197
|
-
Lint/HandleExceptions:
|
198
|
-
Description: Don't suppress exception.
|
199
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions
|
200
|
-
Enabled: false
|
201
|
-
Lint/LiteralInCondition:
|
202
|
-
Description: Checks of literals used in conditions.
|
203
|
-
Enabled: false
|
204
|
-
Lint/LiteralInInterpolation:
|
205
|
-
Description: Checks for literals used in interpolation.
|
206
|
-
Enabled: false
|