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,
sig/finch_api/resources/hris/benefits.rbs,
sig/finch_api/resources/hris/benefits/individuals.rbs

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:



205
206
207
208
# File 'lib/finch_api/resources/hris/benefits.rb', line 205

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
45
46
# File 'lib/finch_api/resources/hris/benefits.rb', line 33

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

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

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

List all company-wide deductions and contributions.

Parameters:

  • entity_ids (Array<String>)

    The entity IDs to specify which entities' data to access. Provide exactly one en

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

Returns:

See Also:



124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/finch_api/resources/hris/benefits.rb', line 124

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

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

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

Get deductions metadata

Parameters:

  • entity_ids (Array<String>)

    The entity IDs to specify which entities' data to access. Provide exactly one en

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

Returns:

See Also:



152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/finch_api/resources/hris/benefits.rb', line 152

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

#register(entity_ids: nil, description: nil, frequency: nil, type: nil, request_options: {}) ⇒ FinchAPI::Models::HRIS::RegisterCompanyBenefitResponse

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

Register existing benefits from the customer on the provider, on Finch's end. Please use the /provider endpoint to view available types for each provider.

Parameters:

Returns:

See Also:



187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/finch_api/resources/hris/benefits.rb', line 187

def register(params = {})
  query_params = [:entity_ids]
  parsed, options = FinchAPI::HRIS::BenefitRegisterParams.dump_request(params)
  query = FinchAPI::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :post,
    path: "employer/benefits/register",
    query: query,
    body: parsed.except(*query_params),
    model: FinchAPI::HRIS::RegisterCompanyBenefitResponse,
    security: {bearer_auth: true},
    options: options
  )
end

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

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

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. Provide exactly one en

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

Returns:

See Also:



64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/finch_api/resources/hris/benefits.rb', line 64

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

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

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

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. Provide e

  • description (String)

    Body param: Updated name or description.

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

Returns:

See Also:



95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/finch_api/resources/hris/benefits.rb', line 95

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