module SmartHR::Client::CrewMethods

Public Instance Methods

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

Create a new crew

@see developer.smarthr.jp/api/index.html#!/%E5%BE%93%E6%A5%AD%E5%93%A1/postV1Crews

@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/crew_methods.rb, line 116
def create_crew(body:, &block)
  post("/crews", body, &block)
end
destroy_crew(id:, &block) click to toggle source

Delete the crew

@see developer.smarthr.jp/api/index.html#!/%E5%BE%93%E6%A5%AD%E5%93%A1/deleteV1CrewsId

@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/crew_methods.rb, line 32
def destroy_crew(id:, &block)
  delete("/crews/#{id}", &block)
end
destroy_crew_departments(crew_id:, &block) click to toggle source

Delete the crew departments

@see developer.smarthr.jp/api/index.html#!/%E5%BE%93%E6%A5%AD%E5%93%A1/deleteV1CrewsCrewIdDepartments

@param crew_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/crew_methods.rb, line 129
def destroy_crew_departments(crew_id:, &block)
  delete("/crews/#{crew_id}/departments", &block)
end
find_crew(id:, &block) click to toggle source

Get the crew

@see developer.smarthr.jp/api/index.html#!/%E5%BE%93%E6%A5%AD%E5%93%A1/getV1CrewsId

@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/crew_methods.rb, line 47
def find_crew(id:, &block)
  get("/crews/#{id}", &block)
end
get_crews(page: 1, per_page: 10, emp_code: nil, emp_type: nil, emp_status: nil, gender: nil, sort: nil, entered_at_from: nil, entered_at_to: nil, q: nil, fields: [], &block) click to toggle source

Get the list of crew custom field template groups

@see developer.smarthr.jp/api/index.html#!/%E5%BE%93%E6%A5%AD%E5%93%A1/getV1Crews

@param page [Integer] @param per_page [Integer] @param emp_code [String] Employee code @param emp_type [String] Employee type @param emp_status [String] Employee status @param gender [String] Gender @param sort [String] Sort @param entered_at_from [String] Filter to employees who joined the company after the specified date. @param entered_at_to [String] Filter to employees who joined the company before the specified date. @param q [String] Free word search by name, business name, department name, or job title. @param fields [Array] Name list of the item to get.

@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/crew_methods.rb, line 88
def get_crews(page: 1, per_page: 10, emp_code: nil, emp_type: nil, emp_status: nil, gender: nil, sort: nil, entered_at_from: nil, entered_at_to: nil, q: nil, fields: [], &block)
  get("/crews",
    page: page,
    per_page: per_page,
    emp_code: emp_code,
    emp_type: emp_type,
    emp_status: emp_status,
    gender: gender,
    sort: sort,
    entered_at_from: entered_at_from,
    entered_at_to: entered_at_to,
    q: q,
    fields: fields.join(','),
    &block
  )
end
invite_crew(id:, invite_user_id:, crew_input_form_id: nil, &block) click to toggle source

Invite a crew

@see developer.smarthr.jp/api/index.html#!/%E5%BE%93%E6%A5%AD%E5%93%A1/putV1CrewsIdInvite

@param id [String] @param invite_user_id [String] User ID of invitee @param crew_input_form_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/crew_methods.rb, line 15
def invite_crew(id:, invite_user_id:, crew_input_form_id: nil, &block)
  put("/crews/#{id}/invite",
    invite_user_id: invite_user_id,
    crew_input_form_id: crew_input_form_id,
    &block
  )
end
update_crew(id:, body:, &block) click to toggle source

Change the data of the specified crew

@see developer.smarthr.jp/api/index.html#!/%E5%BE%93%E6%A5%AD%E5%93%A1/patchV1CrewsId

@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/crew_methods.rb, line 63
def update_crew(id:, body:, &block)
  patch("/crews/#{id}", body, &block)
end