Class: ThePlaidApi::ServicerAddressData

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

Overview

The address of the student loan servicer. This is generally the remittance address to which payments should be sent.

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

Returns a new instance of ServicerAddressData.



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

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

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

Instance Attribute Details

#cityString

The full city name

Returns:

  • (String)


15
16
17
# File 'lib/the_plaid_api/models/servicer_address_data.rb', line 15

def city
  @city
end

#countryString

The ISO 3166-1 alpha-2 country code

Returns:

  • (String)


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

def country
  @country
end

#postal_codeString

The postal code

Returns:

  • (String)


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

def postal_code
  @postal_code
end

#regionString

The region or state Example: ‘“NC”`

Returns:

  • (String)


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

def region
  @region
end

#streetString

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

Returns:

  • (String)


25
26
27
# File 'lib/the_plaid_api/models/servicer_address_data.rb', line 25

def street
  @street
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/the_plaid_api/models/servicer_address_data.rb', line 76

def self.from_hash(hash)
  return nil unless hash

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

.namesObject

A mapping from model property names to API property names.



36
37
38
39
40
41
42
43
44
# File 'lib/the_plaid_api/models/servicer_address_data.rb', line 36

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

.nullablesObject

An array for nullable fields



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

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

.optionalsObject

An array for optional fields



47
48
49
# File 'lib/the_plaid_api/models/servicer_address_data.rb', line 47

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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



103
104
105
106
107
# File 'lib/the_plaid_api/models/servicer_address_data.rb', line 103

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