Class: Bob::TimeOff

Inherits:
API
  • Object
show all
Defined in:
lib/bob/api/time_off.rb

Constant Summary

Constants inherited from API

API::BASE_URL, API::SANDBOX_URL

Class Method Summary collapse

Methods inherited from API

build_url, create_csv, delete, get, headers, post, post_file, post_media, put

Class Method Details

.all_changed_since(since, pending = false) ⇒ Object



5
6
7
8
# File 'lib/bob/api/time_off.rb', line 5

def self.all_changed_since(since, pending = false)
  response = get('timeoff/requests/changes', { since:, pending: })['changes']
  TimeOffParser.new({ 'outs' => response }).events
end

.balance(employee_id, params) ⇒ Object



20
21
22
23
# File 'lib/bob/api/time_off.rb', line 20

def self.balance(employee_id, params)
  response = get("timeoff/employees/#{employee_id}/balance", params)
  TimeOffParser.new(response)
end

.find_for_employee(employee_id, request_id) ⇒ Object



15
16
17
18
# File 'lib/bob/api/time_off.rb', line 15

def self.find_for_employee(employee_id, request_id)
  response = get("timeoff/employees/#{employee_id}/requests/#{request_id}")
  TimeOffParser.new(response).event
end

.todayObject



10
11
12
13
# File 'lib/bob/api/time_off.rb', line 10

def self.today
  response = get('timeoff/outtoday')
  TimeOffParser.new(response).events
end