Module: FinchAPI::Enum Private

Includes:
Converter
Included in:
Models::AccountUpdateEvent::Data::AuthenticationMethod::Type, Models::AccountUpdateEvent::EventType, Models::CompanyEvent::EventType, Models::Connect::SessionNewParams::Integration::AuthMethod, Models::Connect::SessionNewParams::Product, Models::Connect::SessionNewParams::Sandbox, Models::Connect::SessionReauthenticateParams::Product, Models::ConnectionStatusType, Models::CreateAccessTokenResponse::ClientType, Models::CreateAccessTokenResponse::ConnectionType, Models::DirectoryEvent::EventType, Models::EmploymentEvent::EventType, Models::HRIS::BenefitContribution::Type, Models::HRIS::BenefitFeaturesAndOperations::SupportedFeatures::CompanyContribution, Models::HRIS::BenefitFeaturesAndOperations::SupportedFeatures::EmployeeDeduction, Models::HRIS::BenefitFeaturesAndOperations::SupportedFeatures::HsaContributionLimit, Models::HRIS::BenefitFrequency, Models::HRIS::BenefitType, Models::HRIS::Benefits::EnrolledIndividual::Code, Models::HRIS::Benefits::IndividualBenefit::Body::HsaContributionLimit, Models::HRIS::Benefits::IndividualEnrollManyParams::Individual::Configuration::AnnualContributionLimit, Models::HRIS::Benefits::IndividualEnrollManyParams::Individual::Configuration::CompanyContribution::Type, Models::HRIS::Benefits::IndividualEnrollManyParams::Individual::Configuration::EmployeeDeduction::Type, Models::HRIS::DocumentListParams::Type, Models::HRIS::DocumentResponse::Type, Models::HRIS::EmploymentData::Employment::Subtype, Models::HRIS::EmploymentData::Employment::Type, Models::HRIS::EmploymentData::EmploymentStatus, Models::HRIS::HRISCompany::Account::AccountType, Models::HRIS::HRISCompany::Entity::Subtype, Models::HRIS::HRISCompany::Entity::Type, Models::HRIS::Individual::Email::Type, Models::HRIS::Individual::Ethnicity, Models::HRIS::Individual::Gender, Models::HRIS::Individual::PhoneNumber::Type, Models::HRIS::PayStatement::Earning::Type, Models::HRIS::PayStatement::PaymentMethod, Models::HRIS::PayStatement::Tax::Type, Models::HRIS::PayStatement::Type, Models::HRIS::Payment::PayFrequency, Models::HRIS::SupportedBenefit::CompanyContribution, Models::HRIS::SupportedBenefit::EmployeeDeduction, Models::HRIS::SupportedBenefit::HsaContributionLimit, Models::HRIS::W42005::Data::Exemption, Models::HRIS::W42005::Data::FilingStatus, Models::HRIS::W42005::Type, Models::HRIS::W42020::Data::FilingStatus, Models::HRIS::W42020::Type, Models::Income::Unit, Models::IndividualEvent::EventType, Models::Introspection::AuthenticationMethod::Type, Models::Introspection::ClientType, Models::Introspection::ConnectionType, Models::JobCompletionEvent::EventType, Models::Jobs::AutomatedAsyncJob::Status, Models::Jobs::AutomatedAsyncJob::Type, Models::Jobs::AutomatedCreateParams::Type, Models::Jobs::ManualAsyncJob::Status, Models::OperationSupport, Models::PayStatementEvent::EventType, Models::PaymentEvent::EventType, Models::Payroll::PayGroupListResponse::PayFrequency, Models::Payroll::PayGroupRetrieveResponse::PayFrequency, Models::Provider::AuthenticationMethod::Type, Models::Sandbox::CompanyUpdateParams::Account::AccountType, Models::Sandbox::CompanyUpdateParams::Entity::Subtype, Models::Sandbox::CompanyUpdateParams::Entity::Type, Models::Sandbox::CompanyUpdateResponse::Account::AccountType, Models::Sandbox::CompanyUpdateResponse::Entity::Subtype, Models::Sandbox::CompanyUpdateResponse::Entity::Type, Models::Sandbox::ConnectionCreateParams::AuthenticationType, Models::Sandbox::ConnectionCreateResponse::AuthenticationType, Models::Sandbox::Connections::AccountCreateParams::AuthenticationType, Models::Sandbox::Connections::AccountCreateResponse::AuthenticationType, Models::Sandbox::Connections::AccountUpdateResponse::AuthenticationType, Models::Sandbox::DirectoryCreateParams::Body::Email::Type, Models::Sandbox::DirectoryCreateParams::Body::Employment::Subtype, Models::Sandbox::DirectoryCreateParams::Body::Employment::Type, Models::Sandbox::DirectoryCreateParams::Body::EmploymentStatus, Models::Sandbox::DirectoryCreateParams::Body::Ethnicity, Models::Sandbox::DirectoryCreateParams::Body::Gender, Models::Sandbox::DirectoryCreateParams::Body::PhoneNumber::Type, Models::Sandbox::EmploymentUpdateParams::Employment::Subtype, Models::Sandbox::EmploymentUpdateParams::Employment::Type, Models::Sandbox::EmploymentUpdateParams::EmploymentStatus, Models::Sandbox::EmploymentUpdateResponse::Employment::Subtype, Models::Sandbox::EmploymentUpdateResponse::Employment::Type, Models::Sandbox::EmploymentUpdateResponse::EmploymentStatus, Models::Sandbox::IndividualUpdateParams::Email::Type, Models::Sandbox::IndividualUpdateParams::Ethnicity, Models::Sandbox::IndividualUpdateParams::Gender, Models::Sandbox::IndividualUpdateParams::PhoneNumber::Type, Models::Sandbox::IndividualUpdateResponse::Email::Type, Models::Sandbox::IndividualUpdateResponse::Ethnicity, Models::Sandbox::IndividualUpdateResponse::Gender, Models::Sandbox::IndividualUpdateResponse::PhoneNumber::Type, Models::Sandbox::JobCreateParams::Type, Models::Sandbox::Jobs::SandboxJobConfiguration::CompletionStatus, Models::Sandbox::Jobs::SandboxJobConfiguration::Type, Models::Sandbox::PaymentCreateParams::PayStatement::Earning::Type, Models::Sandbox::PaymentCreateParams::PayStatement::PaymentMethod, Models::Sandbox::PaymentCreateParams::PayStatement::Tax::Type, Models::Sandbox::PaymentCreateParams::PayStatement::Type
Defined in:
lib/finch-api/base_model.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

A value from among a specified list of options. OpenAPI enum values map to Ruby

values in the SDK as follows:

1. boolean => true | false
2. integer => Integer
3. float => Float
4. string => Symbol

We can therefore convert string values to Symbols, but can't convert other
values safely.

Examples:

# `connection_status_type` is a `FinchAPI::Models::ConnectionStatusType`
case connection_status_type
when FinchAPI::Models::ConnectionStatusType::PENDING
  # ...
when FinchAPI::Models::ConnectionStatusType::PROCESSING
  # ...
when FinchAPI::Models::ConnectionStatusType::CONNECTED
  # ...
else
  puts(connection_status_type)
end
case connection_status_type
in :pending
  # ...
in :processing
  # ...
in :connected
  # ...
else
  puts(connection_status_type)
end

Instance Method Summary collapse

Methods included from Converter

coerce, dump, try_strict_coerce, type_info

Instance Method Details

#==(other) ⇒ Boolean

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.

Parameters:

  • other (Object)

Returns:

  • (Boolean)


335
336
337
# File 'lib/finch-api/base_model.rb', line 335

def ==(other)
  other.is_a?(Module) && other.singleton_class.ancestors.include?(FinchAPI::Enum) && other.values.to_set == values.to_set
end

#===(other) ⇒ Boolean

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.

Parameters:

  • other (Object)

Returns:

  • (Boolean)


330
# File 'lib/finch-api/base_model.rb', line 330

def ===(other) = values.include?(other)

#coerce(value) ⇒ Symbol, Object

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.

Parameters:

  • value (String, Symbol, Object)

Returns:

  • (Symbol, Object)


344
345
346
347
348
349
350
351
# File 'lib/finch-api/base_model.rb', line 344

def coerce(value)
  case value
  in Symbol | String if values.include?(val = value.to_sym)
    val
  else
    value
  end
end

#dump(value) ⇒ Symbol, Object

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.

Parameters:

  • value (Symbol, Object)

Returns:

  • (Symbol, Object)


6
# File 'lib/finch-api/base_model.rb', line 6

def dump(value) = super

#try_strict_coerce(value) ⇒ Array(true, Object, nil), Array(false, Boolean, Integer)

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.

Parameters:

  • value (Object)

Returns:

  • (Array(true, Object, nil), Array(false, Boolean, Integer))


366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
# File 'lib/finch-api/base_model.rb', line 366

def try_strict_coerce(value)
  return [true, value, 1] if values.include?(value)

  case value
  in Symbol | String if values.include?(val = value.to_sym)
    [true, val, 1]
  else
    case [value, values.first]
    in [true | false, true | false] | [Integer, Integer] | [Symbol | String, Symbol]
      [false, true, 0]
    else
      [false, false, 0]
    end
  end
end

#valuesArray<NilClass, Boolean, Integer, Float, Symbol>

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.

All of the valid Symbol values for this enum.

Returns:

  • (Array<NilClass, Boolean, Integer, Float, Symbol>)


320
# File 'lib/finch-api/base_model.rb', line 320

def values = (@values ||= constants.map { const_get(_1) })