job_boardly_api 0.1.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 +7 -0
- data/.github/workflows/ruby.yml +38 -0
- data/CHANGELOG.md +6 -0
- data/CODE_OF_CONDUCT.md +10 -0
- data/LICENSE.txt +21 -0
- data/README.md +207 -0
- data/Rakefile +8 -0
- data/lib/job_boardly_api/base_client.rb +57 -0
- data/lib/job_boardly_api/client.rb +231 -0
- data/lib/job_boardly_api/headless_client.rb +70 -0
- data/lib/job_boardly_api/response.rb +37 -0
- data/lib/job_boardly_api/version.rb +5 -0
- data/lib/job_boardly_api.rb +11 -0
- data/sig/job_boardly_api.rbs +4 -0
- metadata +56 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 62bc0b8712d1e3b4cca8521c55a1d39923a0947c66f3f046d4c05834389d9ce5
|
|
4
|
+
data.tar.gz: d97e4d783e39a760897e7563fe6f7da59ee9da82651fb679e12291eba293371b
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: eeae331b2a33a05ed54b64abb9499f73b011258bec48b74fa3d16fb859c2747b7b1cdcfd9a6d1eb4bcafb347f10784e1ffa42f668fa6d2bf27a7093e21b138d3
|
|
7
|
+
data.tar.gz: e22a0310a25812d133fb2dcbf984e22de75f4c93db242e9a1ba0890a424f3d6a7658f59ec5cb4907ed35b6878c3816a0fbf570a32033cdb7a4fcd4e57750f84b
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
|
2
|
+
# They are provided by a third-party and are governed by
|
|
3
|
+
# separate terms of service, privacy policy, and support
|
|
4
|
+
# documentation.
|
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
|
7
|
+
|
|
8
|
+
name: Ruby
|
|
9
|
+
|
|
10
|
+
on:
|
|
11
|
+
push:
|
|
12
|
+
branches: [ "main" ]
|
|
13
|
+
pull_request:
|
|
14
|
+
branches: [ "main" ]
|
|
15
|
+
|
|
16
|
+
permissions:
|
|
17
|
+
contents: read
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
test:
|
|
21
|
+
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
strategy:
|
|
24
|
+
matrix:
|
|
25
|
+
ruby-version: ['2.7', '3.0']
|
|
26
|
+
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v4
|
|
29
|
+
- name: Set up Ruby
|
|
30
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
|
31
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
|
32
|
+
# uses: ruby/setup-ruby@v1
|
|
33
|
+
uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
|
|
34
|
+
with:
|
|
35
|
+
ruby-version: ${{ matrix.ruby-version }}
|
|
36
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
|
37
|
+
- name: Run tests
|
|
38
|
+
run: bundle exec rake
|
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
"job_boardly_api" follows [The Ruby Community Conduct Guideline](https://www.ruby-lang.org/en/conduct) in all "collaborative space", which is defined as community communications channels (such as mailing lists, submitted patches, commit comments, etc.):
|
|
4
|
+
|
|
5
|
+
* Participants will be tolerant of opposing views.
|
|
6
|
+
* Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks.
|
|
7
|
+
* When interpreting the words and actions of others, participants should always assume good intentions.
|
|
8
|
+
* Behaviour which can be reasonably considered harassment will not be tolerated.
|
|
9
|
+
|
|
10
|
+
If you have any concerns about behaviour within this project, please contact us at ["williamkennedyjnr@gmail.com"](mailto:"williamkennedyjnr@gmail.com").
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 William Kennedy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# JobBoardlyApi
|
|
2
|
+
|
|
3
|
+
A Ruby wrapper around the [Jobboardly](https://jobboardly.com) Management and Headless Board APIs.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
bundle add job_boardly_api
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or install it yourself as:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
gem install job_boardly_api
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
Every request returns a `JobBoardlyApi::Response` object. You can call `body` or `to_object` on it to get either the JSON hash or a Ruby object.
|
|
22
|
+
|
|
23
|
+
### Management API
|
|
24
|
+
|
|
25
|
+
You will need an API key from Jobboardly. Find it in the app under `Settings → Board → API access`.
|
|
26
|
+
|
|
27
|
+
```ruby
|
|
28
|
+
client = JobBoardlyApi::Client.new(api_key: ENV["JOBBOARDLY_API_KEY"])
|
|
29
|
+
|
|
30
|
+
# Or target a specific board host
|
|
31
|
+
client = JobBoardlyApi::Client.new(api_key: ENV["JOBBOARDLY_API_KEY"], board_host: "jobs.example.com")
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Board & Metadata
|
|
35
|
+
|
|
36
|
+
```ruby
|
|
37
|
+
response = client.me
|
|
38
|
+
response.body => Hash of the JSON body
|
|
39
|
+
response.to_object => OpenStruct
|
|
40
|
+
|
|
41
|
+
response = client.categories
|
|
42
|
+
response = client.category(1)
|
|
43
|
+
response = client.arrangements
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Jobs
|
|
47
|
+
|
|
48
|
+
```ruby
|
|
49
|
+
response = client.jobs(page: 1, per: 50)
|
|
50
|
+
response = client.create_job(
|
|
51
|
+
title: "API Engineer",
|
|
52
|
+
company_name: "Acme",
|
|
53
|
+
application_link: "mailto:jobs@acme.com",
|
|
54
|
+
description: "<div>Build APIs</div>",
|
|
55
|
+
location: "remote"
|
|
56
|
+
)
|
|
57
|
+
response = client.job(123)
|
|
58
|
+
response = client.update_job(123, title: "Senior API Engineer")
|
|
59
|
+
response = client.delete_job(123)
|
|
60
|
+
response = client.publish_job(123)
|
|
61
|
+
response = client.unpublish_job(123)
|
|
62
|
+
response = client.restore_job(123)
|
|
63
|
+
response = client.job_counts
|
|
64
|
+
response = client.bulk_draft_jobs([1, 2, 3])
|
|
65
|
+
response = client.bulk_publish_jobs([1, 2, 3])
|
|
66
|
+
response = client.bulk_expire_jobs([1, 2, 3])
|
|
67
|
+
response = client.bulk_destroy_jobs([1, 2, 3])
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Blog Posts
|
|
71
|
+
|
|
72
|
+
```ruby
|
|
73
|
+
response = client.blog_posts(state: "published")
|
|
74
|
+
response = client.create_blog_post(title: "Hello World")
|
|
75
|
+
response = client.blog_post(1)
|
|
76
|
+
response = client.update_blog_post(1, title: "Hello Universe")
|
|
77
|
+
response = client.delete_blog_post(1)
|
|
78
|
+
response = client.publish_blog_post(1)
|
|
79
|
+
response = client.unpublish_blog_post(1)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Prices & Employer Products
|
|
83
|
+
|
|
84
|
+
```ruby
|
|
85
|
+
response = client.prices
|
|
86
|
+
response = client.price(1)
|
|
87
|
+
response = client.employer_products
|
|
88
|
+
response = client.employer_product(1)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Memberships
|
|
92
|
+
|
|
93
|
+
```ruby
|
|
94
|
+
response = client.membership_subscriptions(page: 1)
|
|
95
|
+
response = client.grant_membership_subscription(
|
|
96
|
+
email: "customer@example.com",
|
|
97
|
+
membership_plan_id: 1,
|
|
98
|
+
external_ref: "unique-ref"
|
|
99
|
+
)
|
|
100
|
+
response = client.membership_subscription("unique-ref")
|
|
101
|
+
response = client.revoke_membership_subscription("unique-ref")
|
|
102
|
+
|
|
103
|
+
response = client.membership_purchases(page: 1)
|
|
104
|
+
response = client.grant_membership_purchase(
|
|
105
|
+
email: "customer@example.com",
|
|
106
|
+
membership_plan_id: 1,
|
|
107
|
+
external_ref: "unique-ref"
|
|
108
|
+
)
|
|
109
|
+
response = client.membership_purchase("unique-ref")
|
|
110
|
+
response = client.revoke_membership_purchase("unique-ref")
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Entitlements
|
|
114
|
+
|
|
115
|
+
```ruby
|
|
116
|
+
response = client.employer_entitlements(page: 1)
|
|
117
|
+
response = client.grant_employer_entitlement(
|
|
118
|
+
email: "customer@example.com",
|
|
119
|
+
employer_product_id: 1,
|
|
120
|
+
external_ref: "unique-ref"
|
|
121
|
+
)
|
|
122
|
+
response = client.employer_entitlement("unique-ref")
|
|
123
|
+
response = client.cancel_employer_entitlement("unique-ref")
|
|
124
|
+
|
|
125
|
+
response = client.candidate_entitlements(page: 1)
|
|
126
|
+
response = client.grant_candidate_entitlement(
|
|
127
|
+
email: "customer@example.com",
|
|
128
|
+
candidate_product_id: 1,
|
|
129
|
+
external_ref: "unique-ref"
|
|
130
|
+
)
|
|
131
|
+
response = client.candidate_entitlement("unique-ref")
|
|
132
|
+
response = client.cancel_candidate_entitlement("unique-ref")
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Job Payments
|
|
136
|
+
|
|
137
|
+
```ruby
|
|
138
|
+
response = client.job_payments(page: 1)
|
|
139
|
+
response = client.grant_job_payment(
|
|
140
|
+
job_id: 123,
|
|
141
|
+
amount_cents: 5000,
|
|
142
|
+
external_ref: "unique-ref"
|
|
143
|
+
)
|
|
144
|
+
response = client.job_payment("unique-ref")
|
|
145
|
+
response = client.revoke_job_payment("unique-ref")
|
|
146
|
+
response = client.revoke_job_payment("unique-ref", unpublish: false)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Headless Board API
|
|
150
|
+
|
|
151
|
+
The Headless API is public and does not require an API key. It is used for rendering a board from a custom frontend.
|
|
152
|
+
|
|
153
|
+
```ruby
|
|
154
|
+
# Using board host
|
|
155
|
+
client = JobBoardlyApi::HeadlessClient.new(board_host: "jobs.example.com")
|
|
156
|
+
|
|
157
|
+
# Or using board id via central API
|
|
158
|
+
client = JobBoardlyApi::HeadlessClient.new(board_id: 42)
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
```ruby
|
|
162
|
+
response = client.bootstrap
|
|
163
|
+
response = client.jobs(page: 1, per: 10)
|
|
164
|
+
response = client.job(123)
|
|
165
|
+
response = client.categories
|
|
166
|
+
response = client.arrangements
|
|
167
|
+
response = client.places(q: "Berlin")
|
|
168
|
+
response = client.blog_posts(tag: "ruby")
|
|
169
|
+
response = client.blog_post("hello-world")
|
|
170
|
+
response = client.page("about-us")
|
|
171
|
+
response = client.employer_products
|
|
172
|
+
response = client.candidate_products
|
|
173
|
+
response = client.membership_plans
|
|
174
|
+
response = client.create_subscriber(
|
|
175
|
+
subscriber: {
|
|
176
|
+
email: "user@example.com"
|
|
177
|
+
}
|
|
178
|
+
)
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Response Object
|
|
182
|
+
|
|
183
|
+
All API calls return a `JobBoardlyApi::Response`:
|
|
184
|
+
|
|
185
|
+
```ruby
|
|
186
|
+
response = client.me
|
|
187
|
+
|
|
188
|
+
response.success? # => true/false
|
|
189
|
+
response.status # => 200
|
|
190
|
+
response.headers # => { "content-type" => "application/json" }
|
|
191
|
+
response.body # => { "board" => { "id" => 1, ... } }
|
|
192
|
+
response.to_object # => #<OpenStruct board=#<OpenStruct id=1, ...>>
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Development
|
|
196
|
+
|
|
197
|
+
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.
|
|
198
|
+
|
|
199
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
200
|
+
|
|
201
|
+
## Contributing
|
|
202
|
+
|
|
203
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/williamkennedy/job_boardly_api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](CODE_OF_CONDUCT.md).
|
|
204
|
+
|
|
205
|
+
## License
|
|
206
|
+
|
|
207
|
+
The gem is available as open source under the terms of the [MIT License](LICENSE.txt).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "net/http"
|
|
4
|
+
require "json"
|
|
5
|
+
require "uri"
|
|
6
|
+
|
|
7
|
+
module JobBoardlyApi
|
|
8
|
+
class BaseClient
|
|
9
|
+
def initialize(base_url:)
|
|
10
|
+
@base_url = URI.parse(base_url.to_s)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def get(path, params = {})
|
|
14
|
+
make_request(Net::HTTP::Get, path, params)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def post(path, params = {}, body = {})
|
|
18
|
+
make_request(Net::HTTP::Post, path, params, body)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def patch(path, params = {}, body = {})
|
|
22
|
+
make_request(Net::HTTP::Patch, path, params, body)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def delete(path, params = {})
|
|
26
|
+
make_request(Net::HTTP::Delete, path, params)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
def make_request(http_class, path, params = {}, body = nil)
|
|
32
|
+
uri = build_uri(path, params)
|
|
33
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
34
|
+
http.use_ssl = uri.scheme == "https"
|
|
35
|
+
|
|
36
|
+
request = http_class.new(uri)
|
|
37
|
+
request["Content-Type"] = "application/json"
|
|
38
|
+
request["Accept"] = "application/json"
|
|
39
|
+
configure_request(request)
|
|
40
|
+
request.body = JSON.dump(body) if body
|
|
41
|
+
|
|
42
|
+
response = http.request(request)
|
|
43
|
+
Response.new(response)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def build_uri(path, params)
|
|
47
|
+
uri = @base_url.dup
|
|
48
|
+
uri.path = uri.path.chomp("/") + path
|
|
49
|
+
uri.query = URI.encode_www_form(params) if params && !params.empty?
|
|
50
|
+
uri
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def configure_request(request)
|
|
54
|
+
# override in subclasses
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module JobBoardlyApi
|
|
4
|
+
class Client < BaseClient
|
|
5
|
+
DEFAULT_BASE_URL = "https://api.jobboardly.com/v1"
|
|
6
|
+
|
|
7
|
+
def initialize(api_key:, base_url: nil, board_host: nil)
|
|
8
|
+
url = base_url || (board_host ? "https://api.#{board_host}/v1" : DEFAULT_BASE_URL)
|
|
9
|
+
super(base_url: url)
|
|
10
|
+
@api_key = api_key
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Board & Metadata
|
|
14
|
+
|
|
15
|
+
def me
|
|
16
|
+
get("/me")
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def categories
|
|
20
|
+
get("/categories")
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def category(id)
|
|
24
|
+
get("/categories/#{id}")
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def arrangements
|
|
28
|
+
get("/arrangements")
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Jobs
|
|
32
|
+
|
|
33
|
+
def jobs(params = {})
|
|
34
|
+
get("/jobs", params)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def create_job(body)
|
|
38
|
+
post("/jobs", {}, body)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def job(id)
|
|
42
|
+
get("/jobs/#{id}")
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def update_job(id, body)
|
|
46
|
+
patch("/jobs/#{id}", {}, body)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def delete_job(id)
|
|
50
|
+
delete("/jobs/#{id}")
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def publish_job(id)
|
|
54
|
+
post("/jobs/#{id}/publish")
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def unpublish_job(id)
|
|
58
|
+
post("/jobs/#{id}/unpublish")
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def restore_job(id)
|
|
62
|
+
patch("/jobs/#{id}/restore")
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def job_counts
|
|
66
|
+
get("/jobs/counts")
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def bulk_draft_jobs(job_ids)
|
|
70
|
+
post("/jobs/bulk_draft", {}, { job_ids: Array(job_ids).join(",") })
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def bulk_publish_jobs(job_ids)
|
|
74
|
+
post("/jobs/bulk_publish", {}, { job_ids: Array(job_ids).join(",") })
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def bulk_expire_jobs(job_ids)
|
|
78
|
+
post("/jobs/bulk_expire", {}, { job_ids: Array(job_ids).join(",") })
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def bulk_destroy_jobs(job_ids)
|
|
82
|
+
post("/jobs/bulk_destroy", {}, { job_ids: Array(job_ids).join(",") })
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Membership Subscriptions
|
|
86
|
+
|
|
87
|
+
def membership_subscriptions(params = {})
|
|
88
|
+
get("/membership_subscriptions", params)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def grant_membership_subscription(body)
|
|
92
|
+
post("/membership_subscriptions", {}, body)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def membership_subscription(external_ref)
|
|
96
|
+
get("/membership_subscriptions/#{external_ref}")
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def revoke_membership_subscription(external_ref)
|
|
100
|
+
delete("/membership_subscriptions/#{external_ref}")
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Membership Purchases
|
|
104
|
+
|
|
105
|
+
def membership_purchases(params = {})
|
|
106
|
+
get("/membership_purchases", params)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def grant_membership_purchase(body)
|
|
110
|
+
post("/membership_purchases", {}, body)
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def membership_purchase(external_ref)
|
|
114
|
+
get("/membership_purchases/#{external_ref}")
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def revoke_membership_purchase(external_ref)
|
|
118
|
+
delete("/membership_purchases/#{external_ref}")
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Blog Posts
|
|
122
|
+
|
|
123
|
+
def blog_posts(params = {})
|
|
124
|
+
get("/blog_posts", params)
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def create_blog_post(body)
|
|
128
|
+
post("/blog_posts", {}, body)
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def blog_post(id)
|
|
132
|
+
get("/blog_posts/#{id}")
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def update_blog_post(id, body)
|
|
136
|
+
patch("/blog_posts/#{id}", {}, body)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def delete_blog_post(id)
|
|
140
|
+
delete("/blog_posts/#{id}")
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def publish_blog_post(id)
|
|
144
|
+
post("/blog_posts/#{id}/publish")
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def unpublish_blog_post(id)
|
|
148
|
+
post("/blog_posts/#{id}/unpublish")
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# Job Payments
|
|
152
|
+
|
|
153
|
+
def job_payments(params = {})
|
|
154
|
+
get("/job_payments", params)
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
def grant_job_payment(body)
|
|
158
|
+
post("/job_payments", {}, body)
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
def job_payment(external_ref)
|
|
162
|
+
get("/job_payments/#{external_ref}")
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
def revoke_job_payment(external_ref, unpublish: true)
|
|
166
|
+
delete("/job_payments/#{external_ref}", { unpublish: unpublish })
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# Prices
|
|
170
|
+
|
|
171
|
+
def prices(params = {})
|
|
172
|
+
get("/prices", params)
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
def price(id)
|
|
176
|
+
get("/prices/#{id}")
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
# Employer Products
|
|
180
|
+
|
|
181
|
+
def employer_products(params = {})
|
|
182
|
+
get("/employer_products", params)
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
def employer_product(id)
|
|
186
|
+
get("/employer_products/#{id}")
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# Employer Entitlements
|
|
190
|
+
|
|
191
|
+
def employer_entitlements(params = {})
|
|
192
|
+
get("/employer_entitlements", params)
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
def grant_employer_entitlement(body)
|
|
196
|
+
post("/employer_entitlements", {}, body)
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
def employer_entitlement(external_ref)
|
|
200
|
+
get("/employer_entitlements/#{external_ref}")
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
def cancel_employer_entitlement(external_ref)
|
|
204
|
+
delete("/employer_entitlements/#{external_ref}")
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
# Candidate Entitlements
|
|
208
|
+
|
|
209
|
+
def candidate_entitlements(params = {})
|
|
210
|
+
get("/candidate_entitlements", params)
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
def grant_candidate_entitlement(body)
|
|
214
|
+
post("/candidate_entitlements", {}, body)
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
def candidate_entitlement(external_ref)
|
|
218
|
+
get("/candidate_entitlements/#{external_ref}")
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
def cancel_candidate_entitlement(external_ref)
|
|
222
|
+
delete("/candidate_entitlements/#{external_ref}")
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
private
|
|
226
|
+
|
|
227
|
+
def configure_request(request)
|
|
228
|
+
request["Authorization"] = "Bearer #{@api_key}"
|
|
229
|
+
end
|
|
230
|
+
end
|
|
231
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module JobBoardlyApi
|
|
4
|
+
class HeadlessClient < BaseClient
|
|
5
|
+
DEFAULT_BASE_URL = "https://api.jobboardly.com/headless/v1"
|
|
6
|
+
|
|
7
|
+
def initialize(board_host: nil, board_id: nil)
|
|
8
|
+
if board_host
|
|
9
|
+
url = "https://#{board_host}/headless/v1"
|
|
10
|
+
elsif board_id
|
|
11
|
+
url = "#{DEFAULT_BASE_URL}/boards/#{board_id}"
|
|
12
|
+
else
|
|
13
|
+
raise ArgumentError, "Either board_host or board_id is required"
|
|
14
|
+
end
|
|
15
|
+
super(base_url: url)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def bootstrap
|
|
19
|
+
get("/bootstrap")
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def create_subscriber(body)
|
|
23
|
+
post("/subscribers", {}, body)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def jobs(params = {})
|
|
27
|
+
get("/jobs", params)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def job(id)
|
|
31
|
+
get("/jobs/#{id}")
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def categories
|
|
35
|
+
get("/categories")
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def arrangements
|
|
39
|
+
get("/arrangements")
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def places(params = {})
|
|
43
|
+
get("/places", params)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def blog_posts(params = {})
|
|
47
|
+
get("/blog_posts", params)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def blog_post(slug)
|
|
51
|
+
get("/blog_posts/#{slug}")
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def page(path)
|
|
55
|
+
get("/pages/#{path}")
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def employer_products
|
|
59
|
+
get("/employer_products")
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def candidate_products
|
|
63
|
+
get("/candidate_products")
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def membership_plans
|
|
67
|
+
get("/membership_plans")
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "json"
|
|
4
|
+
require "ostruct"
|
|
5
|
+
|
|
6
|
+
module JobBoardlyApi
|
|
7
|
+
class Response
|
|
8
|
+
attr_reader :raw_response, :body, :status, :headers
|
|
9
|
+
|
|
10
|
+
def initialize(response)
|
|
11
|
+
@raw_response = response
|
|
12
|
+
@status = response.code.to_i
|
|
13
|
+
@headers = response.each_header.to_h
|
|
14
|
+
@body = parse_body(response.body)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def success?
|
|
18
|
+
(200..299).cover?(@status)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def to_object
|
|
22
|
+
return nil if @body.nil?
|
|
23
|
+
|
|
24
|
+
JSON.parse(JSON.generate(@body), object_class: OpenStruct)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
private
|
|
28
|
+
|
|
29
|
+
def parse_body(body)
|
|
30
|
+
return nil if body.nil? || body.empty?
|
|
31
|
+
|
|
32
|
+
JSON.parse(body)
|
|
33
|
+
rescue JSON::ParserError
|
|
34
|
+
body
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "job_boardly_api/version"
|
|
4
|
+
require_relative "job_boardly_api/response"
|
|
5
|
+
require_relative "job_boardly_api/base_client"
|
|
6
|
+
require_relative "job_boardly_api/client"
|
|
7
|
+
require_relative "job_boardly_api/headless_client"
|
|
8
|
+
|
|
9
|
+
module JobBoardlyApi
|
|
10
|
+
class Error < StandardError; end
|
|
11
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: job_boardly_api
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- William Kennedy
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
description: A Ruby wrapper around the Jobboardly Management and Headless Board APIs.
|
|
13
|
+
email:
|
|
14
|
+
- williamkennedyjnr@gmail.com
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- ".github/workflows/ruby.yml"
|
|
20
|
+
- CHANGELOG.md
|
|
21
|
+
- CODE_OF_CONDUCT.md
|
|
22
|
+
- LICENSE.txt
|
|
23
|
+
- README.md
|
|
24
|
+
- Rakefile
|
|
25
|
+
- lib/job_boardly_api.rb
|
|
26
|
+
- lib/job_boardly_api/base_client.rb
|
|
27
|
+
- lib/job_boardly_api/client.rb
|
|
28
|
+
- lib/job_boardly_api/headless_client.rb
|
|
29
|
+
- lib/job_boardly_api/response.rb
|
|
30
|
+
- lib/job_boardly_api/version.rb
|
|
31
|
+
- sig/job_boardly_api.rbs
|
|
32
|
+
homepage: https://github.com/williamkennedy/job_boardly_api
|
|
33
|
+
licenses:
|
|
34
|
+
- MIT
|
|
35
|
+
metadata:
|
|
36
|
+
homepage_uri: https://github.com/williamkennedy/job_boardly_api
|
|
37
|
+
source_code_uri: https://github.com/williamkennedy/job_boardly_api
|
|
38
|
+
changelog_uri: https://github.com/williamkennedy/job_boardly_api/blob/main/CHANGELOG.md
|
|
39
|
+
rdoc_options: []
|
|
40
|
+
require_paths:
|
|
41
|
+
- lib
|
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: 2.7.0
|
|
47
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
|
+
requirements:
|
|
49
|
+
- - ">="
|
|
50
|
+
- !ruby/object:Gem::Version
|
|
51
|
+
version: '0'
|
|
52
|
+
requirements: []
|
|
53
|
+
rubygems_version: 4.0.3
|
|
54
|
+
specification_version: 4
|
|
55
|
+
summary: A Ruby wrapper around the Jobboardly API.
|
|
56
|
+
test_files: []
|