Class: FinchAPI::Resources::HRIS::Company::PayStatementItem::Rules

Inherits:
Object
  • Object
show all
Defined in:
lib/finch_api/resources/hris/company/pay_statement_item/rules.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Rules

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 Rules.

Parameters:



110
111
112
# File 'lib/finch_api/resources/hris/company/pay_statement_item/rules.rb', line 110

def initialize(client:)
  @client = client
end

Instance Method Details

#create(attributes: nil, conditions: nil, effective_end_date: nil, effective_start_date: nil, entity_type: nil, request_options: {}) ⇒ FinchAPI::Models::HRIS::Company::PayStatementItem::RuleCreateResponse

Beta: this endpoint currently serves employers onboarded after March 4th and historical support will be added soon Custom rules can be created to associate specific attributes to pay statement items depending on the use case. For example, pay statement items that meet certain conditions can be labeled as a pre-tax 401k. This metadata can be retrieved where pay statement item information is available.

Parameters:

  • attributes (FinchAPI::HRIS::Company::PayStatementItem::RuleCreateParams::Attributes)

    Specifies the fields to be applied when the condition is met.

  • conditions (Array<FinchAPI::HRIS::Company::PayStatementItem::RuleCreateParams::Condition>)
  • effective_end_date (String, nil)

    Specifies when the rules should stop applying rules based on the date.

  • effective_start_date (String, nil)

    Specifies when the rule should begin applying based on the date.

  • entity_type (Symbol, FinchAPI::HRIS::Company::PayStatementItem::RuleCreateParams::EntityType)

    The entity type to which the rule is applied.

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

Returns:

See Also:



33
34
35
36
37
38
39
40
41
42
# File 'lib/finch_api/resources/hris/company/pay_statement_item/rules.rb', line 33

def create(params = {})
  parsed, options = FinchAPI::HRIS::Company::PayStatementItem::RuleCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "employer/pay-statement-item/rule",
    body: parsed,
    model: FinchAPI::Models::HRIS::Company::PayStatementItem::RuleCreateResponse,
    options: options
  )
end

#delete(rule_id, request_options: {}) ⇒ FinchAPI::Models::HRIS::Company::PayStatementItem::RuleDeleteResponse

Beta: this endpoint currently serves employers onboarded after March 4th and historical support will be added soon Delete a rule for a pay statement item.



98
99
100
101
102
103
104
105
# File 'lib/finch_api/resources/hris/company/pay_statement_item/rules.rb', line 98

def delete(rule_id, params = {})
  @client.request(
    method: :delete,
    path: ["employer/pay-statement-item/rule/%1$s", rule_id],
    model: FinchAPI::Models::HRIS::Company::PayStatementItem::RuleDeleteResponse,
    options: params[:request_options]
  )
end

#list(request_options: {}) ⇒ FinchAPI::Internal::ResponsesPage<FinchAPI::Models::HRIS::Company::PayStatementItem::RuleListResponse>

Beta: this endpoint currently serves employers onboarded after March 4th and historical support will be added soon List all rules of a connection account.



77
78
79
80
81
82
83
84
85
# File 'lib/finch_api/resources/hris/company/pay_statement_item/rules.rb', line 77

def list(params = {})
  @client.request(
    method: :get,
    path: "employer/pay-statement-item/rule",
    page: FinchAPI::Internal::ResponsesPage,
    model: FinchAPI::Models::HRIS::Company::PayStatementItem::RuleListResponse,
    options: params[:request_options]
  )
end

#update(rule_id, optional_property: nil, request_options: {}) ⇒ FinchAPI::Models::HRIS::Company::PayStatementItem::RuleUpdateResponse

Beta: this endpoint currently serves employers onboarded after March 4th and historical support will be added soon Update a rule for a pay statement item.

Parameters:

Returns:

See Also:



56
57
58
59
60
61
62
63
64
65
# File 'lib/finch_api/resources/hris/company/pay_statement_item/rules.rb', line 56

def update(rule_id, params = {})
  parsed, options = FinchAPI::HRIS::Company::PayStatementItem::RuleUpdateParams.dump_request(params)
  @client.request(
    method: :put,
    path: ["employer/pay-statement-item/rule/%1$s", rule_id],
    body: parsed,
    model: FinchAPI::Models::HRIS::Company::PayStatementItem::RuleUpdateResponse,
    options: options
  )
end