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

Returns a new instance of Benefits.

Parameters:



112
113
114
115
# File 'lib/finch-api/resources/hris/benefits.rb', line 112

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(params = {}) ⇒ FinchAPI::Models::HRIS::CreateCompanyBenefitsResponse

Creates a new company-wide deduction or contribution. Please use the

`/providers` endpoint to view available types for each provider.

Parameters:

  • params (FinchAPI::Models::HRIS::BenefitCreateParams, Hash{Symbol=>Object}) (defaults to: {})

    .

    @option params [String] :description Name of the benefit as it appears in the provider and pay statements. Recommend

    limiting this to <30 characters due to limitations in specific providers (e.g.
    Justworks).
    

    @option params [Symbol, FinchAPI::Models::HRIS::BenefitFrequency, nil] :frequency

    @option params [Symbol, FinchAPI::Models::HRIS::BenefitType, nil] :type Type of benefit.

    @option params [FinchAPI::RequestOptions, HashSymbol=>Object, nil] :request_options

Returns:



26
27
28
29
30
31
32
33
34
35
# File 'lib/finch-api/resources/hris/benefits.rb', line 26

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

#list(params = {}) ⇒ FinchAPI::SinglePage<FinchAPI::Models::HRIS::CompanyBenefit>

List all company-wide deductions and contributions.

Parameters:

Returns:



84
85
86
87
88
89
90
91
92
# File 'lib/finch-api/resources/hris/benefits.rb', line 84

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

#list_supported_benefits(params = {}) ⇒ FinchAPI::SinglePage<FinchAPI::Models::HRIS::SupportedBenefit>

Get deductions metadata

Parameters:

Returns:



101
102
103
104
105
106
107
108
109
# File 'lib/finch-api/resources/hris/benefits.rb', line 101

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

#retrieve(benefit_id, params = {}) ⇒ FinchAPI::Models::HRIS::CompanyBenefit

Lists deductions and contributions information for a given item

Parameters:

Returns:



46
47
48
49
50
51
52
53
# File 'lib/finch-api/resources/hris/benefits.rb', line 46

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

#update(benefit_id, params = {}) ⇒ FinchAPI::Models::HRIS::UpdateCompanyBenefitResponse

Updates an existing company-wide deduction or contribution

Parameters:

  • benefit_id (String)
  • params (FinchAPI::Models::HRIS::BenefitUpdateParams, Hash{Symbol=>Object}) (defaults to: {})

    .

    @option params [String] :description Updated name or description.

    @option params [FinchAPI::RequestOptions, HashSymbol=>Object, nil] :request_options

Returns:



66
67
68
69
70
71
72
73
74
75
# File 'lib/finch-api/resources/hris/benefits.rb', line 66

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