Class: ThePlaidApi::LinkDeliveryRecipient

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

Overview

Metadata related to the recipient. If the information required to populate this field is not available, leave it blank.

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(communication_methods: SKIP, first_name: SKIP, additional_properties: nil) ⇒ LinkDeliveryRecipient

Returns a new instance of LinkDeliveryRecipient.



45
46
47
48
49
50
51
52
53
# File 'lib/the_plaid_api/models/link_delivery_recipient.rb', line 45

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

  @communication_methods = communication_methods unless communication_methods == SKIP
  @first_name = first_name unless first_name == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#communication_methodsArray[LinkDeliveryCommunicationMethod]

The list of communication methods to send the Hosted Link session URL to. If delivery is not required, leave this field blank.



16
17
18
# File 'lib/the_plaid_api/models/link_delivery_recipient.rb', line 16

def communication_methods
  @communication_methods
end

#first_nameString

First name of the recipient. Will be used in the body of the email / text (if configured). If this information is not available, leave this field blank.

Returns:

  • (String)


22
23
24
# File 'lib/the_plaid_api/models/link_delivery_recipient.rb', line 22

def first_name
  @first_name
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/the_plaid_api/models/link_delivery_recipient.rb', line 56

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  # Parameter is an array, so we need to iterate through it
  communication_methods = nil
  unless hash['communication_methods'].nil?
    communication_methods = []
    hash['communication_methods'].each do |structure|
      communication_methods << (LinkDeliveryCommunicationMethod.from_hash(structure) if structure)
    end
  end

  communication_methods = SKIP unless hash.key?('communication_methods')
  first_name = hash.key?('first_name') ? hash['first_name'] : 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.
  LinkDeliveryRecipient.new(communication_methods: communication_methods,
                            first_name: first_name,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
# File 'lib/the_plaid_api/models/link_delivery_recipient.rb', line 25

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

.nullablesObject

An array for nullable fields



41
42
43
# File 'lib/the_plaid_api/models/link_delivery_recipient.rb', line 41

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    communication_methods
    first_name
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



93
94
95
96
97
# File 'lib/the_plaid_api/models/link_delivery_recipient.rb', line 93

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

#to_sObject

Provides a human-readable string representation of the object.



86
87
88
89
90
# File 'lib/the_plaid_api/models/link_delivery_recipient.rb', line 86

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