teamtailor 0.2.3 → 0.3.1

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: 2ea15733d89440836cd11873349b83f5036f63f5e1ea16232ec3c442548ce4a7
4
- data.tar.gz: a8793472aef8a5374f7ac1da3ad3aa9dc79a6ca77d2e12010e5d6c5d0bc6066c
3
+ metadata.gz: 9312c6ec378d1c25c5895620a19cac0a4e5ad918bcd1371ac88e127d1c5d31ec
4
+ data.tar.gz: 5b264b0ee8a3b37bf3d61f392e56deff840a005155a29a653196bff9a376e8dd
5
5
  SHA512:
6
- metadata.gz: 77f8ed12b1e1d3145a32dfd7c351f8ffa9d7b19cfd59eb2776deee136dc05e7cf0167e50e77b26b1698f6ebca9f1107ad9874c13f3b13fef93ec7d3d5f7556a6
7
- data.tar.gz: '09e87150351d60b41a898afaf14f028ab685726a50a929168868cd400636f6439ef927d92722bc07ad234e100cfb2b41e5a5129f07fcb84c18d33744ccf0140d'
6
+ metadata.gz: aa0fe0d0eba2cb7e327513a82d6d655698f612bd47dd1c8619d4c70e77e445695a2405412dba18af2554fba93b93027ce351e52664012f3597677ca251060a7c
7
+ data.tar.gz: 0c50f558b01f8221a827e52e5b3d3dc8e84904c47d1d8487bfc2f1ed71f5ef4e994a35d690ffdb2ebcc2a5d9e607552a4b5eb8db866161d35bdd68b44e7af89c
@@ -1,5 +1,34 @@
1
1
  ## Unreleased
2
2
 
3
+ ## v0.3.1 - 2020-11-13
4
+
5
+ - Update metadata in the `teamtailor.gemspec`
6
+
7
+ ## v0.3.0 - 2020-06-30
8
+
9
+ - [BREAKING] Update `Teamtailor::Relationship` to always return multiple records
10
+ - Add `Teamtailor::Requisition` and `Client#requisitions`
11
+ - Add `Teamtailor::RequisitionStepVerdict`
12
+ - Fix accessing nested relationships on `Relationship`
13
+
14
+ ## v0.2.6 - 2020-05-18
15
+
16
+ - Add `Teamtailor::PartnerResult` and `Client#partner_results`
17
+ - Add `Teamtailor::Referral` and `Client#referrals`
18
+ - Add `Teamtailor::CustomField` and `Teamtailor::CustomFieldValue`
19
+ - Add `Client#custom_fields` and `Client#custom_field_values`
20
+
21
+ ## v0.2.5 - 2020-05-15
22
+
23
+ - Add `filters:` as an argument to `Client#jobs`
24
+
25
+ ## v0.2.4 - 2020-04-07
26
+
27
+ - Add `Teamtailor::Location` and `Client#locations`
28
+ - Add `Teamtailor::Department` and `Client#departments`
29
+ - Add `Teamtailor::RejectReason` and `Client#reject_reasons`
30
+ - Add `Teamtailor::Stage` and `Client#stages` for fetching it (`2179b1`)
31
+
3
32
  ## v0.2.3 - 2020-04-06
4
33
 
5
34
  - Add `Teamtailor::Company` and `Client#company` for fetching it (`05dde0`)
@@ -8,7 +37,7 @@
8
37
 
9
38
  - Move serialization logic in the `Teamtailor::Record` base class (`9ec63a0`)
10
39
  - Fix serializing/deserializing loaded relationships for
11
- `Teamtailor::JobApplication` (`428e2d`)
40
+ `Teamtailor::JobApplication` (`428e2d`)
12
41
 
13
42
  ## v0.2.1 - 2020-03-31
14
43
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- teamtailor (0.2.3)
4
+ teamtailor (0.3.1)
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.12.2)
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.2
76
+ 2.1.4
data/README.md CHANGED
@@ -117,7 +117,7 @@ git commits and tags, and push the `.gem` file to
117
117
  ## Contributing
118
118
 
119
119
  Bug reports and pull requests are welcome on GitHub at
120
- https://github.com/bzf/teamtailor-rb.
120
+ https://github.com/teamtailor/teamtailor-rb.
121
121
 
122
122
 
123
123
  ## License
@@ -36,7 +36,11 @@ module Teamtailor
36
36
  ).call
37
37
  end
38
38
 
39
- 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
+
40
44
  Teamtailor::Request.new(
41
45
  base_url: base_url,
42
46
  api_token: api_token,
@@ -45,8 +49,8 @@ module Teamtailor
45
49
  params: {
46
50
  'page[number]' => page,
47
51
  'page[size]' => 30,
48
- 'include' => include.join(',')
49
- }
52
+ 'include' => include.join(','),
53
+ }.merge(*filter_params)
50
54
  ).call
51
55
  end
52
56
 
@@ -78,6 +82,132 @@ module Teamtailor
78
82
  ).call
79
83
  end
80
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
+
81
211
  private
82
212
 
83
213
  attr_reader :base_url, :api_token, :api_version
@@ -5,6 +5,16 @@ require 'teamtailor/parser/job'
5
5
  require 'teamtailor/parser/user'
6
6
  require 'teamtailor/parser/job_application'
7
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
@@ -20,6 +30,16 @@ module Teamtailor
20
30
  when 'users' then Teamtailor::User.new(record, included)
