teamtailor 0.2.6 → 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: 74c5cb659e84f93b8c47e5091af20aa1c0bdd38a7a094c49cf6772a25d247239
4
- data.tar.gz: 2edf3529493889a37d13650b535aae07a4cfbafd8f22b4e457855920dc81d7a2
3
+ metadata.gz: 2149b16c38eaf624c87c2f06eec2acea93d0cd3e92d6b7a6322f43809c20816f
4
+ data.tar.gz: 1250d366f8bb782a3909a10768219d938d411d6ede3222153ab9873cd3c6167f
5
5
  SHA512:
6
- metadata.gz: 664c269e510d5ba10594131659c7addc82bbdb77adfca161435d1e697ecfb1ebcf04da8dc148ac48e7e1a67d995d9cbd929d061cac84108996b81b43c0a9e273
7
- data.tar.gz: 225c215f00aac545b2c9f815a14e6b2f9f0a0442b51d178aa6b47f27c895f5a9fecbde09aae55ca232474bee8971fac946659b60b71f0547d70bb608ae6c75ce
6
+ metadata.gz: 2f0da415942f37cc09fd8f8ea914ca78001305be8c3b9de66b9a2a215a12a489f13e0f13133661129042603d8c055428e2062b1dcabad230b7ed84be2125b937
7
+ data.tar.gz: 323f5bdd970d9bf602d87fd8822cb1c99141b0d0ae7ad9a903e639c09a078d6b03748f975ec717228818ca0728d440bd81f9104bb3676005e5859a397eb522d8
@@ -1,5 +1,12 @@
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
+
3
10
  ## v0.2.6 - 2020-05-18
4
11
 
5
12
  - Add `Teamtailor::PartnerResult` and `Client#partner_results`
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- teamtailor (0.2.6)
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.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)
@@ -194,6 +194,20 @@ module Teamtailor
194
194
  ).call
195
195
  end
196
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
+
197
211
  private
198
212
 
199
213
  attr_reader :base_url, :api_token, :api_version
@@ -13,6 +13,8 @@ require 'teamtailor/parser/custom_field'
13
13
  require 'teamtailor/parser/custom_field_value'
14
14
  require 'teamtailor/parser/referral'
15
15
  require 'teamtailor/parser/partner_result'
16
+ require 'teamtailor/parser/requisition'
17
+ require 'teamtailor/parser/requisition_step_verdict'
16
18
 
17
19
  module Teamtailor
18
20
  class Parser
@@ -36,6 +38,8 @@ module Teamtailor
36
38
  when 'custom-field-values' then Teamtailor::CustomFieldValue.new(record, included)
37
39
  when 'referrals' then Teamtailor::Referral.new(record, included)
38
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)
39
43
 
40
44
  else
41
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 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
@@ -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.6'
4
+ VERSION = '0.3.0'
5
5
  end
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.6
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-05-18 00:00:00.000000000 Z
11
+ date: 2020-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -72,6 +72,8 @@ files:
72
72
  - lib/teamtailor/parser/partner_result.rb
73
73
  - lib/teamtailor/parser/referral.rb
74
74
  - lib/teamtailor/parser/reject_reason.rb
75
+ - lib/teamtailor/parser/requisition.rb
76
+ - lib/teamtailor/parser/requisition_step_verdict.rb
75
77
  - lib/teamtailor/parser/stage.rb
76
78
  - lib/teamtailor/parser/user.rb
77
79
  - lib/teamtailor/record.rb
@@ -101,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
103
  - !ruby/object:Gem::Version
102
104
  version: '0'
103
105
  requirements: []
104
- rubygems_version: 3.0.3
106
+ rubygems_version: 3.1.2
105
107
  signing_key:
106
108
  specification_version: 4
107
109
  summary: Library for interacting with the Teamtailor API