Class: Ashby::Departments
Overview
Ashby::Departments provides methods to interact with the Ashby API's department-related endpoints.
Includes fetching a list of departments and retrieving a specific department by ID.
Example:
Ashby::Departments.all
Ashby::Departments.find(id: 'abc123')
Constant Summary
Constants inherited from Client
Class Method Summary collapse
-
.all ⇒ Object
Fetches all departments.
-
.find(id: nil) ⇒ Object
Finds a department by its Ashby ID.
Methods inherited from Client
build_url, headers, paginated_post, post
Class Method Details
.all ⇒ Object
Fetches all departments
15 16 17 18 |
# File 'lib/ashby/departments.rb', line 15 def self.all response = post('department.list') response['results'] end |
.find(id: nil) ⇒ Object
Finds a department by its Ashby ID
21 22 23 24 25 26 27 |
# File 'lib/ashby/departments.rb', line 21 def self.find(id: nil) raise ArgumentError, 'Department ID is required' if id.to_s.strip.empty? payload = { departmentId: id } response = post('department.info', payload) response['results'] end |