Class: Ashby::Openings
Overview
Ashby::Candidates provides access to candidate-related functionality in the Ashby API.
Includes support for:
- Fetching all candidates (with pagination)
- Searching by email or name
- Looking up by ID
- Adding notes to candidate profiles in plain text or HTML
Example:
Ashby::Candidates.all
Ashby::Candidates.find(email: '[email protected]')
Ashby::Candidates.find_by_id(id: 'cand_abc123')
client = Ashby::Candidates.new
client.create_candidate_note('cand_abc123', 'Reached out via email.')
client.create_formatted_candidate_note('cand_abc123', title: 'Initial Contact',
content: 'Spoke with Jane over Zoom.')
Constant Summary
Constants inherited from Client
Class Method Summary collapse
-
.all ⇒ Object
Fetches all openings with pagination support.
- .create(payload) ⇒ Object
-
.find(email: nil, name: nil) ⇒ Object
Finds an opening by email or name.
-
.find_by_id(id: nil) ⇒ Object
Finds an opening by its Ashby ID.
-
.search(identifier: nil) ⇒ Object
Searches for openings by the identifier.
- .set_status(id, state) ⇒ Object
Methods inherited from Client
build_url, headers, paginated_post, post
Class Method Details
.all ⇒ Object
Fetches all openings with pagination support
24 25 26 |
# File 'lib/ashby/openings.rb', line 24 def self.all paginated_post('opening.list') end |
.create(payload) ⇒ Object
69 70 71 72 73 74 |
# File 'lib/ashby/openings.rb', line 69 def self.create(payload) raise ArgumentError, 'No payload provided' if payload.empty? response = post('opening.create', payload) response['results'] end |
.find(email: nil, name: nil) ⇒ Object
Finds an opening by email or name
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/ashby/openings.rb', line 29 def self.find(email: nil, name: nil) payload = {} payload[:email] = email if email payload[:name] = name if name raise ArgumentError, 'You must provide at least an email or a name' if payload.empty? response = post('opening.search', payload) response['results'] end |
.find_by_id(id: nil) ⇒ Object
Finds an opening by its Ashby ID
50 51 52 53 54 55 56 |
# File 'lib/ashby/openings.rb', line 50 def self.find_by_id(id: nil) raise ArgumentError, 'Opening ID is required' if id.to_s.strip.empty? payload = { openingId: id } response = post('opening.info', payload) response['results'] end |
.search(identifier: nil) ⇒ Object
Searches for openings by the identifier
41 42 43 44 45 46 47 |
# File 'lib/ashby/openings.rb', line 41 def self.search(identifier: nil) raise ArgumentError, 'You must provide an identifier' if identifier.to_s.strip.empty? payload = { identifier: identifier.to_s } response = post('opening.search', payload) response['results'] end |
.set_status(id, state) ⇒ Object
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/ashby/openings.rb', line 58 def self.set_status(id, state) payload = {} payload[:openingId] = id if id payload[:openingState] = state if state raise ArgumentError, 'You must provide the opening ID and the state' if payload.empty? response = post('opening.setOpeningState', payload) response['results'] end |