smartrecruiters 0.1.0 → 0.3.0
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/.gitignore +1 -0
- data/.rubocop.yml +7 -1
- data/CHANGELOG.md +36 -0
- data/README.md +33 -3
- data/lib/smartrecruiters/client.rb +38 -2
- data/lib/smartrecruiters/collection.rb +15 -7
- data/lib/smartrecruiters/objects/callbacks_log.rb +6 -0
- data/lib/smartrecruiters/objects/department.rb +6 -0
- data/lib/smartrecruiters/objects/posting.rb +6 -0
- data/lib/smartrecruiters/objects/report_file.rb +6 -0
- data/lib/smartrecruiters/objects/webhook.rb +6 -0
- data/lib/smartrecruiters/resources/access_groups.rb +11 -1
- data/lib/smartrecruiters/resources/candidates.rb +3 -4
- data/lib/smartrecruiters/resources/interview_types.rb +1 -3
- data/lib/smartrecruiters/resources/interviews.rb +1 -3
- data/lib/smartrecruiters/resources/offers.rb +2 -2
- data/lib/smartrecruiters/resources/postings.rb +33 -0
- data/lib/smartrecruiters/resources/reports.rb +21 -3
- data/lib/smartrecruiters/resources/reviews.rb +2 -4
- data/lib/smartrecruiters/resources/users.rb +6 -9
- data/lib/smartrecruiters/resources/webhooks.rb +41 -0
- data/lib/smartrecruiters/version.rb +1 -1
- data/lib/smartrecruiters.rb +10 -4
- data/smartrecruiters.gemspec +4 -4
- metadata +15 -9
- data/Gemfile.lock +0 -68
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7c7ea65e6b64c29e219384b097e691e545b5e43c62ee2b93b1c0532b454363a
|
4
|
+
data.tar.gz: b02ebdd8957fba28c18915c8539101f7e9d508c4d1664f133e60cfc8687097f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cf79cd820e91342100b5521f9565bf83db1250d059551ed46e7f71712b8af2c5ace6515c79218971f53cb51bbfda35522806fa21d40267ba9d620a4fac719fb
|
7
|
+
data.tar.gz: 2efc9ee7e6a1e2b054b1d27a204bbd229c5c93d4ac4a169064e430df2e36223775b84bee6afe4ae6ff796d19f20e40f4982602cec1500128b9ef81779e6dac84
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,41 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.3.0](https://www.github.com/davejcameron/smartrecruiters/compare/v0.2.2...v0.3.0) (2021-10-30)
|
4
|
+
|
5
|
+
|
6
|
+
### Features
|
7
|
+
|
8
|
+
* Add support for postings ([#18](https://www.github.com/davejcameron/smartrecruiters/issues/18)) ([7204cd8](https://www.github.com/davejcameron/smartrecruiters/commit/7204cd82fc681eb737f369d7391b9639df4808a0))
|
9
|
+
|
10
|
+
### [0.2.2](https://www.github.com/davejcameron/smartrecruiters/compare/v0.2.1...v0.2.2) (2021-10-17)
|
11
|
+
|
12
|
+
|
13
|
+
### Bug Fixes
|
14
|
+
|
15
|
+
* candidate routes and add tests ([#15](https://www.github.com/davejcameron/smartrecruiters/issues/15)) ([fe33b32](https://www.github.com/davejcameron/smartrecruiters/commit/fe33b32c4a1af521191ee976751102217a48cf5d))
|
16
|
+
* reports apis and add tests ([#17](https://www.github.com/davejcameron/smartrecruiters/issues/17)) ([47bac12](https://www.github.com/davejcameron/smartrecruiters/commit/47bac1240a1a4495e883afa7e26de1312c97ddda))
|
17
|
+
|
18
|
+
### [0.2.1](https://www.github.com/davejcameron/smartrecruiters/compare/v0.2.0...v0.2.1) (2021-10-13)
|
19
|
+
|
20
|
+
|
21
|
+
### Bug Fixes
|
22
|
+
|
23
|
+
* interview types and tests ([4cf4a84](https://www.github.com/davejcameron/smartrecruiters/commit/4cf4a848c2640d1a109938d3b720351a5dce0e2f))
|
24
|
+
* interviews api and add tests ([#14](https://www.github.com/davejcameron/smartrecruiters/issues/14)) ([f710a42](https://www.github.com/davejcameron/smartrecruiters/commit/f710a4289d692977b78bf2c21b1e07c829461739))
|
25
|
+
* Offers routes and add tests ([d6f32c8](https://www.github.com/davejcameron/smartrecruiters/commit/d6f32c8f2e865d5d129f72723c61571ba02d37cc))
|
26
|
+
* Reviews and add tests ([#13](https://www.github.com/davejcameron/smartrecruiters/issues/13)) ([70a6305](https://www.github.com/davejcameron/smartrecruiters/commit/70a63058ad41891b482359a7c7ba4b2bf587e1a0))
|
27
|
+
* Users api routes and add tests ([#12](https://www.github.com/davejcameron/smartrecruiters/issues/12)) ([4bd0b8a](https://www.github.com/davejcameron/smartrecruiters/commit/4bd0b8a627af542feade4f694f00eebd43ac08aa))
|
28
|
+
|
29
|
+
## [0.2.0](https://www.github.com/davejcameron/smartrecruiters/compare/v0.1.0...v0.2.0) (2021-10-13)
|
30
|
+
|
31
|
+
|
32
|
+
### Features
|
33
|
+
|
34
|
+
* Add access groups routes ([#7](https://www.github.com/davejcameron/smartrecruiters/issues/7)) ([81d6a34](https://www.github.com/davejcameron/smartrecruiters/commit/81d6a34e4466309f493f65aeeab6173d610b8dfb))
|
35
|
+
* add reports apis ([#5](https://www.github.com/davejcameron/smartrecruiters/issues/5)) ([343814b](https://www.github.com/davejcameron/smartrecruiters/commit/343814b8d1fd0d14c062030b958d67b307204c69))
|
36
|
+
* Add timeout and retry ([2d0d8f2](https://www.github.com/davejcameron/smartrecruiters/commit/2d0d8f23c57d522ea657e32b06b3da40a1822930))
|
37
|
+
* Add webhooks routes ([#6](https://www.github.com/davejcameron/smartrecruiters/issues/6)) ([b37bcda](https://www.github.com/davejcameron/smartrecruiters/commit/b37bcda13d43f96bf6ac4fac285dd87200b3a877))
|
38
|
+
|
3
39
|
## 0.1.0 (2021-10-09)
|
4
40
|
|
5
41
|
|
data/README.md
CHANGED
@@ -37,7 +37,9 @@ client = SmartRecruiters::Client.new(api_key: ENV["SMARTRECRUITERS_API_KEY"], en
|
|
37
37
|
### Access Groups
|
38
38
|
|
39
39
|
```ruby
|
40
|
-
client.access_groups
|
40
|
+
client.access_groups.list
|
41
|
+
client.access_groups.assign_users(group_id: "id", user_ids: ["user_id"])
|
42
|
+
client.access_groups.remove_user(group_id: "id", user_id: "id")
|
41
43
|
```
|
42
44
|
|
43
45
|
### Candidates
|
@@ -84,15 +86,30 @@ client.jobs.list_hiring_team(job_id: "id")
|
|
84
86
|
|
85
87
|
```ruby
|
86
88
|
client.offers.list
|
87
|
-
client.offers.
|
89
|
+
client.offers.retrieve(offer_id: "id", candidate_id: "id", job_id: "id")
|
88
90
|
client.offers.retrieve_offers(candidate_id: "id", job_id: "id")
|
89
91
|
```
|
90
92
|
|
93
|
+
### Postings
|
94
|
+
|
95
|
+
```ruby
|
96
|
+
client.postings.list(company_id:)
|
97
|
+
client.postings.list_departments(company_id:)
|
98
|
+
client.postings.retrieve(company_id:, posting_id:)
|
99
|
+
client.postings.create_candidate(posting_id:, {})
|
100
|
+
client.postings.retrieve_candidate_status(posting_id:, candidate_id:)
|
101
|
+
client.postings.retrieve_configuration(posting_id:)
|
102
|
+
```
|
103
|
+
|
91
104
|
### Reports
|
92
105
|
|
93
106
|
```ruby
|
94
107
|
client.reports.list
|
95
108
|
client.reports.retrieve(report_id: "id")
|
109
|
+
client.reports.retrieve_files(report_id: "id")
|
110
|
+
client.reports.generate_report(report_id: "id")
|
111
|
+
client.reports.retrieve_recent_file(report_id: "id")
|
112
|
+
client.reports.retrieve_recent_file_data(report_id: "id")
|
96
113
|
```
|
97
114
|
|
98
115
|
### Reviews
|
@@ -117,12 +134,25 @@ client.system_roles.list
|
|
117
134
|
client.users.list
|
118
135
|
client.users.create({})
|
119
136
|
client.users.retrieve(user_id: "id")
|
120
|
-
client.users.update(user_id: "id",
|
137
|
+
client.users.update(user_id: "id", changes: ['changes'])
|
121
138
|
client.users.activate(user_id: "id")
|
122
139
|
client.users.activation_email(user_id: "id")
|
123
140
|
client.users.deactivate(user_id: "id")
|
124
141
|
```
|
125
142
|
|
143
|
+
### Webhooks
|
144
|
+
|
145
|
+
```ruby
|
146
|
+
client.webhooks.list
|
147
|
+
client.webhooks.create({})
|
148
|
+
client.webhooks.retrieve(webhook_id: "id")
|
149
|
+
client.webhooks.delete(webhook_id: "id")
|
150
|
+
client.webhooks.activate(webhook_id: "id")
|
151
|
+
client.webhooks.callbacks_log(webhook_id: "id")
|
152
|
+
client.webhooks.generate_secret(webhook_id: "id")
|
153
|
+
client.webhooks.retrieve_secret(webhook_id: "id")
|
154
|
+
```
|
155
|
+
|
126
156
|
## Development
|
127
157
|
|
128
158
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -2,9 +2,13 @@
|
|
2
2
|
|
3
3
|
require 'faraday'
|
4
4
|
require 'faraday_middleware'
|
5
|
+
require 'json'
|
5
6
|
|
6
7
|
module SmartRecruiters
|
7
8
|
class Client
|
9
|
+
SMART_RECRUITERS_TIMEOUT = 128
|
10
|
+
SMART_RECRUITERS_RETRIES = 3
|
11
|
+
|
8
12
|
SMART_RECRUITERS_BASE_PATHS = {
|
9
13
|
'production' => 'https://api.smartrecruiters.com',
|
10
14
|
'sandbox' => 'https://api.sandbox.smartrecruiters.com'
|
@@ -12,11 +16,16 @@ module SmartRecruiters
|
|
12
16
|
|
13
17
|
attr_reader :api_key, :adapter
|
14
18
|
|
15
|
-
def initialize(
|
19
|
+
def initialize(
|
20
|
+
api_key:,
|
21
|
+
adapter: Faraday.default_adapter,
|
22
|
+
stubs: nil,
|
23
|
+
environment: 'production'
|
24
|
+
)
|
16
25
|
@api_key = api_key
|
17
|
-
@adapter = adapter
|
18
26
|
@environment = environment
|
19
27
|
|
28
|
+
@adapter = adapter
|
20
29
|
@stubs = stubs
|
21
30
|
end
|
22
31
|
|
@@ -28,6 +37,10 @@ module SmartRecruiters
|
|
28
37
|
CandidatesResource.new(self)
|
29
38
|
end
|
30
39
|
|
40
|
+
def interview_types
|
41
|
+
InterviewTypesResource.new(self)
|
42
|
+
end
|
43
|
+
|
31
44
|
def interviews
|
32
45
|
InterviewsResource.new(self)
|
33
46
|
end
|
@@ -36,6 +49,14 @@ module SmartRecruiters
|
|
36
49
|
JobsResource.new(self)
|
37
50
|
end
|
38
51
|
|
52
|
+
def offers
|
53
|
+
OffersResource.new(self)
|
54
|
+
end
|
55
|
+
|
56
|
+
def postings
|
57
|
+
PostingsResource.new(self)
|
58
|
+
end
|
59
|
+
|
39
60
|
def reports
|
40
61
|
ReportsResource.new(self)
|
41
62
|
end
|
@@ -52,16 +73,31 @@ module SmartRecruiters
|
|
52
73
|
UsersResource.new(self)
|
53
74
|
end
|
54
75
|
|
76
|
+
def webhooks
|
77
|
+
WebhooksResource.new(self)
|
78
|
+
end
|
79
|
+
|
55
80
|
def connection
|
56
81
|
@connection ||= Faraday.new do |conn|
|
57
82
|
conn.url_prefix = SMART_RECRUITERS_BASE_PATHS[@environment]
|
58
83
|
conn.headers['X-SmartToken'] = api_key
|
59
84
|
conn.request :json
|
85
|
+
conn.request :retry, retry_options
|
60
86
|
|
61
87
|
conn.response :json, content_type: 'application/json'
|
62
88
|
|
89
|
+
conn.options.timeout = SMART_RECRUITERS_TIMEOUT
|
63
90
|
conn.adapter adapter, @stubs
|
64
91
|
end
|
65
92
|
end
|
93
|
+
|
94
|
+
private
|
95
|
+
|
96
|
+
def retry_options
|
97
|
+
{
|
98
|
+
max: SMART_RECRUITERS_RETRIES,
|
99
|
+
retry_statuses: [429]
|
100
|
+
}
|
101
|
+
end
|
66
102
|
end
|
67
103
|
end
|
@@ -6,13 +6,21 @@ module SmartRecruiters
|
|
6
6
|
|
7
7
|
def self.from_response(response, type:)
|
8
8
|
body = response.body
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
9
|
+
|
10
|
+
if body.is_a?(Array)
|
11
|
+
new(
|
12
|
+
content: body.map { |attrs| type.new(attrs) },
|
13
|
+
limit: nil, offset: nil, next_page_id: nil, total_found: nil
|
14
|
+
)
|
15
|
+
else
|
16
|
+
new(
|
17
|
+
content: body['content'].map { |attrs| type.new(attrs) },
|
18
|
+
limit: body['limit'],
|
19
|
+
offset: body['offset'],
|
20
|
+
next_page_id: body['nextPageId'],
|
21
|
+
total_found: body['totalFound']
|
22
|
+
)
|
23
|
+
end
|
16
24
|
end
|
17
25
|
|
18
26
|
def initialize(content:, limit:, offset:, next_page_id:, total_found:)
|
@@ -2,8 +2,18 @@
|
|
2
2
|
|
3
3
|
module SmartRecruiters
|
4
4
|
class AccessGroupsResource < Resource
|
5
|
+
ACCESS_GROUP_API = 'user-api/v201804/access-groups'
|
6
|
+
|
5
7
|
def list
|
6
|
-
Collection.from_response get_request(
|
8
|
+
Collection.from_response get_request(ACCESS_GROUP_API.to_s), type: AccessGroup
|
9
|
+
end
|
10
|
+
|
11
|
+
def assign_users(group_id:, user_ids:)
|
12
|
+
Collection.from_response post_request("#{ACCESS_GROUP_API}/#{group_id}/users", body: user_ids), type: User
|
13
|
+
end
|
14
|
+
|
15
|
+
def remove_user(group_id:, user_id:)
|
16
|
+
delete_request("#{ACCESS_GROUP_API}/#{group_id}/users/#{user_id}")
|
7
17
|
end
|
8
18
|
end
|
9
19
|
end
|
@@ -21,7 +21,6 @@ module SmartRecruiters
|
|
21
21
|
|
22
22
|
def delete(candidate_id:)
|
23
23
|
delete_request("candidates/#{candidate_id}")
|
24
|
-
true
|
25
24
|
end
|
26
25
|
|
27
26
|
def retrieve_consent(candidate_id:)
|
@@ -29,8 +28,7 @@ module SmartRecruiters
|
|
29
28
|
end
|
30
29
|
|
31
30
|
def retrieve_consents(candidate_id:)
|
32
|
-
|
33
|
-
Collection.from_response(response, type: Object.new)
|
31
|
+
Object.new get_request("candidates/#{candidate_id}/consents").body
|
34
32
|
end
|
35
33
|
|
36
34
|
def retrieve_application(candidate_id:, job_id:)
|
@@ -43,7 +41,8 @@ module SmartRecruiters
|
|
43
41
|
end
|
44
42
|
|
45
43
|
def retrieve_status_history(candidate_id:, job_id:)
|
46
|
-
|
44
|
+
response = get_request("candidates/#{candidate_id}/jobs/#{job_id}/status/history")
|
45
|
+
Collection.from_response(response, type: Object)
|
47
46
|
end
|
48
47
|
end
|
49
48
|
end
|
@@ -3,17 +3,15 @@
|
|
3
3
|
module SmartRecruiters
|
4
4
|
class InterviewTypesResource < Resource
|
5
5
|
def list
|
6
|
-
|
6
|
+
get_request('interview-types').body
|
7
7
|
end
|
8
8
|
|
9
9
|
def create(interview_types:)
|
10
10
|
patch_request('interview-types', body: interview_types)
|
11
|
-
true
|
12
11
|
end
|
13
12
|
|
14
13
|
def delete(interview_type:)
|
15
14
|
delete_request("interview-types/#{interview_type}")
|
16
|
-
true
|
17
15
|
end
|
18
16
|
end
|
19
17
|
end
|
@@ -13,13 +13,11 @@ module SmartRecruiters
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def update(interview_id:, **attributes)
|
16
|
-
|
17
|
-
true
|
16
|
+
patch_request("#{INTERVIEWS_API}/interviews/#{interview_id}", body: attributes)
|
18
17
|
end
|
19
18
|
|
20
19
|
def delete(interview_id:)
|
21
20
|
delete_request("#{INTERVIEWS_API}/interviews/#{interview_id}")
|
22
|
-
true
|
23
21
|
end
|
24
22
|
end
|
25
23
|
end
|
@@ -12,8 +12,8 @@ module SmartRecruiters
|
|
12
12
|
Collection.from_response(response, type: Offer)
|
13
13
|
end
|
14
14
|
|
15
|
-
def
|
16
|
-
Offer.new get_request("candidates/#{candidate_id}/jobs/#{job_id}/offers/#{offer_id}")
|
15
|
+
def retrieve(offer_id:, candidate_id:, job_id:)
|
16
|
+
Offer.new get_request("candidates/#{candidate_id}/jobs/#{job_id}/offers/#{offer_id}").body
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SmartRecruiters
|
4
|
+
class PostingsResource < Resource
|
5
|
+
COMPANY_API = 'v1/companies'
|
6
|
+
|
7
|
+
def list(company_id:, **params)
|
8
|
+
response = get_request("#{COMPANY_API}/#{company_id}/postings", params: params)
|
9
|
+
Collection.from_response(response, type: Posting)
|
10
|
+
end
|
11
|
+
|
12
|
+
def list_departments(company_id:, **params)
|
13
|
+
response = get_request("#{COMPANY_API}/#{company_id}/departments", params: params)
|
14
|
+
Collection.from_response(response, type: Department)
|
15
|
+
end
|
16
|
+
|
17
|
+
def retrieve_posting(company_id:, posting_id:, **params)
|
18
|
+
Posting.new get_request("#{COMPANY_API}/#{company_id}/postings/#{posting_id}", params: params).body
|
19
|
+
end
|
20
|
+
|
21
|
+
def create_candidate(posting_id:, **attributes)
|
22
|
+
Object.new post_request("postings/#{posting_id}/candidates", body: attributes).body
|
23
|
+
end
|
24
|
+
|
25
|
+
def retrieve_candidate_status(posting_id:, candidate_id:)
|
26
|
+
Object.new get_request("postings/#{posting_id}/candidates/#{candidate_id}/status").body
|
27
|
+
end
|
28
|
+
|
29
|
+
def retrieve_configuration(posting_id:)
|
30
|
+
Object.new get_request("postings/#{posting_id}/configuration").body
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -2,14 +2,32 @@
|
|
2
2
|
|
3
3
|
module SmartRecruiters
|
4
4
|
class ReportsResource < Resource
|
5
|
-
REPORT_API = 'reporting-api/v201804'
|
5
|
+
REPORT_API = 'reporting-api/v201804/reports'
|
6
6
|
def list(**params)
|
7
|
-
response = get_request(
|
7
|
+
response = get_request(REPORT_API.to_s, params: params)
|
8
8
|
Collection.from_response(response, type: Report)
|
9
9
|
end
|
10
10
|
|
11
11
|
def retrieve(report_id:)
|
12
|
-
Report.new get_request("#{REPORT_API}
|
12
|
+
Report.new get_request("#{REPORT_API}/#{report_id}").body
|
13
|
+
end
|
14
|
+
|
15
|
+
def retrieve_files(report_id:)
|
16
|
+
response = get_request("#{REPORT_API}/#{report_id}/files")
|
17
|
+
Collection.from_response(response, type: ReportFile)
|
18
|
+
end
|
19
|
+
|
20
|
+
def generate_report(report_id:)
|
21
|
+
Report.new post_request("#{REPORT_API}/#{report_id}/files", body: {}).body
|
22
|
+
end
|
23
|
+
|
24
|
+
def retrieve_recent_file(report_id:)
|
25
|
+
ReportFile.new get_request("#{REPORT_API}/#{report_id}/files/recent").body
|
26
|
+
end
|
27
|
+
|
28
|
+
def retrieve_recent_file_data(report_id:)
|
29
|
+
response = get_request("#{REPORT_API}/#{report_id}/files/recent/data").body
|
30
|
+
Object.new JSON.parse(response)
|
13
31
|
end
|
14
32
|
end
|
15
33
|
end
|
@@ -4,7 +4,7 @@ module SmartRecruiters
|
|
4
4
|
class ReviewsResource < Resource
|
5
5
|
def list(candidate_id:, job_id:)
|
6
6
|
params = { candidateId: candidate_id, jobId: job_id }
|
7
|
-
Collection.from_response get_request('reviews', params), type: Review
|
7
|
+
Collection.from_response get_request('reviews', params: params), type: Review
|
8
8
|
end
|
9
9
|
|
10
10
|
def create(**attributes)
|
@@ -12,17 +12,15 @@ module SmartRecruiters
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def retrieve(review_id:)
|
15
|
-
Review.new get_request("reviews/#{review_id}")
|
15
|
+
Review.new get_request("reviews/#{review_id}").body
|
16
16
|
end
|
17
17
|
|
18
18
|
def update(review_id:, **attributes)
|
19
19
|
patch_request("reviews/#{review_id}", body: attributes)
|
20
|
-
true
|
21
20
|
end
|
22
21
|
|
23
22
|
def delete(review_id:, reviewer_id:)
|
24
23
|
delete_request("reviews/#{review_id}", params: { reviewerId: reviewer_id })
|
25
|
-
true
|
26
24
|
end
|
27
25
|
end
|
28
26
|
end
|
@@ -16,23 +16,20 @@ module SmartRecruiters
|
|
16
16
|
User.new get_request("#{USER_API}/users/#{user_id}").body
|
17
17
|
end
|
18
18
|
|
19
|
-
def update(user_id:,
|
20
|
-
User.new patch_request("#{USER_API}/users/#{user_id}", body:
|
19
|
+
def update(user_id:, changes:)
|
20
|
+
User.new patch_request("#{USER_API}/users/#{user_id}", body: changes).body
|
21
21
|
end
|
22
22
|
|
23
|
-
def activate(user_id
|
24
|
-
put_request("#{USER_API}/users/#{user_id}/activation")
|
25
|
-
true
|
23
|
+
def activate(user_id:, **attributes)
|
24
|
+
put_request("#{USER_API}/users/#{user_id}/activation", body: attributes)
|
26
25
|
end
|
27
26
|
|
28
|
-
def activation_email(user_id
|
29
|
-
post_request("#{USER_API}/users/#{user_id}/activation-email")
|
30
|
-
true
|
27
|
+
def activation_email(user_id:, **attributes)
|
28
|
+
post_request("#{USER_API}/users/#{user_id}/activation-email", body: attributes)
|
31
29
|
end
|
32
30
|
|
33
31
|
def deactivate(user_id:)
|
34
32
|
delete_request("#{USER_API}/users/#{user_id}/activation")
|
35
|
-
true
|
36
33
|
end
|
37
34
|
end
|
38
35
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SmartRecruiters
|
4
|
+
class WebhooksResource < Resource
|
5
|
+
WEBHOOK_API = 'webhooks-api/v201907'
|
6
|
+
|
7
|
+
def list(**params)
|
8
|
+
response = get_request("#{WEBHOOK_API}/subscriptions", params: params)
|
9
|
+
Collection.from_response(response, type: Webhook)
|
10
|
+
end
|
11
|
+
|
12
|
+
def create(**attributes)
|
13
|
+
Webhook.new post_request("#{WEBHOOK_API}/subscriptions", body: attributes).body
|
14
|
+
end
|
15
|
+
|
16
|
+
def retrieve(webhook_id:)
|
17
|
+
Webhook.new get_request("#{WEBHOOK_API}/subscriptions/#{webhook_id}").body
|
18
|
+
end
|
19
|
+
|
20
|
+
def delete(webhook_id:)
|
21
|
+
delete_request("#{WEBHOOK_API}/subscriptions/#{webhook_id}")
|
22
|
+
end
|
23
|
+
|
24
|
+
def activate(webhook_id:, **attributes)
|
25
|
+
put_request("#{WEBHOOK_API}/subscriptions/#{webhook_id}/activation", body: attributes)
|
26
|
+
end
|
27
|
+
|
28
|
+
def callbacks_log(webhook_id:, **params)
|
29
|
+
response = get_request("#{WEBHOOK_API}/subscriptions/#{webhook_id}/callbacks-log", params: params)
|
30
|
+
Collection.from_response(response, type: CallbacksLog)
|
31
|
+
end
|
32
|
+
|
33
|
+
def generate_secret(webhook_id:, **attributes)
|
34
|
+
Object.new post_request("#{WEBHOOK_API}/subscriptions/#{webhook_id}/secret-key", body: attributes).body
|
35
|
+
end
|
36
|
+
|
37
|
+
def retrieve_secret(webhook_id:)
|
38
|
+
Object.new get_request("#{WEBHOOK_API}/subscriptions/#{webhook_id}/secret-key").body
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/lib/smartrecruiters.rb
CHANGED
@@ -11,24 +11,30 @@ module SmartRecruiters
|
|
11
11
|
|
12
12
|
autoload :AccessGroup, 'smartrecruiters/objects/access_group'
|
13
13
|
autoload :Attachment, 'smartrecruiters/objects/attachment'
|
14
|
+
autoload :CallbacksLog, 'smartrecruiters/objects/callbacks_log'
|
14
15
|
autoload :Candidate, 'smartrecruiters/objects/candidate'
|
16
|
+
autoload :Department, 'smartrecruiters/objects/department'
|
15
17
|
autoload :Interview, 'smartrecruiters/objects/interview'
|
16
|
-
|
17
18
|
autoload :Job, 'smartrecruiters/objects/job'
|
18
19
|
autoload :Offer, 'smartrecruiters/objects/offer'
|
19
|
-
autoload :
|
20
|
+
autoload :Posting, 'smartrecruiters/objects/posting'
|
20
21
|
autoload :Report, 'smartrecruiters/objects/report'
|
22
|
+
autoload :ReportFile, 'smartrecruiters/objects/report_file'
|
21
23
|
autoload :Review, 'smartrecruiters/objects/review'
|
22
24
|
autoload :SystemRole, 'smartrecruiters/objects/system_role'
|
25
|
+
autoload :User, 'smartrecruiters/objects/user'
|
26
|
+
autoload :Webhook, 'smartrecruiters/objects/webhook'
|
23
27
|
|
24
28
|
autoload :AccessGroupsResource, 'smartrecruiters/resources/access_groups'
|
25
29
|
autoload :CandidatesResource, 'smartrecruiters/resources/candidates'
|
26
30
|
autoload :InterviewsResource, 'smartrecruiters/resources/interviews'
|
27
31
|
autoload :InterviewTypesResource, 'smartrecruiters/resources/interview_types'
|
28
|
-
autoload :OffersResource, 'smartrecruiters/resources/offers'
|
29
32
|
autoload :JobsResource, 'smartrecruiters/resources/jobs'
|
30
|
-
autoload :
|
33
|
+
autoload :OffersResource, 'smartrecruiters/resources/offers'
|
34
|
+
autoload :PostingsResource, 'smartrecruiters/resources/postings'
|
31
35
|
autoload :ReportsResource, 'smartrecruiters/resources/reports'
|
32
36
|
autoload :ReviewsResource, 'smartrecruiters/resources/reviews'
|
33
37
|
autoload :SystemRolesResource, 'smartrecruiters/resources/system_roles'
|
38
|
+
autoload :UsersResource, 'smartrecruiters/resources/users'
|
39
|
+
autoload :WebhooksResource, 'smartrecruiters/resources/webhooks'
|
34
40
|
end
|
data/smartrecruiters.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.metadata['source_code_uri'] = 'https://github.com/davejcameron/smartrecruiters'
|
27
27
|
else
|
28
28
|
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
29
|
-
|
29
|
+
'public gem pushes.'
|
30
30
|
end
|
31
31
|
|
32
32
|
# Specify which files should be added to the gem when it is released.
|
@@ -38,9 +38,9 @@ Gem::Specification.new do |spec|
|
|
38
38
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
39
39
|
spec.require_paths = ['lib']
|
40
40
|
|
41
|
-
spec.add_development_dependency 'bundler', '~>
|
42
|
-
spec.add_development_dependency 'minitest', '~> 5.
|
43
|
-
spec.add_development_dependency 'rake', '~>
|
41
|
+
spec.add_development_dependency 'bundler', '~> 2.2'
|
42
|
+
spec.add_development_dependency 'minitest', '~> 5.14'
|
43
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
44
44
|
|
45
45
|
spec.add_dependency 'faraday', '~> 1.8'
|
46
46
|
spec.add_dependency 'faraday_middleware', '~> 1.1'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smartrecruiters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Cameron
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.2'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '5.
|
33
|
+
version: '5.14'
|
34
34
|
type: :development
|
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: '5.
|
40
|
+
version: '5.14'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '13.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '13.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: faraday
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,7 +94,6 @@ files:
|
|
94
94
|
- CHANGELOG.md
|
95
95
|
- CODE_OF_CONDUCT.md
|
96
96
|
- Gemfile
|
97
|
-
- Gemfile.lock
|
98
97
|
- LICENSE.txt
|
99
98
|
- README.md
|
100
99
|
- Rakefile
|
@@ -107,14 +106,19 @@ files:
|
|
107
106
|
- lib/smartrecruiters/object.rb
|
108
107
|
- lib/smartrecruiters/objects/access_group.rb
|
109
108
|
- lib/smartrecruiters/objects/attachment.rb
|
109
|
+
- lib/smartrecruiters/objects/callbacks_log.rb
|
110
110
|
- lib/smartrecruiters/objects/candidate.rb
|
111
|
+
- lib/smartrecruiters/objects/department.rb
|
111
112
|
- lib/smartrecruiters/objects/interview.rb
|
112
113
|
- lib/smartrecruiters/objects/job.rb
|
113
114
|
- lib/smartrecruiters/objects/offer.rb
|
115
|
+
- lib/smartrecruiters/objects/posting.rb
|
114
116
|
- lib/smartrecruiters/objects/report.rb
|
117
|
+
- lib/smartrecruiters/objects/report_file.rb
|
115
118
|
- lib/smartrecruiters/objects/review.rb
|
116
119
|
- lib/smartrecruiters/objects/system_role.rb
|
117
120
|
- lib/smartrecruiters/objects/user.rb
|
121
|
+
- lib/smartrecruiters/objects/webhook.rb
|
118
122
|
- lib/smartrecruiters/resource.rb
|
119
123
|
- lib/smartrecruiters/resources/access_groups.rb
|
120
124
|
- lib/smartrecruiters/resources/candidates.rb
|
@@ -122,10 +126,12 @@ files:
|
|
122
126
|
- lib/smartrecruiters/resources/interviews.rb
|
123
127
|
- lib/smartrecruiters/resources/jobs.rb
|
124
128
|
- lib/smartrecruiters/resources/offers.rb
|
129
|
+
- lib/smartrecruiters/resources/postings.rb
|
125
130
|
- lib/smartrecruiters/resources/reports.rb
|
126
131
|
- lib/smartrecruiters/resources/reviews.rb
|
127
132
|
- lib/smartrecruiters/resources/system_roles.rb
|
128
133
|
- lib/smartrecruiters/resources/users.rb
|
134
|
+
- lib/smartrecruiters/resources/webhooks.rb
|
129
135
|
- lib/smartrecruiters/version.rb
|
130
136
|
- smartrecruiters.gemspec
|
131
137
|
homepage: https://github.com/davejcameron/smartrecruiters
|
data/Gemfile.lock
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
smartrecruiters (0.1.0)
|
5
|
-
faraday (~> 1.8)
|
6
|
-
faraday_middleware (~> 1.1)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
ast (2.4.2)
|
12
|
-
faraday (1.8.0)
|
13
|
-
faraday-em_http (~> 1.0)
|
14
|
-
faraday-em_synchrony (~> 1.0)
|
15
|
-
faraday-excon (~> 1.1)
|
16
|
-
faraday-httpclient (~> 1.0.1)
|
17
|
-
faraday-net_http (~> 1.0)
|
18
|
-
faraday-net_http_persistent (~> 1.1)
|
19
|
-
faraday-patron (~> 1.0)
|
20
|
-
faraday-rack (~> 1.0)
|
21
|
-
multipart-post (>= 1.2, < 3)
|
22
|
-
ruby2_keywords (>= 0.0.4)
|
23
|
-
faraday-em_http (1.0.0)
|
24
|
-
faraday-em_synchrony (1.0.0)
|
25
|
-
faraday-excon (1.1.0)
|
26
|
-
faraday-httpclient (1.0.1)
|
27
|
-
faraday-net_http (1.0.1)
|
28
|
-
faraday-net_http_persistent (1.2.0)
|
29
|
-
faraday-patron (1.0.0)
|
30
|
-
faraday-rack (1.0.0)
|
31
|
-
faraday_middleware (1.1.0)
|
32
|
-
faraday (~> 1.0)
|
33
|
-
minitest (5.14.4)
|
34
|
-
multipart-post (2.1.1)
|
35
|
-
parallel (1.21.0)
|
36
|
-
parser (3.0.2.0)
|
37
|
-
ast (~> 2.4.1)
|
38
|
-
rainbow (3.0.0)
|
39
|
-
rake (10.5.0)
|
40
|
-
regexp_parser (2.1.1)
|
41
|
-
rexml (3.2.5)
|
42
|
-
rubocop (1.22.1)
|
43
|
-
parallel (~> 1.10)
|
44
|
-
parser (>= 3.0.0.0)
|
45
|
-
rainbow (>= 2.2.2, < 4.0)
|
46
|
-
regexp_parser (>= 1.8, < 3.0)
|
47
|
-
rexml
|
48
|
-
rubocop-ast (>= 1.12.0, < 2.0)
|
49
|
-
ruby-progressbar (~> 1.7)
|
50
|
-
unicode-display_width (>= 1.4.0, < 3.0)
|
51
|
-
rubocop-ast (1.12.0)
|
52
|
-
parser (>= 3.0.1.1)
|
53
|
-
ruby-progressbar (1.11.0)
|
54
|
-
ruby2_keywords (0.0.5)
|
55
|
-
unicode-display_width (2.1.0)
|
56
|
-
|
57
|
-
PLATFORMS
|
58
|
-
ruby
|
59
|
-
|
60
|
-
DEPENDENCIES
|
61
|
-
bundler (~> 1.17)
|
62
|
-
minitest (~> 5.0)
|
63
|
-
rake (~> 10.0)
|
64
|
-
rubocop (= 1.22.1)
|
65
|
-
smartrecruiters!
|
66
|
-
|
67
|
-
BUNDLED WITH
|
68
|
-
1.17.2
|