ecoportal-api 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8071a9704b5accb61bd9db43b0bd6c8c6d6f88aee00ef80d16fd4b5522aedf3c
|
4
|
+
data.tar.gz: fc42e6ea6570565a22cb52d9941ace6bcb081b42553321d552c1d1794ec0f8f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52a24b2a8f5326e92b42af2781c6a498580dfda7a16458c288b77e7ac5dea01cfa0ed619f27ea7a86d4ce27e4b004c156205a14076ac51cc06203c6abbc28820
|
7
|
+
data.tar.gz: 7146daf930693399e4935f0b00645768b64e0c44a7772f0c128042ab151bf29f0598e2e357e0462af77dd423561646c98cdd350e59830bd733e9c51bc120684a
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
## [0.7.1] - 2020-09-30
|
5
|
+
|
6
|
+
### Added
|
7
|
+
- `Ecoportal::API::Internal::Permissions`: **update for new ability `tasks` of ecoPortal release `1.5.3`**
|
8
|
+
- `Ecoportal::API::V1::People#each`: added keyword argument `silent:` to display download progress
|
9
|
+
### Fixed
|
10
|
+
- `Ecoportal::API::V1::People#each`: when no block provided, it was creating an `Enumarator` without preserving the parameters (i.e. `:q` or `per_page` were lost)
|
11
|
+
|
4
12
|
## [0.7.0] - 2020-09-11
|
5
13
|
|
6
14
|
### Added
|
@@ -5,7 +5,7 @@ module Ecoportal
|
|
5
5
|
passthrough :files, :data, :reports
|
6
6
|
passthrough :organization, :person_core, :person_core_create, :person_core_edit
|
7
7
|
passthrough :person_account, :person_details
|
8
|
-
passthrough :pages, :page_editor, :registers
|
8
|
+
passthrough :pages, :page_editor, :registers, :tasks
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -27,15 +27,27 @@ module Ecoportal
|
|
27
27
|
# @param params [Hash]
|
28
28
|
# @option params [String] :per_page the number of people you get per request.
|
29
29
|
# @option params [String] :q some text to search. Omit this parameter to target all the people.
|
30
|
+
# @param silent [Boolean] `false` to show percentage of progress.
|
30
31
|
# @yield [person] does some stuff with the person.
|
31
32
|
# @yieldparam person [Person]
|
32
|
-
def each(params: {}, &block)
|
33
|
-
return to_enum(:each) unless block
|
34
|
-
cursor_id = nil
|
33
|
+
def each(params: {}, silent: false, &block)
|
34
|
+
return to_enum(:each, params: params, silent: silent) unless block
|
35
|
+
cursor_id = nil; results = 0
|
36
|
+
puts "\n"
|
35
37
|
loop do
|
36
38
|
params.update(cursor_id: cursor_id) if cursor_id
|
37
39
|
response = client.get("/people", params: params)
|
38
|
-
raise "Request failed." unless response.success?
|
40
|
+
raise "Request failed - Status #{response.status}: #{response.body}" unless response.success?
|
41
|
+
|
42
|
+
unless silent || (total = response.body["total_results"]) == 0
|
43
|
+
results += response.body["results"].length
|
44
|
+
percent = results * 100 / total
|
45
|
+
msg = "People GET"
|
46
|
+
msg += " (search=#{params[:q]})" if params.key?(:q)
|
47
|
+
print "#{msg}: #{percent.round}% (of #{total})\r"
|
48
|
+
$stdout.flush
|
49
|
+
end
|
50
|
+
|
39
51
|
response.body["results"].each do |person|
|
40
52
|
yield person_class.new(person)
|
41
53
|
end
|
@@ -45,13 +57,14 @@ module Ecoportal
|
|
45
57
|
end
|
46
58
|
|
47
59
|
# Gets all the people via api requests.
|
48
|
-
# @note it ignores the key `:
|
60
|
+
# @note it ignores the key `:cursor_id` in `params:`.
|
49
61
|
# @param params [Hash]
|
50
62
|
# @option params [Integer] :per_page the number of people you get per request.
|
51
63
|
# @option params [String] :q some text to search.
|
64
|
+
# @param silent [Boolean] `false` to show percentage of progress.
|
52
65
|
# @return [Array<Person>] the array of people got via api.
|
53
|
-
def get_all(params: {})
|
54
|
-
each(params: params).to_a
|
66
|
+
def get_all(params: {}, silent: false)
|
67
|
+
each(params: params, silent: silent).to_a
|
55
68
|
end
|
56
69
|
|
57
70
|
# Gets a person via api.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ecoportal-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tapio Saarinen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -182,7 +182,6 @@ files:
|
|
182
182
|
- lib/ecoportal/api/common/response.rb
|
183
183
|
- lib/ecoportal/api/common/wrapped_response.rb
|
184
184
|
- lib/ecoportal/api/internal.rb
|
185
|
-
- lib/ecoportal/api/internal/.git-keep
|
186
185
|
- lib/ecoportal/api/internal/account.rb
|
187
186
|
- lib/ecoportal/api/internal/login_provider.rb
|
188
187
|
- lib/ecoportal/api/internal/login_providers.rb
|
@@ -199,7 +198,6 @@ files:
|
|
199
198
|
- lib/ecoportal/api/internal/schema_field_value.rb
|
200
199
|
- lib/ecoportal/api/logger.rb
|
201
200
|
- lib/ecoportal/api/v1.rb
|
202
|
-
- lib/ecoportal/api/v1/.git-keep
|
203
201
|
- lib/ecoportal/api/v1/people.rb
|
204
202
|
- lib/ecoportal/api/v1/person.rb
|
205
203
|
- lib/ecoportal/api/v1/person_details.rb
|
File without changes
|
File without changes
|