Class: FinchAPI::Resources::HRIS::Benefits

Inherits:
Object
  • Object
show all
Defined in:
lib/finch_api/resources/hris/benefits.rb,
lib/finch_api/resources/hris/benefits/individuals.rb

Defined Under Namespace

Classes: Individuals

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Benefits

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Benefits.

Parameters:



126
127
128
129
# File 'lib/finch_api/resources/hris/benefits.rb', line 126

def initialize(client:)
  @client = client
  @individuals = FinchAPI::Resources::HRIS::Benefits::Individuals.new(client: client)
end

Instance Attribute Details

#individualsFinchAPI::Resources::HRIS::Benefits::Individuals (readonly)



8
9
10
# File 'lib/finch_api/resources/hris/benefits.rb', line 8

def individuals
  @individuals
end

Instance Method Details

#create(company_contribution: nil, description: nil, frequency: nil, type: nil, request_options: {}) ⇒ FinchAPI::HRIS::CreateCompanyBenefitsResponse

Some parameter documentations has been truncated, see Models::HRIS::BenefitCreateParams for more details.

Creates a new company-wide deduction or contribution. Please use the ‘/providers` endpoint to view available types for each provider.

Parameters:

  • company_contribution (FinchAPI::HRIS::BenefitCreateParams::CompanyContribution, nil)

    The company match for this benefit.

  • description (String)

    Name of the benefit as it appears in the provider and pay statements. Recommend

  • frequency (Symbol, FinchAPI::HRIS::BenefitFrequency, nil)

    The frequency of the benefit deduction/contribution.

  • type (Symbol, FinchAPI::HRIS::BenefitType, nil)

    Type of benefit.

  • request_options (FinchAPI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



31
32
33
34
35
36
37
38
39
40
# File 'lib/finch_api/resources/hris/benefits.rb', line 31

def create(params = {})
  parsed, options = FinchAPI::HRIS::BenefitCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "employer/benefits",
    body: parsed,
    model: FinchAPI::HRIS::CreateCompanyBenefitsResponse,
    options: options
  )
end

#list(request_options: {}) ⇒ FinchAPI::Internal::SinglePage<FinchAPI::HRIS::CompanyBenefit>

List all company-wide deductions and contributions.

Parameters:

Returns:

See Also:



94
95
96
97
98
99
100
101
102
# File 'lib/finch_api/resources/hris/benefits.rb', line 94

def list(params = {})
  @client.request(
    method: :get,
    path: "employer/benefits",
    page: FinchAPI::Internal::SinglePage,
    model: FinchAPI::HRIS::CompanyBenefit,
    options: params[:request_options]
  )
end

#list_supported_benefits(request_options: {}) ⇒ FinchAPI::Internal::SinglePage<FinchAPI::Models::HRIS::BenefitListSupportedBenefitsResponse>

Get deductions metadata



113
114
115
116
117
118
119
120
121
# File 'lib/finch_api/resources/hris/benefits.rb', line 113

def list_supported_benefits(params = {})
  @client.request(
    method: :get,
    path: "employer/benefits/meta",
    page: FinchAPI::Internal::SinglePage,
    model: FinchAPI::Models::HRIS::BenefitListSupportedBenefitsResponse,
    options: params[:request_options]
  )
end

#retrieve(benefit_id, request_options: {}) ⇒ FinchAPI::HRIS::CompanyBenefit

Lists deductions and contributions information for a given item

Parameters:

Returns:

See Also:



52
53
54
55
56
57
58
59
# File 'lib/finch_api/resources/hris/benefits.rb', line 52

def retrieve(benefit_id, params = {})
  @client.request(
    method: :get,
    path: ["employer/benefits/%1$s", benefit_id],
    model: FinchAPI::HRIS::CompanyBenefit,
    options: params[:request_options]
  )
end

#update(benefit_id, description: nil, request_options: {}) ⇒ FinchAPI::HRIS::UpdateCompanyBenefitResponse

Updates an existing company-wide deduction or contribution

Parameters:

  • benefit_id (String)
  • description (String)

    Updated name or description.

  • request_options (FinchAPI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



74
75
76
77
78
79
80
81
82
83
# File 'lib/finch_api/resources/hris/benefits.rb', line 74

def update(benefit_id, params = {})
  parsed, options = FinchAPI::HRIS::BenefitUpdateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["employer/benefits/%1$s", benefit_id],
    body: parsed,
    model: FinchAPI::HRIS::UpdateCompanyBenefitResponse,
    options: options
  )
end