greenhouse_api 0.1.10 → 0.3.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: b7f90dea641cda5e0664489eaf2a4cc03eda246f4ee0c97cb072b29fab55599c
4
- data.tar.gz: eaa7a3e88c7717b4e5e4f7aaaf3d80155596890d476006e53abf3c6cec681bc5
3
+ metadata.gz: a1fab948b4333edf3ab3a128c3e71f6ab4f2bab1f95bdd17520ff9831e1219ce
4
+ data.tar.gz: ae1f68bb1eaf7ac0df2b89611c1ef35ebcf37180a61ee96e9cb5f2c840b9cb6d
5
5
  SHA512:
6
- metadata.gz: 501c881a0e6f8aa98caca519419dfd8103a58e90a21651af54a68a3fc5382971ba45471a6e76011f353b6a30ea0cd8e2dbbe2affc599029059ca7084794cc03e
7
- data.tar.gz: a7e993de6c9de71755f2aa84f39216d3dd38e1415ba97e40eb507f3ba3e655fef9d937d20dd0682c35f9c24f1038007ffc755d6863c582be74bb78a0562d776d
6
+ metadata.gz: a72fec148d23ccac414a5a3e9b4f0dfd035e3b0b08b6224c3b8c3aa6fda34e58b1bb6629ac22490ca45876b7a4986c2d640dcc0c72cd5328813ccbabddf5dc34
7
+ data.tar.gz: 7cd234779df2fc0a49ee8879538d705c5bf5085bcca90b165dc6e755730b5721fcdb38193af8bdc072f69ed410894e623b06a6b4f008ff6adcd4539472b475af
@@ -1,3 +1,4 @@
1
+ # typed: strict
1
2
  # frozen_string_literal: true
2
3
 
3
4
  require "greenhouse_api/version"
@@ -1,3 +1,4 @@
1
+ # typed: false
1
2
  # frozen_string_literal: true
2
3
 
3
4
  require 'faraday'
@@ -27,14 +28,37 @@ module GreenhouseApi
27
28
  list_many('candidates', params)
28
29
  end
29
30
 
31
+ def get_current_offer_for_application(application_id)
32
+ response = request(
33
+ http_method: :get,
34
+ headers: headers,
35
+ endpoint: "applications/#{application_id}/offers/current_offer",
36
+ params: {}
37
+ )
38
+
39
+ if response.status == 200
40
+ Response.new(
41
+ body: response.body,
42
+ headers: response.headers,
43
+ status: response.status
44
+ )
45
+ else
46
+ response
47
+ end
48
+ end
49
+
30
50
  def list_many(resource, params = {})
31
51
  limit = params.delete(:limit)
32
- page = 1
52
+ page = params[:page] || 1
33
53
  data = []
34
54
  response = nil
35
55
 
36
56
  loop do
37
- per_page = limit ? [limit - data.length, MAX_PER_PAGE].min : MAX_PER_PAGE
57
+ per_page = if params[:per_page]
58
+ params[:per_page]
59
+ else
60
+ limit ? [limit - data.length, MAX_PER_PAGE].min : MAX_PER_PAGE
61
+ end
38
62
 
39
63
  response = request(
40
64
  http_method: :get,
@@ -46,7 +70,7 @@ module GreenhouseApi
46
70
 
47
71
  data.concat(response.body)
48
72
 
49
- if last_page?(response) || data_limit_reached?(data, limit)
73
+ if last_page?(response) || data_limit_reached?(data, limit) || params[:page]
50
74
  break
51
75
  else
52
76
  page += 1
@@ -1,3 +1,4 @@
1
+ # typed: strict
1
2
  module GreenhouseApi
2
- VERSION = "0.1.10"
3
+ VERSION = "0.3.0"
3
4
  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.10
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florence Lau
@@ -10,22 +10,36 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2020-12-02 00:00:00.000000000 Z
13
+ date: 2021-02-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: faraday
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - "~>"
19
+ - - ">="
20
20
  - !ruby/object:Gem::Version
21
- version: '1.1'
21
+ version: 0.15.4
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - "~>"
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ version: 0.15.4
29
+ - !ruby/object:Gem::Dependency
30
+ name: sorbet-runtime
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '0.5'
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
27
41
  - !ruby/object:Gem::Version
28
- version: '1.1'
42
+ version: '0.5'
29
43
  - !ruby/object:Gem::Dependency
30
44
  name: rspec
31
45
  requirement: !ruby/object:Gem::Requirement
@@ -40,6 +54,20 @@ dependencies:
40
54
  - - "~>"
41
55
  - !ruby/object:Gem::Version
42
56
  version: '3.10'
57
+ - !ruby/object:Gem::Dependency
58
+ name: sorbet
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0.5'
64
+ type: :development
65
+ prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0.5'
43
71
  - !ruby/object:Gem::Dependency
44
72
  name: vcr
45
73
  requirement: !ruby/object:Gem::Requirement