Class: ThePlaidApi::UserAccountIdentityAddress

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

Overview

The user’s address.

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

Returns a new instance of UserAccountIdentityAddress.



75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/the_plaid_api/models/user_account_identity_address.rb', line 75

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

  @city = city unless city == SKIP
  @region = region unless region == SKIP
  @street = street unless street == SKIP
  @street2 = street2 unless street2 == SKIP
  @postal_code = postal_code unless postal_code == SKIP
  @country = country unless country == 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/user_account_identity_address.rb', line 14

def city
  @city
end

#countryString

The ISO 3166-1 alpha-2 country code

Returns:

  • (String)


37
38
39
# File 'lib/the_plaid_api/models/user_account_identity_address.rb', line 37

def country
  @country
end

#postal_codeString

The postal code. In API versions 2018-05-22 and earlier, this field is called ‘zip`.

Returns:

  • (String)


33
34
35
# File 'lib/the_plaid_api/models/user_account_identity_address.rb', line 33

def postal_code
  @postal_code
end

#regionString

The region or state. Example: ‘“NC”`

Returns:

  • (String)


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

def region
  @region
end

#streetString

The full street address Example: ‘“564 Main Street, APT 15”`

Returns:

  • (String)


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

def street
  @street
end

#street2String

The second line street address

Returns:

  • (String)


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

def street2
  @street2
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/the_plaid_api/models/user_account_identity_address.rb', line 90

def self.from_hash(hash)
  return nil unless hash

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

.namesObject

A mapping from model property names to API property names.



40
41
42
43
44
45
46
47
48
49
# File 'lib/the_plaid_api/models/user_account_identity_address.rb', line 40

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

.nullablesObject

An array for nullable fields



64
65
66
67
68
69
70
71
72
73
# File 'lib/the_plaid_api/models/user_account_identity_address.rb', line 64

def self.nullables
  %w[
    city
    region
    street
    street2
    postal_code
    country
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    city
    region
    street
    street2
    postal_code
    country
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



127
128
129
130
131
132
# File 'lib/the_plaid_api/models/user_account_identity_address.rb', line 127

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} city: #{@city.inspect}, region: #{@region.inspect}, street:"\
  " #{@street.inspect}, street2: #{@street2.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.



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

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