Module: SmartHR::Client::CrewMethods

Included in:
SmartHR::Client
Defined in:
lib/smarthr/client/crew_methods.rb

Instance Method Summary collapse

Instance Method Details

#create_crew(body:) {|response_body, response_header| ... } ⇒ Hashie::Mash

Create a new crew

Parameters:

  • body (Hash)

Yields:

  • (response_body, response_header)

    if block was given, return response body and response header through block arguments

Yield Parameters:

  • response_body (Hashie::Mash)

    response body

  • response_header (Hash<String, String>)

    response header (e.g. X-Rate-Limit-Limit, X-Rate-Limit-Reset, X-Rate-Limit-Remaining)

Returns:

  • (Hashie::Mash)

See Also:



116
117
118
# File 'lib/smarthr/client/crew_methods.rb', line 116

def create_crew(body:, &block)
  post("/crews", body, &block)
end

#destroy_crew(id:) {|response_body, response_header| ... } ⇒ Object

Delete the crew

Parameters:

  • id (String)

Yields:

  • (response_body, response_header)

    if block was given, return response body and response header through block arguments

Yield Parameters:

  • response_body (Hashie::Mash)

    response body

  • response_header (Hash<String, String>)

    response header (e.g. X-Rate-Limit-Limit, X-Rate-Limit-Reset, X-Rate-Limit-Remaining)

See Also:



32
33
34
# File 'lib/smarthr/client/crew_methods.rb', line 32

def destroy_crew(id:, &block)
  delete("/crews/#{id}", &block)
end

#destroy_crew_departments(crew_id:) {|response_body, response_header| ... } ⇒ Object

Delete the crew departments

Parameters:

  • crew_id (String)

Yields:

  • (response_body, response_header)

    if block was given, return response body and response header through block arguments

Yield Parameters:

  • response_body (Hashie::Mash)

    response body

  • response_header (Hash<String, String>)

    response header (e.g. X-Rate-Limit-Limit, X-Rate-Limit-Reset, X-Rate-Limit-Remaining)

See Also:



129
130
131
# 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:) {|response_body, response_header| ... } ⇒ Hashie::Mash

Get the crew

Parameters:

  • id (String)

Yields:

  • (response_body, response_header)

    if block was given, return response body and response header through block arguments

Yield Parameters:

  • response_body (Hashie::Mash)

    response body

  • response_header (Hash<String, String>)

    response header (e.g. X-Rate-Limit-Limit, X-Rate-Limit-Reset, X-Rate-Limit-Remaining)

Returns:

  • (Hashie::Mash)

See Also:



47
48
49
# 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: []) {|response_body, response_header| ... } ⇒ Array<Hashie::Mash>

Get the list of crew custom field template groups

Parameters:

  • page (Integer) (defaults to: 1)
  • per_page (Integer) (defaults to: 10)
  • emp_code (String) (defaults to: nil)

    Employee code

  • emp_type (String) (defaults to: nil)

    Employee type

  • emp_status (String) (defaults to: nil)

    Employee status

  • gender (String) (defaults to: nil)

    Gender

  • sort (String) (defaults to: nil)

    Sort

  • entered_at_from (String) (defaults to: nil)

    Filter to employees who joined the company after the specified date.

  • entered_at_to (String) (defaults to: nil)

    Filter to employees who joined the company before the specified date.

  • q (String) (defaults to: nil)

    Free word search by name, business name, department name, or job title.

  • fields (Array) (defaults to: [])

    Name list of the item to get.

Yields:

  • (response_body, response_header)

    if block was given, return response body and response header through block arguments

Yield Parameters:

  • response_body (Array<Hashie::Mash>)

    response body

  • response_header (Hash<String, String>)

    response header (e.g. X-Rate-Limit-Limit, X-Rate-Limit-Reset, X-Rate-Limit-Remaining)

Returns:

  • (Array<Hashie::Mash>)

See Also:



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# 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) {|response_body, response_header| ... } ⇒ Hashie::Mash

Invite a crew

Parameters:

  • id (String)
  • invite_user_id (String)

    User ID of invitee

  • crew_input_form_id (String) (defaults to: nil)

Yields:

  • (response_body, response_header)

    if block was given, return response body and response header through block arguments

Yield Parameters:

  • response_body (Hashie::Mash)

    response body

  • response_header (Hash<String, String>)

    response header (e.g. X-Rate-Limit-Limit, X-Rate-Limit-Reset, X-Rate-Limit-Remaining)

Returns:

  • (Hashie::Mash)

See Also:



15
16
17
18
19
20
21
# 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:) {|response_body, response_header| ... } ⇒ Hashie::Mash

Change the data of the specified crew

Parameters:

  • id (String)
  • body (Hash)

Yields:

  • (response_body, response_header)

    if block was given, return response body and response header through block arguments

Yield Parameters:

  • response_body (Hashie::Mash)

    response body

  • response_header (Hash<String, String>)

    response header (e.g. X-Rate-Limit-Limit, X-Rate-Limit-Reset, X-Rate-Limit-Remaining)

Returns:

  • (Hashie::Mash)

See Also:



63
64
65
# File 'lib/smarthr/client/crew_methods.rb', line 63

def update_crew(id:, body:, &block)
  patch("/crews/#{id}", body, &block)
end