panoptes-client 1.1.0 → 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/.rubocop.yml +7 -0
- data/CHANGELOG.md +11 -0
- data/Dockerfile +22 -0
- data/README.md +22 -2
- data/docker-compose.yml +11 -0
- data/lib/panoptes/client/version.rb +1 -1
- data/lib/panoptes/endpoints/json_api_endpoint.rb +9 -1
- data/panoptes-client.gemspec +4 -4
- metadata +22 -20
- data/.travis.yml +0 -7
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/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
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
|
+
|
1
12
|
# 1.1.0
|
2
13
|
|
3
14
|
* Add method to get single collection
|
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/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,13 +13,23 @@ 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
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
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
|
+
```
|
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
|
|
25
35
|
| Variable | Value |
|
@@ -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/docker-compose.yml
ADDED
@@ -10,17 +10,25 @@ module Panoptes
|
|
10
10
|
resource = path.split('/').last if resource.nil?
|
11
11
|
data = last_response = get(path, query)
|
12
12
|
|
13
|
-
|
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
|
14
19
|
last_response = get(next_path, query)
|
15
20
|
if block_given?
|
21
|
+
# if we pass a block then yield the first page and current page responses
|
16
22
|
yield data, last_response
|
17
23
|
else
|
24
|
+
# add to the data representation of all result set pages
|
18
25
|
data[resource].concat(last_response[resource]) if data[resource].is_a?(Array)
|
19
26
|
data['meta'][resource].merge!(last_response['meta'][resource])
|
20
27
|
data['links'].merge!(last_response['links'])
|
21
28
|
end
|
22
29
|
end
|
23
30
|
|
31
|
+
# return the data results for when we don't use a block to process response pages
|
24
32
|
data
|
25
33
|
end
|
26
34
|
end
|
data/panoptes-client.gemspec
CHANGED
@@ -24,9 +24,9 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_dependency 'faraday-panoptes', '~> 0.3.0'
|
25
25
|
spec.add_dependency 'jwt', '~> 1.5.0'
|
26
26
|
|
27
|
-
spec.add_development_dependency 'bundler'
|
28
|
-
spec.add_development_dependency 'rake'
|
29
|
-
spec.add_development_dependency 'rspec'
|
30
|
-
spec.add_development_dependency 'timecop'
|
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
31
|
spec.add_development_dependency 'yard'
|
32
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.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
|
- ".rubocop.yml"
|
154
|
-
- ".travis.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
|
@@ -204,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
204
206
|
- !ruby/object:Gem::Version
|
205
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
|