Class: ThePlaidApi::TransferPlatformPersonAddress

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

Overview

Home address of a person

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(city:, country:, postal_code:, region:, street:, street2: SKIP, additional_properties: nil) ⇒ TransferPlatformPersonAddress

Returns a new instance of TransferPlatformPersonAddress.



66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/the_plaid_api/models/transfer_platform_person_address.rb', line 66

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

  @city = city
  @country = country
  @postal_code = postal_code
  @region = region
  @street = street
  @street2 = street2 unless street2 == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#cityString

The full city name.

Returns:

  • (String)


14
15
16
# File 'lib/the_plaid_api/models/transfer_platform_person_address.rb', line 14

def city
  @city
end

#countryString

Valid, capitalized, two-letter ISO code representing the country of this object. Must be in ISO 3166-1 alpha-2 form.

Returns:

  • (String)


19
20
21
# File 'lib/the_plaid_api/models/transfer_platform_person_address.rb', line 19

def country
  @country
end

#postal_codeString

The postal code of the address.

Returns:

  • (String)


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

def postal_code
  @postal_code
end

#regionString

An ISO 3166-2 subdivision code. Related terms would be “state”, “province”, “prefecture”, “zone”, “subdivision”, etc.

Returns:

  • (String)


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

def region
  @region
end

#streetString

The primary street portion of an address. A string with at least one non-whitespace alphabetical character, with a max length of 80 characters.

Returns:

  • (String)


34
35
36
# File 'lib/the_plaid_api/models/transfer_platform_person_address.rb', line 34

def street
  @street
end

#street2String

Extra street information, like an apartment or suite number. If provided, a string with at least one non-whitespace character, with a max length of 50 characters.

Returns:

  • (String)


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

def street2
  @street2
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/the_plaid_api/models/transfer_platform_person_address.rb', line 81

def self.from_hash(hash)
  return nil unless hash

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

.namesObject

A mapping from model property names to API property names.



43
44
45
46
47
48
49
50
51
52
# File 'lib/the_plaid_api/models/transfer_platform_person_address.rb', line 43

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

.nullablesObject

An array for nullable fields



62
63
64
# File 'lib/the_plaid_api/models/transfer_platform_person_address.rb', line 62

def self.nullables
  []
end

.optionalsObject

An array for optional fields



55
56
57
58
59
# File 'lib/the_plaid_api/models/transfer_platform_person_address.rb', line 55

def self.optionals
  %w[
    street2
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



118
119
120
121
122
123
# File 'lib/the_plaid_api/models/transfer_platform_person_address.rb', line 118

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

#to_sObject

Provides a human-readable string representation of the object.



110
111
112
113
114
115
# File 'lib/the_plaid_api/models/transfer_platform_person_address.rb', line 110

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