Class: ThePlaidApi::PaymentInitiationAddress

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

Overview

The optional address of the payment recipient’s bank account. Required by most institutions outside of the UK.

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(street:, city:, postal_code:, country:, additional_properties: nil) ⇒ PaymentInitiationAddress

Returns a new instance of PaymentInitiationAddress.



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/the_plaid_api/models/payment_initiation_address.rb', line 50

def initialize(street:, city:, postal_code:, country:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @street = street
  @city = city
  @postal_code = postal_code
  @country = country
  @additional_properties = additional_properties
end

Instance Attribute Details

#cityString

The city where the recipient is located. Maximum of 35 characters.

Returns:

  • (String)


20
21
22
# File 'lib/the_plaid_api/models/payment_initiation_address.rb', line 20

def city
  @city
end

#countryString

The ISO 3166-1 alpha-2 country code where the recipient is located.

Returns:

  • (String)


28
29
30
# File 'lib/the_plaid_api/models/payment_initiation_address.rb', line 28

def country
  @country
end

#postal_codeString

The postal code where the recipient is located. Maximum of 16 characters.

Returns:

  • (String)


24
25
26
# File 'lib/the_plaid_api/models/payment_initiation_address.rb', line 24

def postal_code
  @postal_code
end

#streetArray[String]

An array of length 1-2 representing the street address where the recipient is located. Maximum of 70 characters.

Returns:

  • (Array[String])


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

def street
  @street
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/the_plaid_api/models/payment_initiation_address.rb', line 63

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  street = hash.key?('street') ? hash['street'] : nil
  city = hash.key?('city') ? hash['city'] : nil
  postal_code = hash.key?('postal_code') ? hash['postal_code'] : nil
  country = hash.key?('country') ? hash['country'] : 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.
  PaymentInitiationAddress.new(street: street,
                               city: city,
                               postal_code: postal_code,
                               country: country,
                               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['street'] = 'street'
  @_hash['city'] = 'city'
  @_hash['postal_code'] = 'postal_code'
  @_hash['country'] = 'country'
  @_hash
end

.nullablesObject

An array for nullable fields



46
47
48
# File 'lib/the_plaid_api/models/payment_initiation_address.rb', line 46

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



95
96
97
98
99
100
# File 'lib/the_plaid_api/models/payment_initiation_address.rb', line 95

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

#to_sObject

Provides a human-readable string representation of the object.



88
89
90
91
92
# File 'lib/the_plaid_api/models/payment_initiation_address.rb', line 88

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