Class: FdxV660Api::EmployerEntity1

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

Overview

The employer for the job/position

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(name:, employer_id: SKIP, dbas: SKIP, tax_id: SKIP, tax_id_country: SKIP, contacts: SKIP, additional_properties: nil) ⇒ EmployerEntity1

Returns a new instance of EmployerEntity1.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/fdx_v660_api/models/employer_entity1.rb', line 65

def initialize(name:, employer_id: SKIP, dbas: SKIP, tax_id: SKIP,
               tax_id_country: SKIP, contacts: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @employer_id = employer_id unless employer_id == SKIP
  @name = name
  @dbas = dbas unless dbas == SKIP
  @tax_id = tax_id unless tax_id == SKIP
  @tax_id_country = tax_id_country unless tax_id_country == SKIP
  @contacts = contacts unless contacts == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#contactsContactsEntity1

Employer's various contact information

Returns:



35
36
37
# File 'lib/fdx_v660_api/models/employer_entity1.rb', line 35

def contacts
  @contacts
end

#dbasArray[String]

Array of Doing Business As names for this employer

Returns:

  • (Array[String])


22
23
24
# File 'lib/fdx_v660_api/models/employer_entity1.rb', line 22

def dbas
  @dbas
end

#employer_idString

Provider's long-term persistent id for the employer

Returns:

  • (String)


14
15
16
# File 'lib/fdx_v660_api/models/employer_entity1.rb', line 14

def employer_id
  @employer_id
end

#nameBusinessName2

The employer's name

Returns:



18
19
20
# File 'lib/fdx_v660_api/models/employer_entity1.rb', line 18

def name
  @name
end

#tax_idString

Country specific Tax Id associated with this employer (FEIN in USA or BN in Canada)

Returns:

  • (String)


27
28
29
# File 'lib/fdx_v660_api/models/employer_entity1.rb', line 27

def tax_id
  @tax_id
end

#tax_id_countryIso3166CountryCode4

Country originating the employer's taxId element

Returns:



31
32
33
# File 'lib/fdx_v660_api/models/employer_entity1.rb', line 31

def tax_id_country
  @tax_id_country
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/fdx_v660_api/models/employer_entity1.rb', line 81

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = BusinessName2.from_hash(hash['name']) if hash['name']
  employer_id = hash.key?('employerId') ? hash['employerId'] : SKIP
  dbas = hash.key?('dbas') ? hash['dbas'] : SKIP
  tax_id = hash.key?('taxId') ? hash['taxId'] : SKIP
  tax_id_country = hash.key?('taxIdCountry') ? hash['taxIdCountry'] : SKIP
  contacts = ContactsEntity1.from_hash(hash['contacts']) if hash['contacts']

  # 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.
  EmployerEntity1.new(name: name,
                      employer_id: employer_id,
                      dbas: dbas,
                      tax_id: tax_id,
                      tax_id_country: tax_id_country,
                      contacts: contacts,
                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
45
46
47
# File 'lib/fdx_v660_api/models/employer_entity1.rb', line 38

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['employer_id'] = 'employerId'
  @_hash['name'] = 'name'
  @_hash['dbas'] = 'dbas'
  @_hash['tax_id'] = 'taxId'
  @_hash['tax_id_country'] = 'taxIdCountry'
  @_hash['contacts'] = 'contacts'
  @_hash
end

.nullablesObject

An array for nullable fields



61
62
63
# File 'lib/fdx_v660_api/models/employer_entity1.rb', line 61

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    employer_id
    dbas
    tax_id
    tax_id_country
    contacts
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



118
119
120
121
122
123
# File 'lib/fdx_v660_api/models/employer_entity1.rb', line 118

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} employer_id: #{@employer_id.inspect}, name: #{@name.inspect}, dbas:"\
  " #{@dbas.inspect}, tax_id: #{@tax_id.inspect}, tax_id_country: #{@tax_id_country.inspect},"\
  " contacts: #{@contacts.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} employer_id: #{@employer_id}, name: #{@name}, dbas: #{@dbas}, tax_id:"\
  " #{@tax_id}, tax_id_country: #{@tax_id_country}, contacts: #{@contacts},"\
  " additional_properties: #{@additional_properties}>"
end