greenhouse_api 0.1.13 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/greenhouse_api/client.rb +7 -3
- data/lib/greenhouse_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71b55ec7fda33fdcfe5e0e69fe2d87b6fd3efda99ebef7f84c51ae77bb4b8218
|
4
|
+
data.tar.gz: a9699004a5afc535e3e64dbcda84c80329e8db6920b9c2e7e314215c5033e6a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79da2b411054107375a4d670ac2fcac88db3e422cb64614ed0a5823a3732cb18419aa6e51adcca90193c9ae5a339b0a8a9fad9476a9d806a7ffa7e8f11b21788
|
7
|
+
data.tar.gz: 2ce8c8b90f7d7e2e54a0db7d4f96e684867338499f2b844fcb134d8bf612a712c3c580b0d5fe6d6bb456c37271ddd5342f20b1687ae5b1d639ab0af018549101
|
@@ -48,12 +48,16 @@ module GreenhouseApi
|
|
48
48
|
|
49
49
|
def list_many(resource, params = {})
|
50
50
|
limit = params.delete(:limit)
|
51
|
-
page = 1
|
51
|
+
page = params[:page] || 1
|
52
52
|
data = []
|
53
53
|
response = nil
|
54
54
|
|
55
55
|
loop do
|
56
|
-
per_page =
|
56
|
+
per_page = if params[:per_page]
|
57
|
+
params[:per_page]
|
58
|
+
else
|
59
|
+
limit ? [limit - data.length, MAX_PER_PAGE].min : MAX_PER_PAGE
|
60
|
+
end
|
57
61
|
|
58
62
|
response = request(
|
59
63
|
http_method: :get,
|
@@ -65,7 +69,7 @@ module GreenhouseApi
|
|
65
69
|
|
66
70
|
data.concat(response.body)
|
67
71
|
|
68
|
-
if last_page?(response) || data_limit_reached?(data, limit)
|
72
|
+
if last_page?(response) || data_limit_reached?(data, limit) || params[:page]
|
69
73
|
break
|
70
74
|
else
|
71
75
|
page += 1
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: greenhouse_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florence Lau
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-02-
|
13
|
+
date: 2021-02-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: faraday
|