Class: Plaid::IncomeVerificationPrecheckMilitaryInfo

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/plaid/models/income_verification_precheck_military_info.rb

Overview

IncomeVerificationPrecheckMilitaryInfo Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(is_active_duty: SKIP, branch: SKIP, additional_properties: nil) ⇒ IncomeVerificationPrecheckMilitaryInfo

Returns a new instance of IncomeVerificationPrecheckMilitaryInfo.



44
45
46
47
48
49
50
51
52
# File 'lib/plaid/models/income_verification_precheck_military_info.rb', line 44

def initialize(is_active_duty: SKIP, branch: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @is_active_duty = is_active_duty unless is_active_duty == SKIP
  @branch = branch unless branch == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#branchBranch

If the user is currently serving in the US military, the branch of the military they are serving in

Returns:



19
20
21
# File 'lib/plaid/models/income_verification_precheck_military_info.rb', line 19

def branch
  @branch
end

#is_active_dutyTrueClass | FalseClass

Is the user currently active duty in the US military

Returns:

  • (TrueClass | FalseClass)


14
15
16
# File 'lib/plaid/models/income_verification_precheck_military_info.rb', line 14

def is_active_duty
  @is_active_duty
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/plaid/models/income_verification_precheck_military_info.rb', line 55

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  is_active_duty =
    hash.key?('is_active_duty') ? hash['is_active_duty'] : SKIP
  branch = hash.key?('branch') ? hash['branch'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  IncomeVerificationPrecheckMilitaryInfo.new(is_active_duty: is_active_duty,
                                             branch: branch,
                                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



22
23
24
25
26
27
# File 'lib/plaid/models/income_verification_precheck_military_info.rb', line 22

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['is_active_duty'] = 'is_active_duty'
  @_hash['branch'] = 'branch'
  @_hash
end

.nullablesObject

An array for nullable fields



38
39
40
41
42
# File 'lib/plaid/models/income_verification_precheck_military_info.rb', line 38

def self.nullables
  %w[
    is_active_duty
  ]
end

.optionalsObject

An array for optional fields



30
31
32
33
34
35
# File 'lib/plaid/models/income_verification_precheck_military_info.rb', line 30

def self.optionals
  %w[
    is_active_duty
    branch
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



84
85
86
87
88
# File 'lib/plaid/models/income_verification_precheck_military_info.rb', line 84

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} is_active_duty: #{@is_active_duty.inspect}, branch: #{@branch.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



77
78
79
80
81
# File 'lib/plaid/models/income_verification_precheck_military_info.rb', line 77

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} is_active_duty: #{@is_active_duty}, branch: #{@branch},"\
  " additional_properties: #{@additional_properties}>"
end