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:



136
137
138
# File 'lib/finch_api/resources/hris/company/pay_statement_item/rules.rb', line 136

def initialize(client:)
  @client = client
end

Instance Method Details

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

Some parameter documentations has been truncated, see Models::HRIS::Company::PayStatementItem::RuleCreateParams for more details.

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:

Returns:

See Also:



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/finch_api/resources/hris/company/pay_statement_item/rules.rb', line 37

def create(params = {})
  query_params = [:entity_ids]
  parsed, options = FinchAPI::HRIS::Company::PayStatementItem::RuleCreateParams.dump_request(params)
  query = FinchAPI::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :post,
    path: "employer/pay-statement-item/rule",
    query: query,
    body: parsed.except(*query_params),
    model: FinchAPI::Models::HRIS::Company::PayStatementItem::RuleCreateResponse,
    security: {bearer_auth: true},
    options: options
  )
end

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

Delete a rule for a pay statement item.

Parameters:

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

    The entity IDs to delete the rule for.

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

Returns:

See Also:



120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/finch_api/resources/hris/company/pay_statement_item/rules.rb', line 120

def delete(rule_id, params = {})
  parsed, options = FinchAPI::HRIS::Company::PayStatementItem::RuleDeleteParams.dump_request(params)
  query = FinchAPI::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :delete,
    path: ["employer/pay-statement-item/rule/%1$s", rule_id],
    query: query,
    model: FinchAPI::Models::HRIS::Company::PayStatementItem::RuleDeleteResponse,
    security: {bearer_auth: true},
    options: options
  )
end

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

List all rules of a connection account.

Parameters:

  • entity_ids (Array<String>)

    The entity IDs to retrieve rules for.

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

Returns:

See Also:



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

def list(params = {})
  parsed, options = FinchAPI::HRIS::Company::PayStatementItem::RuleListParams.dump_request(params)
  query = FinchAPI::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "employer/pay-statement-item/rule",
    query: query,
    page: FinchAPI::Internal::ResponsesPage,
    model: FinchAPI::Models::HRIS::Company::PayStatementItem::RuleListResponse,
    security: {bearer_auth: true},
    options: options
  )
end

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

Update a rule for a pay statement item.

Parameters:

  • rule_id (String)

    Path param

  • entity_ids (Array<String>)

    Query param: The entity IDs to update the rule for.

  • optional_property (Object)

    Body param

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

Returns:

See Also:



67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/finch_api/resources/hris/company/pay_statement_item/rules.rb', line 67

def update(rule_id, params = {})
  query_params = [:entity_ids]
  parsed, options = FinchAPI::HRIS::Company::PayStatementItem::RuleUpdateParams.dump_request(params)
  query = FinchAPI::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :put,
    path: ["employer/pay-statement-item/rule/%1$s", rule_id],
    query: query,
    body: parsed.except(*query_params),
    model: FinchAPI::Models::HRIS::Company::PayStatementItem::RuleUpdateResponse,
    security: {bearer_auth: true},
    options: options
  )
end