Class: FdxV660Api::TaxParty1

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/fdx_v660_api/models/tax_party1.rb

Overview

Recipient's name, address, phone, and TIN. Recipient data need only be transmitted on enclosing TaxStatement, if it is the same on all its included tax forms.

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(tin: SKIP, party_type: SKIP, individual_name: SKIP, business_name: SKIP, address: SKIP, phone: SKIP, email: SKIP, additional_properties: nil) ⇒ TaxParty1

Returns a new instance of TaxParty1.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/fdx_v660_api/models/tax_party1.rb', line 78

def initialize(tin: SKIP, party_type: SKIP, individual_name: SKIP,
               business_name: SKIP, address: SKIP, phone: SKIP, email: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @tin = tin unless tin == SKIP
  @party_type = party_type unless party_type == SKIP
  @individual_name = individual_name unless individual_name == SKIP
  @business_name = business_name unless business_name == SKIP
  @address = address unless address == SKIP
  @phone = phone unless phone == SKIP
  @email = email unless email == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#addressTaxFormAddress5

Issuer or recipient address

Returns:



36
37
38
# File 'lib/fdx_v660_api/models/tax_party1.rb', line 36

def address
  @address
end

#business_nameBusinessName4

Business issuer or recipient name

Returns:



32
33
34
# File 'lib/fdx_v660_api/models/tax_party1.rb', line 32

def business_name
  @business_name
end

#emailString

Issuer or recipient email address. (Additional information, not part of IRS forms)

Returns:

  • (String)


45
46
47
# File 'lib/fdx_v660_api/models/tax_party1.rb', line 45

def email
  @email
end

#individual_nameIndividualName4

Individual issuer or recipient name

Returns:



28
29
30
# File 'lib/fdx_v660_api/models/tax_party1.rb', line 28

def individual_name
  @individual_name
end

#party_typeTaxPartyType2

Type of issuer or recipient legal entity, as "BUSINESS" or "INDIVIDUAL". Commonly BUSINESS for issuer and INDIVIDUAL for recipient

Returns:



24
25
26
# File 'lib/fdx_v660_api/models/tax_party1.rb', line 24

def party_type
  @party_type
end

#phoneTelephoneNumberPlusExtension1

Issuer or recipient telephone number



40
41
42
# File 'lib/fdx_v660_api/models/tax_party1.rb', line 40

def phone
  @phone
end

#tinString

Issuer or recipient Tax Identification Number. The issuer TIN should normally not be truncated or masked. The recipient TIN may be truncated or masked on this recipient copy (though the full TIN will be filed on IRS copy). Usually EIN for issuer and SSN for recipient

Returns:

  • (String)


19
20
21
# File 'lib/fdx_v660_api/models/tax_party1.rb', line 19

def tin
  @tin
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
121
122
123
124
# File 'lib/fdx_v660_api/models/tax_party1.rb', line 95

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  tin = hash.key?('tin') ? hash['tin'] : SKIP
  party_type = hash.key?('partyType') ? hash['partyType'] : SKIP
  individual_name = IndividualName4.from_hash(hash['individualName']) if
    hash['individualName']
  business_name = BusinessName4.from_hash(hash['businessName']) if hash['businessName']
  address = TaxFormAddress5.from_hash(hash['address']) if hash['address']
  phone = TelephoneNumberPlusExtension1.from_hash(hash['phone']) if hash['phone']
  email = hash.key?('email') ? hash['email'] : 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.
  TaxParty1.new(tin: tin,
                party_type: party_type,
                individual_name: individual_name,
                business_name: business_name,
                address: address,
                phone: phone,
                email: email,
                additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/fdx_v660_api/models/tax_party1.rb', line 48

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['tin'] = 'tin'
  @_hash['party_type'] = 'partyType'
  @_hash['individual_name'] = 'individualName'
  @_hash['business_name'] = 'businessName'
  @_hash['address'] = 'address'
  @_hash['phone'] = 'phone'
  @_hash['email'] = 'email'
  @_hash
end

.nullablesObject

An array for nullable fields



74
75
76
# File 'lib/fdx_v660_api/models/tax_party1.rb', line 74

def self.nullables
  []
end

.optionalsObject

An array for optional fields



61
62
63
64
65
66
67
68
69
70
71
# File 'lib/fdx_v660_api/models/tax_party1.rb', line 61

def self.optionals
  %w[
    tin
    party_type
    individual_name
    business_name
    address
    phone
    email
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



135
136
137
138
139
140
141
# File 'lib/fdx_v660_api/models/tax_party1.rb', line 135

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} tin: #{@tin.inspect}, party_type: #{@party_type.inspect}, individual_name:"\
  " #{@individual_name.inspect}, business_name: #{@business_name.inspect}, address:"\
  " #{@address.inspect}, phone: #{@phone.inspect}, email: #{@email.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} tin: #{@tin}, party_type: #{@party_type}, individual_name:"\
  " #{@individual_name}, business_name: #{@business_name}, address: #{@address}, phone:"\
  " #{@phone}, email: #{@email}, additional_properties: #{@additional_properties}>"
end