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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f5358d4bb649b1bf4b50345a96ca0738b108c8f81c426ece1fc85fec9a4b20bb
4
- data.tar.gz: 9b7cd2cd61410e20952e5dba0fc3a5a8ee35cb6ffe103921a0915d4c170a3167
3
+ metadata.gz: 71b55ec7fda33fdcfe5e0e69fe2d87b6fd3efda99ebef7f84c51ae77bb4b8218
4
+ data.tar.gz: a9699004a5afc535e3e64dbcda84c80329e8db6920b9c2e7e314215c5033e6a3
5
5
  SHA512:
6
- metadata.gz: 60c107cd24690536a0ca3b64325451a8350008c3c33e49805c21f6353b18c17cad4e668ad7ead895fecbc81599041458cb15ab5fd9cce7c2798e7c4064eafb99
7
- data.tar.gz: 7eca6a82e3a836fe3a07e4b5d223e8ccbf10861a5fa011beafc9b8c8f7438f4ad07c7e56ffa04b3a910e7a4db6ad955a39dcd2ed5584346c243c0909dc935dd4
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 = limit ? [limit - data.length, MAX_PER_PAGE].min : MAX_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
@@ -1,3 +1,3 @@
1
1
  module GreenhouseApi
2
- VERSION = "0.1.13"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.13
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-02 00:00:00.000000000 Z
13
+ date: 2021-02-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: faraday