teamtailor 0.2.0 → 0.2.1

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: ca640f45eb147f4845e8f8416728ca7037d827c1e4bcb297cb7f02e15182805a
4
- data.tar.gz: 89dacf02df2d3e7030ae54a700a7f85e5394930d5e773cc586ba639d4ab176fa
3
+ metadata.gz: 07c8094ceb5a49683e396b20080452dd127c39a0b611d4ec0f14ccaa6e53dbda
4
+ data.tar.gz: b6776e3f2b7d1b4d2fd6080517c1c935dbbf15f9a7d296da91a30b317f7a9270
5
5
  SHA512:
6
- metadata.gz: ff38baf2344ed08916fc5f8e46f3a58ba19a7fceb335d8abd73ab8a155a769c36a8ee18ec9d94044ffe0e64a61d357680e5a933791743d4831e5b960e61f1070
7
- data.tar.gz: b1cf2365d600ea53d6998faef1ef9d4ac884c63f109b16d91af58b2166e6fce817f316d53c7e026179f0ff16ef14c5695b32f9982548b8464bcc1988c6cf89e3
6
+ metadata.gz: 65953f45d5f008041ffb094a0584d618952dce03308b5901dfcd620679c757e287b17c516de8e142fdcb4cb01cea15effed86f996f5f12f818e485df42a900f3
7
+ data.tar.gz: 2cb1457ea0d20a62c6dec291ce109bea9ae0910c1335508e6b831d8fe90c148e9663b3a31c9b7fbf221eb9ca186f292af3628484683cabe65179e40b3676e1be
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## Unreleased
2
2
 
3
+ ## v0.2.1 - 2020-03-31
4
+
5
+ - Add `Teamtailor::JobApplication` and `Client#job_applications` (`062fa7`)
6
+
3
7
  ## v0.2.0 - 2020-03-31
4
8
 
5
9
  - Add support for accessing relationships on records (`1218aa`)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- teamtailor (0.2.0)
4
+ teamtailor (0.2.1)
5
5
  typhoeus (~> 1.3.1)
6
6
 
7
7
  GEM
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
 
@@ -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,
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Teamtailor
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1'
5
5
  end
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.0
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