Class: ThePlaidApi::EntityDocument

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

Overview

An official document, usually issued by a governing body or institution, with an associated identifier.

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(type:, number:, additional_properties: nil) ⇒ EntityDocument

Returns a new instance of EntityDocument.



49
50
51
52
53
54
55
56
# File 'lib/the_plaid_api/models/entity_document.rb', line 49

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

  @type = type
  @number = number
  @additional_properties = additional_properties
end

Instance Attribute Details

#numberString

The numeric or alphanumeric identifier associated with this document. Must be between 4 and 32 characters long, and cannot have leading or trailing spaces.

Returns:

  • (String)


29
30
31
# File 'lib/the_plaid_api/models/entity_document.rb', line 29

def number
  @number
end

#typeEntityDocumentType

The kind of official document represented by this object. ‘bik` - Russian bank code `business_number` - A number that uniquely identifies the business within a category of businesses `imo` - Number assigned to the entity by the International Maritime Organization `other` - Any document not covered by other categories `swift` - Number identifying a bank and branch. `tax_id` - Identification issued for the purpose of collecting taxes

Returns:



23
24
25
# File 'lib/the_plaid_api/models/entity_document.rb', line 23

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/the_plaid_api/models/entity_document.rb', line 59

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  type = hash.key?('type') ? hash['type'] : nil
  number = hash.key?('number') ? hash['number'] : nil

  # 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.
  EntityDocument.new(type: type,
                     number: number,
                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



32
33
34
35
36
37
# File 'lib/the_plaid_api/models/entity_document.rb', line 32

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

.nullablesObject

An array for nullable fields



45
46
47
# File 'lib/the_plaid_api/models/entity_document.rb', line 45

def self.nullables
  []
end

.optionalsObject

An array for optional fields



40
41
42
# File 'lib/the_plaid_api/models/entity_document.rb', line 40

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



87
88
89
90
91
# File 'lib/the_plaid_api/models/entity_document.rb', line 87

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

#to_sObject

Provides a human-readable string representation of the object.



80
81
82
83
84
# File 'lib/the_plaid_api/models/entity_document.rb', line 80

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