ecoportal-api 0.4.2 → 0.4.3

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: d1914cfc85642ce0eb960a35e6dc4d97282940945e8a366cd2151a69fc6b7ce8
4
- data.tar.gz: 31d89929059068830b89ccae88343a20643531d5165ca0e62464bf2f9a4f0576
3
+ metadata.gz: 5441ef892224dc43af0a9060cf90725d93640cc98a66642565962ace69eefa00
4
+ data.tar.gz: 5c53d8665f94cae4e06f86b72cc4807ed8862908f0999156fd792d38c8a46ed5
5
5
  SHA512:
6
- metadata.gz: 9325950d7ea384111f5905635b879ce83ebbc9174409f54ef63b172ad4da1d35aee37e37d97593e161c9a62449266dbcd05a1ba2da194ae2a3cbcdce72831f55
7
- data.tar.gz: 68e5c643263e021dbd88eb26710c9cd549913d57164b6a53aebbb98cf8b38809525c88f0f709680fed8e926fdce88310a20956585b97d829f0fe7c86d5e5b333
6
+ metadata.gz: 0102b941ada369991d37a24676fedf97055633b3df0b4b0198f5dfef7007ddc289b53c1e36cdf4a0aae4afa995a26b05c26a3d2df5aecdcfeabe6e53bf108650
7
+ data.tar.gz: e3d0401ba1d6d91508812f549677e23fc60667cb794d22cafe82fc5bda8c344b529cf248856c36f1d13dad9d4e0bc8a00d66844f628686b6b3442035521f1a12
@@ -19,7 +19,7 @@ module Ecoportal
19
19
 
20
20
  # Iterates all the people of the organization.
21
21
  # @note
22
- # - it ignores the key `page:` of `params:`.
22
+ # - it ignores the key `results_from:` of `params:`.
23
23
  # - `each` is called by `to_a`
24
24
  # @param params [Hash]
25
25
  # @option params [String] :per_page the number of people you get per request.
@@ -28,15 +28,15 @@ module Ecoportal
28
28
  # @yieldparam person [Person]
29
29
  def each(params: {}, &block)
30
30
  return to_enum(:each) unless block
31
- page = 1
31
+ results_from = nil
32
32
  loop do
33
- response = client.get("/people", params: params.merge(page: page))
33
+ params.update(results_from: results_from) if results_from
34
+ response = client.get("/people", params: params)
34
35
  raise "Request failed." unless response.success?
35
36
  response.body["results"].each do |person|
36
37
  yield person_class.new(person)
37
38
  end
38
- break if page >= response.body["total_pages"]
39
- page += 1
39
+ break unless (results_from = response.body["next_results_from"])
40
40
  end
41
41
  self
42
42
  end
@@ -1,5 +1,5 @@
1
1
  module Ecoportal
2
2
  module API
3
- VERSION = "0.4.2"
3
+ VERSION = "0.4.3"
4
4
  end
5
5
  end
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.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tapio Saarinen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-29 00:00:00.000000000 Z
11
+ date: 2019-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler