Class: UspsApi::SubscriptionsNcoaChangeOfAddressDetailFields2

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/usps_api/models/subscriptions_ncoa_change_of_address_detail_fields2.rb

Overview

Name or Business Name pertaining to 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(first_name: SKIP, middle_inital: SKIP, last_name: SKIP, business_name: SKIP) ⇒ SubscriptionsNcoaChangeOfAddressDetailFields2

Returns a new instance of SubscriptionsNcoaChangeOfAddressDetailFields2.



53
54
55
56
57
58
59
# File 'lib/usps_api/models/subscriptions_ncoa_change_of_address_detail_fields2.rb', line 53

def initialize(first_name: SKIP, middle_inital: SKIP, last_name: SKIP,
               business_name: SKIP)
  @first_name = first_name unless first_name == SKIP
  @middle_inital = middle_inital unless middle_inital == SKIP
  @last_name = last_name unless last_name == SKIP
  @business_name = business_name unless business_name == SKIP
end

Instance Attribute Details

#business_nameString

Business Name.

Returns:

  • (String)


26
27
28
# File 'lib/usps_api/models/subscriptions_ncoa_change_of_address_detail_fields2.rb', line 26

def business_name
  @business_name
end

#first_nameString

First Name.

Returns:

  • (String)


14
15
16
# File 'lib/usps_api/models/subscriptions_ncoa_change_of_address_detail_fields2.rb', line 14

def first_name
  @first_name
end

#last_nameString

Last Name.

Returns:

  • (String)


22
23
24
# File 'lib/usps_api/models/subscriptions_ncoa_change_of_address_detail_fields2.rb', line 22

def last_name
  @last_name
end

#middle_initalString

Middle Initial.

Returns:

  • (String)


18
19
20
# File 'lib/usps_api/models/subscriptions_ncoa_change_of_address_detail_fields2.rb', line 18

def middle_inital
  @middle_inital
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/usps_api/models/subscriptions_ncoa_change_of_address_detail_fields2.rb', line 62

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  first_name = hash.key?('firstName') ? hash['firstName'] : SKIP
  middle_inital = hash.key?('middleInital') ? hash['middleInital'] : SKIP
  last_name = hash.key?('lastName') ? hash['lastName'] : SKIP
  business_name = hash.key?('businessName') ? hash['businessName'] : SKIP

  # Create object from extracted values.
  SubscriptionsNcoaChangeOfAddressDetailFields2.new(first_name: first_name,
                                                    middle_inital: middle_inital,
                                                    last_name: last_name,
                                                    business_name: business_name)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
36
# File 'lib/usps_api/models/subscriptions_ncoa_change_of_address_detail_fields2.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['first_name'] = 'firstName'
  @_hash['middle_inital'] = 'middleInital'
  @_hash['last_name'] = 'lastName'
  @_hash['business_name'] = 'businessName'
  @_hash
end

.nullablesObject

An array for nullable fields



49
50
51
# File 'lib/usps_api/models/subscriptions_ncoa_change_of_address_detail_fields2.rb', line 49

def self.nullables
  []
end

.optionalsObject

An array for optional fields



39
40
41
42
43
44
45
46
# File 'lib/usps_api/models/subscriptions_ncoa_change_of_address_detail_fields2.rb', line 39

def self.optionals
  %w[
    first_name
    middle_inital
    last_name
    business_name
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



86
87
88
89
90
91
# File 'lib/usps_api/models/subscriptions_ncoa_change_of_address_detail_fields2.rb', line 86

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} first_name: #{@first_name.inspect}, middle_inital:"\
  " #{@middle_inital.inspect}, last_name: #{@last_name.inspect}, business_name:"\
  " #{@business_name.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



79
80
81
82
83
# File 'lib/usps_api/models/subscriptions_ncoa_change_of_address_detail_fields2.rb', line 79

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} first_name: #{@first_name}, middle_inital: #{@middle_inital}, last_name:"\
  " #{@last_name}, business_name: #{@business_name}>"
end