Class: Ashby::Applications

Inherits:
Client
  • Object
show all
Defined in:
lib/ashby/applications.rb

Overview

Ashby::Applications provides access to job application-related operations via the Ashby API.

Supported functionality includes:

- Retrieving a paginated list of all applications
- Fetching a specific application by its ID

Example usage:

Ashby::Applications.all
Ashby::Applications.find_by_id(id: 'app_abc123')

Constant Summary

Constants inherited from Client

Client::API_URL

Class Method Summary collapse

Methods inherited from Client

build_url, headers, paginated_post, post

Class Method Details

.all(payload = {}) ⇒ Object

Fetches all openings with pagination support



16
17
18
# File 'lib/ashby/applications.rb', line 16

def self.all(payload = {})
  paginated_post('application.list', payload)
end

.find_by_id(id: nil, expand: '') ⇒ Object

Finds an opening by its Ashby ID

Raises:

  • (ArgumentError)


21
22
23
24
25
26
27
28
29
30
# File 'lib/ashby/applications.rb', line 21

def self.find_by_id(id: nil, expand: '')
  raise ArgumentError, 'Application ID is required' if id.to_s.strip.empty?

  payload = {
    applicationId: id,
    expand: expand.strip.empty? ? [] : [expand]
  }
  response = post('application.info', payload)
  response['results']
end