teamtailor 0.3.3 → 0.4.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 +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/CHANGELOG.md +5 -1
- data/Gemfile.lock +11 -11
- data/lib/teamtailor/client.rb +17 -0
- data/lib/teamtailor/error.rb +24 -8
- data/lib/teamtailor/parser/upload.rb +8 -0
- data/lib/teamtailor/parser.rb +2 -0
- data/lib/teamtailor/request.rb +1 -1
- data/lib/teamtailor/version.rb +1 -1
- data/teamtailor.gemspec +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 875df74665c08b8bf0e4635883a05948da1f081112b482a3a0131603d453e708
|
4
|
+
data.tar.gz: 6cc44d2eed9d30462bbad0869da85d17da1a1a5a275667cbe940eb376eded6f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f689da0ed44d1ea65c5d724b4025c133ce54a51e6e6f6941e06eddabaab85fcb98686522e92e745f14d72e0db2a8dff404f9ddd7af11078c9f8d6a7ed67a140e
|
7
|
+
data.tar.gz: 1a97c168e9081d1b4c565d324eced4fbb48611e6af34fba45e9d2fcaa1029788f4bac3328192d5bd87872971102968bdaa1f44a5609836b235afbf7e938820d3
|
data/.github/workflows/ruby.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,31 +1,31 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
teamtailor (0.
|
5
|
-
typhoeus (~> 1.
|
4
|
+
teamtailor (0.4.1)
|
5
|
+
typhoeus (~> 1.4.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
addressable (2.
|
10
|
+
addressable (2.8.0)
|
11
11
|
public_suffix (>= 2.0.2, < 5.0)
|
12
12
|
ast (2.4.2)
|
13
13
|
crack (0.4.3)
|
14
14
|
safe_yaml (~> 1.0.0)
|
15
15
|
diff-lcs (1.3)
|
16
16
|
docile (1.3.2)
|
17
|
-
ethon (0.
|
18
|
-
ffi (>= 1.
|
19
|
-
ffi (1.
|
17
|
+
ethon (0.16.0)
|
18
|
+
ffi (>= 1.15.0)
|
19
|
+
ffi (1.17.0)
|
20
20
|
hashdiff (1.0.1)
|
21
21
|
parallel (1.20.1)
|
22
22
|
parser (3.0.0.0)
|
23
23
|
ast (~> 2.4.1)
|
24
|
-
public_suffix (4.0.
|
24
|
+
public_suffix (4.0.7)
|
25
25
|
rainbow (3.0.0)
|
26
26
|
rake (12.3.3)
|
27
27
|
regexp_parser (2.0.3)
|
28
|
-
rexml (3.2.
|
28
|
+
rexml (3.2.5)
|
29
29
|
rspec (3.9.0)
|
30
30
|
rspec-core (~> 3.9.0)
|
31
31
|
rspec-expectations (~> 3.9.0)
|
@@ -60,8 +60,8 @@ GEM
|
|
60
60
|
simplecov (0.18.5)
|
61
61
|
docile (~> 1.1)
|
62
62
|
simplecov-html (~> 0.11)
|
63
|
-
simplecov-html (0.12.
|
64
|
-
typhoeus (1.
|
63
|
+
simplecov-html (0.12.3)
|
64
|
+
typhoeus (1.4.1)
|
65
65
|
ethon (>= 0.9.0)
|
66
66
|
unicode-display_width (2.0.0)
|
67
67
|
webmock (3.8.3)
|
@@ -83,4 +83,4 @@ DEPENDENCIES
|
|
83
83
|
webmock (~> 3.4, >= 3.4.2)
|
84
84
|
|
85
85
|
BUNDLED WITH
|
86
|
-
2.
|
86
|
+
2.2.22
|
data/lib/teamtailor/client.rb
CHANGED
@@ -83,6 +83,23 @@ module Teamtailor
|
|
83
83
|
).call
|
84
84
|
end
|
85
85
|
|
86
|
+
def create_upload(attributes:, relationships:)
|
87
|
+
Teamtailor::Request.new(
|
88
|
+
base_url: base_url,
|
89
|
+
api_token: api_token,
|
90
|
+
api_version: api_version,
|
91
|
+
path: "/v1/uploads",
|
92
|
+
method: :post,
|
93
|
+
body: {
|
94
|
+
data: {
|
95
|
+
type: "uploads",
|
96
|
+
attributes: attributes.transform_keys { |k| k.to_s.gsub("_", "-") },
|
97
|
+
relationships: relationships,
|
98
|
+
},
|
99
|
+
}
|
100
|
+
).call
|
101
|
+
end
|
102
|
+
|
86
103
|
def create_job_application(attributes:, relationships:)
|
87
104
|
Teamtailor::Request.new(
|
88
105
|
base_url: base_url,
|
data/lib/teamtailor/error.rb
CHANGED
@@ -3,25 +3,39 @@
|
|
3
3
|
module Teamtailor
|
4
4
|
class Error < StandardError
|
5
5
|
def self.from_response(body:, status:)
|
6
|
+
json_response = parse_body(body)
|
7
|
+
|
8
|
+
error_message = json_response.dig("errors", 0, "detail") || json_response.dig("errors", "detail") || "Unknown error"
|
9
|
+
|
6
10
|
case status
|
7
11
|
when 401
|
8
12
|
Teamtailor::UnauthorizedRequestError.new
|
9
13
|
when 406
|
10
|
-
|
11
|
-
Teamtailor::InvalidApiVersionError.new(
|
12
|
-
json_response.dig("errors", "detail")
|
13
|
-
)
|
14
|
+
Teamtailor::InvalidApiVersionError.new(error_message)
|
14
15
|
when 422
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
Teamtailor::UnprocessableEntityError.new(error_message)
|
17
|
+
when 400..499
|
18
|
+
ClientError.new(error_message)
|
19
|
+
when 500..599
|
20
|
+
ServerError.new(error_message)
|
21
|
+
else
|
22
|
+
UnknownResponseError.new("Unexpected error (status: #{status})")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.parse_body(body)
|
27
|
+
begin
|
28
|
+
JSON.parse(body)
|
29
|
+
rescue JSON::ParserError => e
|
30
|
+
{}
|
19
31
|
end
|
20
32
|
end
|
21
33
|
end
|
22
34
|
|
23
35
|
class ClientError < Error; end
|
24
36
|
|
37
|
+
class ServerError < Error; end
|
38
|
+
|
25
39
|
class UnauthorizedRequestError < ClientError; end
|
26
40
|
|
27
41
|
class InvalidApiVersionError < ClientError; end
|
@@ -33,4 +47,6 @@ module Teamtailor
|
|
33
47
|
class UnloadedRelationError < ClientError; end
|
34
48
|
|
35
49
|
class UnprocessableEntityError < ClientError; end
|
50
|
+
|
51
|
+
class UnknownResponseError < Error; end
|
36
52
|
end
|
data/lib/teamtailor/parser.rb
CHANGED
@@ -15,6 +15,7 @@ require "teamtailor/parser/referral"
|
|
15
15
|
require "teamtailor/parser/partner_result"
|
16
16
|
require "teamtailor/parser/requisition"
|
17
17
|
require "teamtailor/parser/requisition_step_verdict"
|
18
|
+
require "teamtailor/parser/upload"
|
18
19
|
|
19
20
|
module Teamtailor
|
20
21
|
class Parser
|
@@ -41,6 +42,7 @@ module Teamtailor
|
|
41
42
|
when "partner-results" then Teamtailor::PartnerResult.new(record, included)
|
42
43
|
when "requisitions" then Teamtailor::Requisition.new(record, included)
|
43
44
|
when "requisition-step-verdicts" then Teamtailor::RequisitionStepVerdict.new(record, included)
|
45
|
+
when "uploads" then Teamtailor::Upload.new(record, included)
|
44
46
|
|
45
47
|
else
|
46
48
|
raise Teamtailor::UnknownResponseTypeError, record&.dig("type")
|
data/lib/teamtailor/request.rb
CHANGED
@@ -46,7 +46,7 @@ module Teamtailor
|
|
46
46
|
"Authorization": "Token token=#{api_token}",
|
47
47
|
"X-Api-Version" => api_version,
|
48
48
|
"User-Agent" => "teamtailor-rb v#{Teamtailor::VERSION}",
|
49
|
-
"Content-Type" => "application/vnd.api+json
|
49
|
+
"Content-Type" => "application/vnd.api+json",
|
50
50
|
}
|
51
51
|
end
|
52
52
|
end
|
data/lib/teamtailor/version.rb
CHANGED
data/teamtailor.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.extra_rdoc_files = ["README.md"]
|
21
21
|
|
22
22
|
spec.add_development_dependency "rspec", "~> 3.2"
|
23
|
-
spec.add_dependency "typhoeus", "~> 1.
|
23
|
+
spec.add_dependency "typhoeus", "~> 1.4.0"
|
24
24
|
|
25
25
|
# Specify which files should be added to the gem when it is released.
|
26
26
|
# The `git ls-files -z` loads the files in the RubyGem that have been added
|
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.4.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:
|
11
|
+
date: 2025-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.4.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.4.0
|
41
41
|
description:
|
42
42
|
email:
|
43
43
|
- hi@andreligne.se
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- lib/teamtailor/parser/requisition.rb
|
79
79
|
- lib/teamtailor/parser/requisition_step_verdict.rb
|
80
80
|
- lib/teamtailor/parser/stage.rb
|
81
|
+
- lib/teamtailor/parser/upload.rb
|
81
82
|
- lib/teamtailor/parser/user.rb
|
82
83
|
- lib/teamtailor/record.rb
|
83
84
|
- lib/teamtailor/relationship.rb
|
@@ -106,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
107
|
- !ruby/object:Gem::Version
|
107
108
|
version: '0'
|
108
109
|
requirements: []
|
109
|
-
rubygems_version: 3.
|
110
|
+
rubygems_version: 3.5.22
|
110
111
|
signing_key:
|
111
112
|
specification_version: 4
|
112
113
|
summary: Library for interacting with the Teamtailor API
|