teamtailor 0.2.0 → 0.2.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/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +35 -0
- data/lib/teamtailor/client.rb +14 -0
- data/lib/teamtailor/parser.rb +2 -0
- data/lib/teamtailor/parser/job_application.rb +19 -0
- data/lib/teamtailor/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07c8094ceb5a49683e396b20080452dd127c39a0b611d4ec0f14ccaa6e53dbda
|
4
|
+
data.tar.gz: b6776e3f2b7d1b4d2fd6080517c1c935dbbf15f9a7d296da91a30b317f7a9270
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65953f45d5f008041ffb094a0584d618952dce03308b5901dfcd620679c757e287b17c516de8e142fdcb4cb01cea15effed86f996f5f12f818e485df42a900f3
|
7
|
+
data.tar.gz: 2cb1457ea0d20a62c6dec291ce109bea9ae0910c1335508e6b831d8fe90c148e9663b3a31c9b7fbf221eb9ca186f292af3628484683cabe65179e40b3676e1be
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -65,6 +65,41 @@ irb(main):041:0> jobs.map &:title
|
|
65
65
|
=> ["EmberJS Developer", "Ruby on Rails developer"]
|
66
66
|
```
|
67
67
|
|
68
|
+
### Relationships
|
69
|
+
|
70
|
+
The API allows you to include associated data when requesting data to help
|
71
|
+
you load associations without having to make any additional requests.
|
72
|
+
To do this, you can pass what you want to include when making the request.
|
73
|
+
|
74
|
+
To fetch jobs with all associated `user`s loaded, you can call `Client#jobs`
|
75
|
+
like this:
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
irb(main):006:0> page_result = @client.jobs(page: 1, include: [:user])
|
79
|
+
irb(main):007:0> page_result.records.first.user.record.login_email
|
80
|
+
=> "admin@teamtailor.localhost"
|
81
|
+
```
|
82
|
+
|
83
|
+
If you try to access a relationship, without having included it when loading it
|
84
|
+
from the server, it'll raise a `Teamtailor::UnloadedRelationError`:
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
irb(main):010:0> page_result = @client.jobs(page: 1, include: [])
|
88
|
+
irb(main):011:0> page_result.records.first.user.record
|
89
|
+
Traceback (most recent call last):
|
90
|
+
...
|
91
|
+
1: from ~/teamtailor/lib/teamtailor/relationship.rb:16:in `record'
|
92
|
+
Teamtailor::UnloadedRelationError (Teamtailor::UnloadedRelationError)
|
93
|
+
```
|
94
|
+
|
95
|
+
To check if a relation has been loaded or not you can use the
|
96
|
+
`Relationship#loaded?` method to check before calling it:
|
97
|
+
|
98
|
+
```ruby
|
99
|
+
irb(main):012:0> page_result = @client.jobs(page: 1, include: [:user])
|
100
|
+
irb(main):013:0> page_result.records.first.user.loaded?
|
101
|
+
=> true
|
102
|
+
```
|
68
103
|
|
69
104
|
## Development
|
70
105
|
|
data/lib/teamtailor/client.rb
CHANGED
@@ -38,6 +38,20 @@ module Teamtailor
|
|
38
38
|
).call
|
39
39
|
end
|
40
40
|
|
41
|
+
def job_applications(page: 1, include: [])
|
42
|
+
Teamtailor::Request.new(
|
43
|
+
base_url: base_url,
|
44
|
+
api_token: api_token,
|
45
|
+
api_version: api_version,
|
46
|
+
path: '/v1/job-applications',
|
47
|
+
params: {
|
48
|
+
'page[number]' => page,
|
49
|
+
'page[size]' => 30,
|
50
|
+
'include' => include.join(',')
|
51
|
+
}
|
52
|
+
).call
|
53
|
+
end
|
54
|
+
|
41
55
|
def users(page: 1, include: [])
|
42
56
|
Teamtailor::Request.new(
|
43
57
|
base_url: base_url,
|
data/lib/teamtailor/parser.rb
CHANGED
@@ -4,6 +4,7 @@ require 'teamtailor/relationship'
|
|
4
4
|
require 'teamtailor/parser/candidate'
|
5
5
|
require 'teamtailor/parser/job'
|
6
6
|
require 'teamtailor/parser/user'
|
7
|
+
require 'teamtailor/parser/job_application'
|
7
8
|
|
8
9
|
module Teamtailor
|
9
10
|
class Parser
|
@@ -17,6 +18,7 @@ module Teamtailor
|
|
17
18
|
when 'candidates' then Teamtailor::Candidate.new(record, included)
|
18
19
|
when 'jobs' then Teamtailor::Job.new(record, included)
|
19
20
|
when 'users' then Teamtailor::User.new(record, included)
|
21
|
+
when 'job-applications' then Teamtailor::JobApplication.new(record, included)
|
20
22
|
|
21
23
|
else
|
22
24
|
raise Teamtailor::UnknownResponseTypeError, record&.dig('type')
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'teamtailor/record'
|
4
|
+
|
5
|
+
module Teamtailor
|
6
|
+
class JobApplication < Record
|
7
|
+
def self.deserialize(value)
|
8
|
+
new(value)
|
9
|
+
end
|
10
|
+
|
11
|
+
def serialize
|
12
|
+
data
|
13
|
+
end
|
14
|
+
|
15
|
+
def id
|
16
|
+
data.dig('id').to_i
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/teamtailor/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teamtailor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- André Ligné
|
@@ -63,6 +63,7 @@ files:
|
|
63
63
|
- lib/teamtailor/parser.rb
|
64
64
|
- lib/teamtailor/parser/candidate.rb
|
65
65
|
- lib/teamtailor/parser/job.rb
|
66
|
+
- lib/teamtailor/parser/job_application.rb
|
66
67
|
- lib/teamtailor/parser/user.rb
|
67
68
|
- lib/teamtailor/record.rb
|
68
69
|
- lib/teamtailor/relationship.rb
|