class PayrollHero::Api::V4::Employees

Employees Endpoint

Public Instance Methods

get(id, only: nil, except: nil, include: nil, **params) click to toggle source

implements the interface to get a single Employee record

@return [Hashie::Mash] @param [Fixnum|String] id @param [Array|Symbol] only - Attribute names to be included on the response @param [Array|Symbol] except - Attribute names to be excluded on the response @param [Array|Symbol] include - Association names to be included in the response

# File lib/payroll_hero/api/v4/employees.rb, line 33
def get(id, only: nil, except: nil, include: nil, **params)
  fetch id, only: only, except: except, include: include, **params
end
list(only: [], except: [], include: [], page: nil, per_page: nil, **params) click to toggle source

Implements the interface to get a list of accessible employees.

@return [Hashie::Mash] @param [Array|Symbol] only - Attribute names to be included on the response @param [Array|Symbol] except - Attribute names to be excluded on the response @param [Array|Symbol] include - Association names to be included in the response

# File lib/payroll_hero/api/v4/employees.rb, line 12
def list(only: [], except: [], include: [], page: nil, per_page: nil, **params)
  combined_params = params.merge(
    remove_empty_values_from!(
      only: Array(only),
      except: Array(except),
      include: Array(include),
      page: page,
      per_page: per_page
    )
  )

  client.get "/api/v4/employees", combined_params
end
subordinates(id, only: [], except: [], include: [], page: nil, per_page: nil, **params) click to toggle source

Implements the interface to get a list of the API token owner's subordinates

@return [Hashie::Mash] @param [Fixnum|String] id @param [Array|Symbol] only - Attribute names to be included on the response @param [Array|Symbol] except - Attribute names to be excluded on the response @param [Array|Symbol] include - Association names to be included in the response

# File lib/payroll_hero/api/v4/employees.rb, line 44
def subordinates(id, only: [], except: [], include: [], page: nil, per_page: nil, **params)
  fetch "#{id}/subordinates", only: only, except: except, include: include, page: page, per_page: per_page, **params
end
superiors(id, only: [], except: [], include: [], page: nil, per_page: nil, **params) click to toggle source

Implements the interface to get a list of the API token owner's superiors

@return [Hashie::Mash] @param [Fixnum|String] id @param [Array|Symbol] only - Attribute names to be included on the response @param [Array|Symbol] except - Attribute names to be excluded on the response @param [Array|Symbol] include - Association names to be included in the response

# File lib/payroll_hero/api/v4/employees.rb, line 55
def superiors(id, only: [], except: [], include: [], page: nil, per_page: nil, **params)
  fetch"#{id}/superiors", only: only, except: except, include: include, page: page, per_page: per_page, **params
end

Private Instance Methods

fetch(identifier, only:, except:, include:, page: nil, per_page: nil, **params) click to toggle source
# File lib/payroll_hero/api/v4/employees.rb, line 61
def fetch(identifier, only:, except:, include:, page: nil, per_page: nil, **params)
  combined_params = params.merge(
    remove_empty_values_from!(
      only: Array(only),
      except: Array(except),
      include: Array(include),
      page: page,
      per_page: per_page
    )
  )

  client.get "/api/v4/employees/#{identifier}", combined_params
end