21
31
  when 'job-applications' then Teamtailor::JobApplication.new(record, included)
22
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)
23
43
 
24
44
  else
25
45
  raise Teamtailor::UnknownResponseTypeError, record&.dig('type')
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'teamtailor/record'
4
+
5
+ module Teamtailor
6
+ class CustomField < Record
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'teamtailor/record'
4
+
5
+ module Teamtailor
6
+ class CustomFieldValue < Record
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'teamtailor/record'
4
+
5
+ module Teamtailor
6
+ class Department < Record
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'teamtailor/record'
4
+
5
+ module Teamtailor
6
+ class Location < Record
7
+ end
8
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'teamtailor/record'
4
+
5
+ module Teamtailor
6
+ class PartnerResult < Record
7
+ def id
8
+ data.dig('id')
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'teamtailor/record'
4
+
5
+ module Teamtailor
6
+ class Referral < Record
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'teamtailor/record'
4
+
5
+ module Teamtailor
6
+ class RejectReason < Record
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'teamtailor/record'
4
+
5
+ module Teamtailor
6
+ class Requisition < Record
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'teamtailor/record'
4
+
5
+ module Teamtailor
6
+ class RequisitionStepVerdict < Record
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'teamtailor/record'
4
+
5
+ module Teamtailor
6
+ class Stage < Record
7
+ end
8
+ end
@@ -9,27 +9,29 @@ module Teamtailor
9
9
  end
10
10
 
11
11
  def loaded?
12
- !record_id.nil?
12
+ !record_ids.empty?
13
13
  end
14
14
 
15
- def record
15
+ def records
16
16
  raise Teamtailor::UnloadedRelationError unless loaded?
17
17
 
18
- record_json = included.find do |k|
19
- k['id'] == record_id && k['type'] == record_type
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 }).first
22
+ Teamtailor::Parser.parse({ 'data' => record_json, 'included' => included })
23
23
  end
24
24
 
25
25
  private
26
26
 
27
- def record_id
28
- relationships&.dig(relation_name, 'data', 'id')
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', 'type')
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Teamtailor
4
- VERSION = '0.2.3'
4
+ VERSION = '0.3.1'
5
5
  end
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.email = ['hi@andreligne.se']
10
10
 
11
11
  spec.summary = 'Library for interacting with the Teamtailor API'
12
- spec.homepage = 'https://github.com/bzf/teamtailor-gem'
12
+ spec.homepage = 'https://github.com/teamtailor/teamtailor-gem'
13
13
  spec.license = 'MIT'
14
14
  spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
15
15
 
@@ -17,6 +17,8 @@ Gem::Specification.new do |spec|
17
17
  spec.metadata['source_code_uri'] = 'https://github.com/bzf/teamtailor-rb'
18
18
  spec.metadata['changelog_uri'] = 'https://github.com/bzf/teamtailor-rb/master/CHANGELOG.md'
19
19
 
20
+ spec.extra_rdoc_files = ['README.md']
21
+
20
22
  spec.add_development_dependency 'rspec', '~> 3.2'
21
23
  spec.add_dependency 'typhoeus', '~> 1.3.1'
22
24
 
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.2.3
4
+ version: 0.3.1
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-04-06 00:00:00.000000000 Z
11
+ date: 2020-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -43,7 +43,8 @@ email:
43
43
  - hi@andreligne.se
44
44
  executables: []
45
45
  extensions: []
46
- extra_rdoc_files: []
46
+ extra_rdoc_files:
47
+ - README.md
47
48
  files:
48
49
  - ".gitignore"
49
50
  - ".rspec"
@@ -63,19 +64,29 @@ files:
63
64
  - lib/teamtailor/parser.rb
64
65
  - lib/teamtailor/parser/candidate.rb
65
66
  - lib/teamtailor/parser/company.rb
67
+ - lib/teamtailor/parser/custom_field.rb
68
+ - lib/teamtailor/parser/custom_field_value.rb
69
+ - lib/teamtailor/parser/department.rb
66
70
  - lib/teamtailor/parser/job.rb
67
71
  - lib/teamtailor/parser/job_application.rb
72
+ - lib/teamtailor/parser/location.rb
73
+ - lib/teamtailor/parser/partner_result.rb
74
+ - lib/teamtailor/parser/referral.rb
75
+ - lib/teamtailor/parser/reject_reason.rb
76
+ - lib/teamtailor/parser/requisition.rb
77
+ - lib/teamtailor/parser/requisition_step_verdict.rb
78
+ - lib/teamtailor/parser/stage.rb
68
79
  - lib/teamtailor/parser/user.rb
69
80
  - lib/teamtailor/record.rb
70
81
  - lib/teamtailor/relationship.rb
71
82
  - lib/teamtailor/request.rb
72
83
  - lib/teamtailor/version.rb
73
84
  - teamtailor.gemspec
74
- homepage: https://github.com/bzf/teamtailor-gem
85
+ homepage: https://github.com/teamtailor/teamtailor-gem
75
86
  licenses:
76
87
  - MIT
77
88
  metadata:
78
- homepage_uri: https://github.com/bzf/teamtailor-gem
89
+ homepage_uri: https://github.com/teamtailor/teamtailor-gem
79
90
  source_code_uri: https://github.com/bzf/teamtailor-rb
80
91
  changelog_uri: https://github.com/bzf/teamtailor-rb/master/CHANGELOG.md
81
92
  post_install_message: