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:



147
148
149
150
# File 'lib/finch_api/resources/hris/benefits.rb', line 147

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(entity_ids: nil, company_contribution: nil, description: nil, frequency: nil, type: nil, request_options: {}) ⇒ FinchAPI::Models::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:

Returns:

See Also:



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/finch_api/resources/hris/benefits.rb', line 33

def create(params = {})
  parsed, options = FinchAPI::HRIS::BenefitCreateParams.dump_request(params)
  query_params = [:entity_ids]
  @client.request(
    method: :post,
    path: "employer/benefits",
    query: parsed.slice(*query_params),
    body: parsed.except(*query_params),
    model: FinchAPI::HRIS::CreateCompanyBenefitsResponse,
    options: options
  )
end

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

List all company-wide deductions and contributions.

Parameters:

  • entity_ids (Array<String>)

    The entity IDs to specify which entities’ data to access.

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

Returns:

See Also:



109
110
111
112
113
114
115
116
117
118
119
# File 'lib/finch_api/resources/hris/benefits.rb', line 109

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

#list_supported_benefits(entity_ids: nil, request_options: {}) ⇒ FinchAPI::Internal::SinglePage<FinchAPI::Models::HRIS::SupportedBenefit>

Get deductions metadata

Parameters:

  • entity_ids (Array<String>)

    The entity IDs to specify which entities’ data to access.

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

Returns:

See Also:



132
133
134
135
136
137
138
139
140
141
142
# File 'lib/finch_api/resources/hris/benefits.rb', line 132

def list_supported_benefits(params = {})
  parsed, options = FinchAPI::HRIS::BenefitListSupportedBenefitsParams.dump_request(params)
  @client.request(
    method: :get,
    path: "employer/benefits/meta",
    query: parsed,
    page: FinchAPI::Internal::SinglePage,
    model: FinchAPI::HRIS::SupportedBenefit,
    options: options
  )
end

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

Lists deductions and contributions information for a given item

Parameters:

  • benefit_id (String)
  • entity_ids (Array<String>)

    The entity IDs to specify which entities’ data to access.

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

Returns:

See Also:



59
60
61
62
63
64
65
66
67
68
# File 'lib/finch_api/resources/hris/benefits.rb', line 59

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

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

Updates an existing company-wide deduction or contribution

Parameters:

  • benefit_id (String)

    Path param:

  • entity_ids (Array<String>)

    Query param: The entity IDs to specify which entities’ data to access.

  • description (String)

    Body param: Updated name or description.

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

Returns:

See Also:



85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/finch_api/resources/hris/benefits.rb', line 85

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