Class: ThePlaidApi::RequirementSubmission

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/requirement_submission.rb

Overview

A single requirement submission

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(requirement_type:, value:, person_id: SKIP, additional_properties: nil) ⇒ RequirementSubmission

Returns a new instance of RequirementSubmission.



55
56
57
58
59
60
61
62
63
64
# File 'lib/the_plaid_api/models/requirement_submission.rb', line 55

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

  @requirement_type = requirement_type
  @value = value
  @person_id = person_id unless person_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#person_idUUID | String

The ‘person_id` of the person the requirement submission is related to. A `person_id` is returned by `/transfer/platform/person/create`. This field should not be included for requirements that are not related to a person.

Returns:

  • (UUID | String)


32
33
34
# File 'lib/the_plaid_api/models/requirement_submission.rb', line 32

def person_id
  @person_id
end

#requirement_typeString

The type of requirement being submitted. See [Requirement type schema documentation](docs.google.com/document/d/1NEQkTD0sVK50iAQi6xHigre xDUxZ4QxXqSEfV_FFTiU/) for a list of requirement types and possible values.

Returns:

  • (String)


17
18
19
# File 'lib/the_plaid_api/models/requirement_submission.rb', line 17

def requirement_type
  @requirement_type
end

#valueString

The value of the requirement, which can be a string or an object depending on the ‘requirement_type`. If it is an object, the object should be JSON marshaled into a string. See [Requirement type schema documentation](docs.google.com/document/d/1NEQkTD0sVK50iAQi6xHigre xDUxZ4QxXqSEfV_FFTiU/) for a list of requirement types and possible values.

Returns:

  • (String)


26
27
28
# File 'lib/the_plaid_api/models/requirement_submission.rb', line 26

def value
  @value
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/the_plaid_api/models/requirement_submission.rb', line 67

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  requirement_type =
    hash.key?('requirement_type') ? hash['requirement_type'] : nil
  value = hash.key?('value') ? hash['value'] : nil
  person_id = hash.key?('person_id') ? hash['person_id'] : 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.
  RequirementSubmission.new(requirement_type: requirement_type,
                            value: value,
                            person_id: person_id,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



35
36
37
38
39
40
41
# File 'lib/the_plaid_api/models/requirement_submission.rb', line 35

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['requirement_type'] = 'requirement_type'
  @_hash['value'] = 'value'
  @_hash['person_id'] = 'person_id'
  @_hash
end

.nullablesObject

An array for nullable fields



51
52
53
# File 'lib/the_plaid_api/models/requirement_submission.rb', line 51

def self.nullables
  []
end

.optionalsObject

An array for optional fields



44
45
46
47
48
# File 'lib/the_plaid_api/models/requirement_submission.rb', line 44

def self.optionals
  %w[
    person_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



98
99
100
101
102
# File 'lib/the_plaid_api/models/requirement_submission.rb', line 98

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

#to_sObject

Provides a human-readable string representation of the object.



91
92
93
94
95
# File 'lib/the_plaid_api/models/requirement_submission.rb', line 91

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