teamtailor 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +30 -1
- data/Gemfile.lock +3 -3
- data/lib/teamtailor/client.rb +145 -3
- data/lib/teamtailor/parser.rb +22 -1
- data/lib/teamtailor/parser/company.rb +11 -0
- data/lib/teamtailor/parser/custom_field.rb +8 -0
- data/lib/teamtailor/parser/custom_field_value.rb +8 -0
- data/lib/teamtailor/parser/department.rb +8 -0
- data/lib/teamtailor/parser/location.rb +8 -0
- data/lib/teamtailor/parser/partner_result.rb +11 -0
- data/lib/teamtailor/parser/referral.rb +8 -0
- data/lib/teamtailor/parser/reject_reason.rb +8 -0
- data/lib/teamtailor/parser/requisition.rb +8 -0
- data/lib/teamtailor/parser/requisition_step_verdict.rb +8 -0
- data/lib/teamtailor/parser/stage.rb +8 -0
- data/lib/teamtailor/record.rb +2 -0
- data/lib/teamtailor/relationship.rb +10 -8
- data/lib/teamtailor/version.rb +1 -1
- metadata +13 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2149b16c38eaf624c87c2f06eec2acea93d0cd3e92d6b7a6322f43809c20816f
|
4
|
+
data.tar.gz: 1250d366f8bb782a3909a10768219d938d411d6ede3222153ab9873cd3c6167f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f0da415942f37cc09fd8f8ea914ca78001305be8c3b9de66b9a2a215a12a489f13e0f13133661129042603d8c055428e2062b1dcabad230b7ed84be2125b937
|
7
|
+
data.tar.gz: 323f5bdd970d9bf602d87fd8822cb1c99141b0d0ae7ad9a903e639c09a078d6b03748f975ec717228818ca0728d440bd81f9104bb3676005e5859a397eb522d8
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,39 @@
|
|
1
1
|
## Unreleased
|
2
2
|
|
3
|
+
## v0.3.0 - 2020-05-18
|
4
|
+
|
5
|
+
- [BREAKING] Update `Teamtailor::Relationship` to always return multiple records
|
6
|
+
- Add `Teamtailor::Requisition` and `Client#requisitions`
|
7
|
+
- Add `Teamtailor::RequisitionStepVerdict`
|
8
|
+
- Fix accessing nested relationships on `Relationship`
|
9
|
+
|
10
|
+
## v0.2.6 - 2020-05-18
|
11
|
+
|
12
|
+
- Add `Teamtailor::PartnerResult` and `Client#partner_results`
|
13
|
+
- Add `Teamtailor::Referral` and `Client#referrals`
|
14
|
+
- Add `Teamtailor::CustomField` and `Teamtailor::CustomFieldValue`
|
15
|
+
- Add `Client#custom_fields` and `Client#custom_field_values`
|
16
|
+
|
17
|
+
## v0.2.5 - 2020-05-15
|
18
|
+
|
19
|
+
- Add `filters:` as an argument to `Client#jobs`
|
20
|
+
|
21
|
+
## v0.2.4 - 2020-04-07
|
22
|
+
|
23
|
+
- Add `Teamtailor::Location` and `Client#locations`
|
24
|
+
- Add `Teamtailor::Department` and `Client#departments`
|
25
|
+
- Add `Teamtailor::RejectReason` and `Client#reject_reasons`
|
26
|
+
- Add `Teamtailor::Stage` and `Client#stages` for fetching it (`2179b1`)
|
27
|
+
|
28
|
+
## v0.2.3 - 2020-04-06
|
29
|
+
|
30
|
+
- Add `Teamtailor::Company` and `Client#company` for fetching it (`05dde0`)
|
31
|
+
|
3
32
|
## v0.2.2 - 2020-03-31
|
4
33
|
|
5
34
|
- Move serialization logic in the `Teamtailor::Record` base class (`9ec63a0`)
|
6
35
|
- Fix serializing/deserializing loaded relationships for
|
7
|
-
`Teamtailor::JobApplication` (`428e2d`)
|
36
|
+
`Teamtailor::JobApplication` (`428e2d`)
|
8
37
|
|
9
38
|
## v0.2.1 - 2020-03-31
|
10
39
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
teamtailor (0.
|
4
|
+
teamtailor (0.3.0)
|
5
5
|
typhoeus (~> 1.3.1)
|
6
6
|
|
7
7
|
GEM
|
@@ -16,7 +16,7 @@ GEM
|
|
16
16
|
docile (1.3.2)
|
17
17
|
ethon (0.12.0)
|
18
18
|
ffi (>= 1.3.0)
|
19
|
-
ffi (1.
|
19
|
+
ffi (1.13.1)
|
20
20
|
hashdiff (1.0.1)
|
21
21
|
jaro_winkler (1.5.4)
|
22
22
|
parallel (1.19.1)
|
@@ -73,4 +73,4 @@ DEPENDENCIES
|
|
73
73
|
webmock (~> 3.4, >= 3.4.2)
|
74
74
|
|
75
75
|
BUNDLED WITH
|
76
|
-
2.1.
|
76
|
+
2.1.4
|
data/lib/teamtailor/client.rb
CHANGED
@@ -10,6 +10,18 @@ module Teamtailor
|
|
10
10
|
@api_version = api_version
|
11
11
|
end
|
12
12
|
|
13
|
+
def company(include: [])
|
14
|
+
Teamtailor::Request.new(
|
15
|
+
base_url: base_url,
|
16
|
+
api_token: api_token,
|
17
|
+
api_version: api_version,
|
18
|
+
path: '/v1/company',
|
19
|
+
params: {
|
20
|
+
'include' => include.join(',')
|
21
|
+
}
|
22
|
+
).call
|
23
|
+
end
|
24
|
+
|
13
25
|
def candidates(page: 1, include: [])
|
14
26
|
Teamtailor::Request.new(
|
15
27
|
base_url: base_url,
|
@@ -24,7 +36,11 @@ module Teamtailor
|
|
24
36
|
).call
|
25
37
|
end
|
26
38
|
|
27
|
-
def jobs(page: 1, include: [])
|
39
|
+
def jobs(page: 1, include: [], filters: {})
|
40
|
+
filter_params = filters.keys.map do |key|
|
41
|
+
{ "filter[#{key}]" => filters[key] }
|
42
|
+
end
|
43
|
+
|
28
44
|
Teamtailor::Request.new(
|
29
45
|
base_url: base_url,
|
30
46
|
api_token: api_token,
|
@@ -33,8 +49,8 @@ module Teamtailor
|
|
33
49
|
params: {
|
34
50
|
'page[number]' => page,
|
35
51
|
'page[size]' => 30,
|
36
|
-
'include' => include.join(',')
|
37
|
-
}
|
52
|
+
'include' => include.join(','),
|
53
|
+
}.merge(*filter_params)
|
38
54
|
).call
|
39
55
|
end
|
40
56
|
|
@@ -66,6 +82,132 @@ module Teamtailor
|
|
66
82
|
).call
|
67
83
|
end
|
68
84
|
|
85
|
+
def stages(page: 1, include: [])
|
86
|
+
Teamtailor::Request.new(
|
87
|
+
base_url: base_url,
|
88
|
+
api_token: api_token,
|
89
|
+
api_version: api_version,
|
90
|
+
path: '/v1/stages',
|
91
|
+
params: {
|
92
|
+
'page[number]' => page,
|
93
|
+
'page[size]' => 30,
|
94
|
+
'include' => include.join(',')
|
95
|
+
}
|
96
|
+
).call
|
97
|
+
end
|
98
|
+
|
99
|
+
def reject_reasons(page: 1, include: [])
|
100
|
+
Teamtailor::Request.new(
|
101
|
+
base_url: base_url,
|
102
|
+
api_token: api_token,
|
103
|
+
api_version: api_version,
|
104
|
+
path: '/v1/reject-reasons',
|
105
|
+
params: {
|
106
|
+
'page[number]' => page,
|
107
|
+
'page[size]' => 30,
|
108
|
+
'include' => include.join(',')
|
109
|
+
}
|
110
|
+
).call
|
111
|
+
end
|
112
|
+
|
113
|
+
def departments(page: 1, include: [])
|
114
|
+
Teamtailor::Request.new(
|
115
|
+
base_url: base_url,
|
116
|
+
api_token: api_token,
|
117
|
+
api_version: api_version,
|
118
|
+
path: '/v1/departments',
|
119
|
+
params: {
|
120
|
+
'page[number]' => page,
|
121
|
+
'page[size]' => 30,
|
122
|
+
'include' => include.join(',')
|
123
|
+
}
|
124
|
+
).call
|
125
|
+
end
|
126
|
+
|
127
|
+
def locations(page: 1, include: [])
|
128
|
+
Teamtailor::Request.new(
|
129
|
+
base_url: base_url,
|
130
|
+
api_token: api_token,
|
131
|
+
api_version: api_version,
|
132
|
+
path: '/v1/locations',
|
133
|
+
params: {
|
134
|
+
'page[number]' => page,
|
135
|
+
'page[size]' => 30,
|
136
|
+
'include' => include.join(',')
|
137
|
+
}
|
138
|
+
).call
|
139
|
+
end
|
140
|
+
|
141
|
+
def custom_fields(page: 1, include: [])
|
142
|
+
Teamtailor::Request.new(
|
143
|
+
base_url: base_url,
|
144
|
+
api_token: api_token,
|
145
|
+
api_version: api_version,
|
146
|
+
path: '/v1/custom-fields',
|
147
|
+
params: {
|
148
|
+
'page[number]' => page,
|
149
|
+
'page[size]' => 30,
|
150
|
+
'include' => include.join(',')
|
151
|
+
}
|
152
|
+
).call
|
153
|
+
end
|
154
|
+
|
155
|
+
def custom_field_values(page: 1, include: [])
|
156
|
+
Teamtailor::Request.new(
|
157
|
+
base_url: base_url,
|
158
|
+
api_token: api_token,
|
159
|
+
api_version: api_version,
|
160
|
+
path: '/v1/custom-field-values',
|
161
|
+
params: {
|
162
|
+
'page[number]' => page,
|
163
|
+
'page[size]' => 30,
|
164
|
+
'include' => include.join(',')
|
165
|
+
}
|
166
|
+
).call
|
167
|
+
end
|
168
|
+
|
169
|
+
def referrals(page: 1, include: [])
|
170
|
+
Teamtailor::Request.new(
|
171
|
+
base_url: base_url,
|
172
|
+
api_token: api_token,
|
173
|
+
api_version: api_version,
|
174
|
+
path: '/v1/referrals',
|
175
|
+
params: {
|
176
|
+
'page[number]' => page,
|
177
|
+
'page[size]' => 30,
|
178
|
+
'include' => include.join(',')
|
179
|
+
}
|
180
|
+
).call
|
181
|
+
end
|
182
|
+
|
183
|
+
def partner_results(page: 1, include: [])
|
184
|
+
Teamtailor::Request.new(
|
185
|
+
base_url: base_url,
|
186
|
+
api_token: api_token,
|
187
|
+
api_version: api_version,
|
188
|
+
path: '/v1/partner-results',
|
189
|
+
params: {
|
190
|
+
'page[number]' => page,
|
191
|
+
'page[size]' => 30,
|
192
|
+
'include' => include.join(',')
|
193
|
+
}
|
194
|
+
).call
|
195
|
+
end
|
196
|
+
|
197
|
+
def requisitions(page: 1, include: [])
|
198
|
+
Teamtailor::Request.new(
|
199
|
+
base_url: base_url,
|
200
|
+
api_token: api_token,
|
201
|
+
api_version: api_version,
|
202
|
+
path: '/v1/requisitions',
|
203
|
+
params: {
|
204
|
+
'page[number]' => page,
|
205
|
+
'page[size]' => 30,
|
206
|
+
'include' => include.join(',')
|
207
|
+
}
|
208
|
+
).call
|
209
|
+
end
|
210
|
+
|
69
211
|
private
|
70
212
|
|
71
213
|
attr_reader :base_url, :api_token, :api_version
|
data/lib/teamtailor/parser.rb
CHANGED
@@ -1,10 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'teamtailor/relationship'
|
4
3
|
require 'teamtailor/parser/candidate'
|
5
4
|
require 'teamtailor/parser/job'
|
6
5
|
require 'teamtailor/parser/user'
|
7
6
|
require 'teamtailor/parser/job_application'
|
7
|
+
require 'teamtailor/parser/company'
|
8
|
+
require 'teamtailor/parser/stage'
|
9
|
+
require 'teamtailor/parser/reject_reason'
|
10
|
+
require 'teamtailor/parser/department'
|
11
|
+
require 'teamtailor/parser/location'
|
12
|
+
require 'teamtailor/parser/custom_field'
|
13
|
+
require 'teamtailor/parser/custom_field_value'
|
14
|
+
require 'teamtailor/parser/referral'
|
15
|
+
require 'teamtailor/parser/partner_result'
|
16
|
+
require 'teamtailor/parser/requisition'
|
17
|
+
require 'teamtailor/parser/requisition_step_verdict'
|
8
18
|
|
9
19
|
module Teamtailor
|
10
20
|
class Parser
|
@@ -19,6 +29,17 @@ module Teamtailor
|
|
19
29
|
when 'jobs' then Teamtailor::Job.new(record, included)
|
20
30
|
when 'users' then Teamtailor::User.new(record, included)
|
21
31
|
when 'job-applications' then Teamtailor::JobApplication.new(record, included)
|
32
|
+
when 'companies' then Teamtailor::Company.new(record, included)
|
33
|
+
when 'stages' then Teamtailor::Stage.new(record, included)
|
34
|
+
when 'reject-reasons' then Teamtailor::RejectReason.new(record, included)
|
35
|
+
when 'departments' then Teamtailor::Department.new(record, included)
|
36
|
+
when 'locations' then Teamtailor::Location.new(record, included)
|
37
|
+
when 'custom-fields' then Teamtailor::CustomField.new(record, included)
|
38
|
+
when 'custom-field-values' then Teamtailor::CustomFieldValue.new(record, included)
|
39
|
+
when 'referrals' then Teamtailor::Referral.new(record, included)
|
40
|
+
when 'partner-results' then Teamtailor::PartnerResult.new(record, included)
|
41
|
+
when 'requisitions' then Teamtailor::Requisition.new(record, included)
|
42
|
+
when 'requisition-step-verdicts' then Teamtailor::RequisitionStepVerdict.new(record, included)
|
22
43
|
|
23
44
|
else
|
24
45
|
raise Teamtailor::UnknownResponseTypeError, record&.dig('type')
|
data/lib/teamtailor/record.rb
CHANGED
@@ -9,27 +9,29 @@ module Teamtailor
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def loaded?
|
12
|
-
!
|
12
|
+
!record_ids.empty?
|
13
13
|
end
|
14
14
|
|
15
|
-
def
|
15
|
+
def records
|
16
16
|
raise Teamtailor::UnloadedRelationError unless loaded?
|
17
17
|
|
18
|
-
record_json = included.
|
19
|
-
k['id']
|
18
|
+
record_json = included.select do |k|
|
19
|
+
record_ids.include?(k['id']) && k['type'] == record_type
|
20
20
|
end
|
21
21
|
|
22
|
-
Teamtailor::Parser.parse({ 'data' => record_json })
|
22
|
+
Teamtailor::Parser.parse({ 'data' => record_json, 'included' => included })
|
23
23
|
end
|
24
24
|
|
25
25
|
private
|
26
26
|
|
27
|
-
def
|
28
|
-
relationships&.dig(relation_name, 'data'
|
27
|
+
def record_ids
|
28
|
+
data = [relationships&.dig(relation_name, 'data')].flatten.compact
|
29
|
+
data.map { |row| row['id'] }
|
29
30
|
end
|
30
31
|
|
31
32
|
def record_type
|
32
|
-
relationships&.dig(relation_name, 'data'
|
33
|
+
data = [relationships&.dig(relation_name, 'data')].flatten
|
34
|
+
data.map { |row| row['type'] }.first
|
33
35
|
end
|
34
36
|
|
35
37
|
attr_reader :relation_name, :relationships, :included
|
data/lib/teamtailor/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teamtailor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- André Ligné
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -62,8 +62,19 @@ files:
|
|
62
62
|
- lib/teamtailor/page_result.rb
|
63
63
|
- lib/teamtailor/parser.rb
|
64
64
|
- lib/teamtailor/parser/candidate.rb
|
65
|
+
- lib/teamtailor/parser/company.rb
|
66
|
+
- lib/teamtailor/parser/custom_field.rb
|
67
|
+
- lib/teamtailor/parser/custom_field_value.rb
|
68
|
+
- lib/teamtailor/parser/department.rb
|
65
69
|
- lib/teamtailor/parser/job.rb
|
66
70
|
- lib/teamtailor/parser/job_application.rb
|
71
|
+
- lib/teamtailor/parser/location.rb
|
72
|
+
- lib/teamtailor/parser/partner_result.rb
|
73
|
+
- lib/teamtailor/parser/referral.rb
|
74
|
+
- lib/teamtailor/parser/reject_reason.rb
|
75
|
+
- lib/teamtailor/parser/requisition.rb
|
76
|
+
- lib/teamtailor/parser/requisition_step_verdict.rb
|
77
|
+
- lib/teamtailor/parser/stage.rb
|
67
78
|
- lib/teamtailor/parser/user.rb
|
68
79
|
- lib/teamtailor/record.rb
|
69
80
|
- lib/teamtailor/relationship.rb
|