module SmartHR::Client::DepartmentMethods

Public Instance Methods

create_department(body:, &block) click to toggle source

Create a new department

@see developer.smarthr.jp/api/index.html#!/%E9%83%A8%E7%BD%B2/postV1Departments

@param body [Hash]

@yield [response_body, response_header] if block was given, return response body and response header through block arguments @yieldparam response_body [Hashie::Mash] response body @yieldparam response_header [Hash<String, String>] response header (e.g. X-Rate-Limit-Limit, X-Rate-Limit-Reset, X-Rate-Limit-Remaining)

@return [Hashie::Mash]

# File lib/smarthr/client/department_methods.rb, line 81
def create_department(body:, &block)
  post("/departments", body, &block)
end
destroy_department(id:, &block) click to toggle source

Delete the department

@see developer.smarthr.jp/api/index.html#!/%E9%83%A8%E7%BD%B2/deleteV1DepartmentsId

@param id [String]

@yield [response_body, response_header] if block was given, return response body and response header through block arguments @yieldparam response_body [Hashie::Mash] response body @yieldparam response_header [Hash<String, String>] response header (e.g. X-Rate-Limit-Limit, X-Rate-Limit-Reset, X-Rate-Limit-Remaining)

# File lib/smarthr/client/department_methods.rb, line 11
def destroy_department(id:, &block)
  delete("/departments/#{id}", &block)
end
find_department(id:, &block) click to toggle source

Get the department

@see developer.smarthr.jp/api/index.html#!/%E9%83%A8%E7%BD%B2/getV1DepartmentsId

@param id [String]

@yield [response_body, response_header] if block was given, return response body and response header through block arguments @yieldparam response_body [Hashie::Mash] response body @yieldparam response_header [Hash<String, String>] response header (e.g. X-Rate-Limit-Limit, X-Rate-Limit-Reset, X-Rate-Limit-Remaining)

@return [Hashie::Mash]

# File lib/smarthr/client/department_methods.rb, line 26
def find_department(id:, &block)
  get("/departments/#{id}", &block)
end
get_departments(page: 1, per_page: 10, code: nil, sort: nil, &block) click to toggle source

Get the list of departments

@see developer.smarthr.jp/api/index.html#!/%E9%83%A8%E7%BD%B2/getV1Departments

@param page [Integer] @param per_page [Integer] @param code [String] @param sort [String]

@yield [response_body, response_header] if block was given, return response body and response header through block arguments @yieldparam response_body [Array<Hashie::Mash>] response body @yieldparam response_header [Hash<String, String>] response header (e.g. X-Rate-Limit-Limit, X-Rate-Limit-Reset, X-Rate-Limit-Remaining)

@return [Array<Hashie::Mash>]

# File lib/smarthr/client/department_methods.rb, line 60
def get_departments(page: 1, per_page: 10, code: nil, sort: nil, &block)
  get("/departments",
    page: page,
    per_page: per_page,
    code: code,
    sort: sort,
    &block
  )
end
update_department(id:, body:, &block) click to toggle source

Change the data of the specified department

@see developer.smarthr.jp/api/index.html#!/%E9%83%A8%E7%BD%B2/patchV1DepartmentsId

@param id [String] @param body [Hash]

@yield [response_body, response_header] if block was given, return response body and response header through block arguments @yieldparam response_body [Hashie::Mash] response body @yieldparam response_header [Hash<String, String>] response header (e.g. X-Rate-Limit-Limit, X-Rate-Limit-Reset, X-Rate-Limit-Remaining)

@return [Hashie::Mash]

# File lib/smarthr/client/department_methods.rb, line 42
def update_department(id:, body:, &block)
  patch("/departments/#{id}", body, &block)
end