Class: ThePlaidApi::ClientUserIdentityAddress

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

Overview

User address information.

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(country:, primary:, street_1: SKIP, street_2: SKIP, city: SKIP, region: SKIP, postal_code: SKIP, additional_properties: nil) ⇒ ClientUserIdentityAddress

Returns a new instance of ClientUserIdentityAddress.



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

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

  @street_1 = street_1 unless street_1 == SKIP
  @street_2 = street_2 unless street_2 == SKIP
  @city = city unless city == SKIP
  @region = region unless region == SKIP
  @country = country
  @postal_code = postal_code unless postal_code == SKIP
  @primary = primary
  @additional_properties = additional_properties
end

Instance Attribute Details

#cityString

City name.

Returns:

  • (String)


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

def city
  @city
end

#countryString

Country code.

Returns:

  • (String)


30
31
32
# File 'lib/the_plaid_api/models/client_user_identity_address.rb', line 30

def country
  @country
end

#postal_codeString

Postal or ZIP code.

Returns:

  • (String)


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

def postal_code
  @postal_code
end

#primaryTrueClass | FalseClass

Indicates whether this is the primary address for the User.

Returns:

  • (TrueClass | FalseClass)


38
39
40
# File 'lib/the_plaid_api/models/client_user_identity_address.rb', line 38

def primary
  @primary
end

#regionString

State, province or region.

Returns:

  • (String)


26
27
28
# File 'lib/the_plaid_api/models/client_user_identity_address.rb', line 26

def region
  @region
end

#street_1String

First line of street address.

Returns:

  • (String)


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

def street_1
  @street_1
end

#street_2String

Second line of street address.

Returns:

  • (String)


18
19
20
# File 'lib/the_plaid_api/models/client_user_identity_address.rb', line 18

def street_2
  @street_2
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
117
118
119
120
# File 'lib/the_plaid_api/models/client_user_identity_address.rb', line 92

def self.from_hash(hash)
  return nil unless hash

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

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



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

def self.nullables
  %w[
    street_1
    street_2
    city
    region
    postal_code
  ]
end

.optionalsObject

An array for optional fields



54
55
56
57
58
59
60
61
62
# File 'lib/the_plaid_api/models/client_user_identity_address.rb', line 54

def self.optionals
  %w[
    street_1
    street_2
    city
    region
    postal_code
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



131
132
133
134
135
136
137
# File 'lib/the_plaid_api/models/client_user_identity_address.rb', line 131

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

#to_sObject

Provides a human-readable string representation of the object.



123
124
125
126
127
128
# File 'lib/the_plaid_api/models/client_user_identity_address.rb', line 123

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