Class: FdxV660Api::EmployerEntity
- Defined in:
- lib/fdx_v660_api/models/employer_entity.rb
Overview
Represents an employer
Instance Attribute Summary collapse
-
#contacts ⇒ ContactsEntity1
Employer's various contact information.
-
#dbas ⇒ Array[String]
Array of Doing Business As names for this employer.
-
#employer_id ⇒ String
Provider's long-term persistent id for the employer.
-
#name ⇒ BusinessName2
The employer's name.
-
#tax_id ⇒ String
Country specific Tax Id associated with this employer (FEIN in USA or BN in Canada).
-
#tax_id_country ⇒ Iso3166CountryCode4
Country originating the employer's taxId element.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(name:, employer_id: SKIP, dbas: SKIP, tax_id: SKIP, tax_id_country: SKIP, contacts: SKIP, additional_properties: nil) ⇒ EmployerEntity
constructor
A new instance of EmployerEntity.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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) ⇒ EmployerEntity
Returns a new instance of EmployerEntity.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/fdx_v660_api/models/employer_entity.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
#contacts ⇒ ContactsEntity1
Employer's various contact information
35 36 37 |
# File 'lib/fdx_v660_api/models/employer_entity.rb', line 35 def contacts @contacts end |
#dbas ⇒ Array[String]
Array of Doing Business As names for this employer
22 23 24 |
# File 'lib/fdx_v660_api/models/employer_entity.rb', line 22 def dbas @dbas end |
#employer_id ⇒ String
Provider's long-term persistent id for the employer
14 15 16 |
# File 'lib/fdx_v660_api/models/employer_entity.rb', line 14 def employer_id @employer_id end |
#name ⇒ BusinessName2
The employer's name
18 19 20 |
# File 'lib/fdx_v660_api/models/employer_entity.rb', line 18 def name @name end |
#tax_id ⇒ String
Country specific Tax Id associated with this employer (FEIN in USA or BN in Canada)
27 28 29 |
# File 'lib/fdx_v660_api/models/employer_entity.rb', line 27 def tax_id @tax_id end |
#tax_id_country ⇒ Iso3166CountryCode4
Country originating the employer's taxId element
31 32 33 |
# File 'lib/fdx_v660_api/models/employer_entity.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_entity.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. EmployerEntity.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 |
.names ⇒ Object
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_entity.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 |
.nullables ⇒ Object
An array for nullable fields
61 62 63 |
# File 'lib/fdx_v660_api/models/employer_entity.rb', line 61 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
50 51 52 53 54 55 56 57 58 |
# File 'lib/fdx_v660_api/models/employer_entity.rb', line 50 def self.optionals %w[ employer_id dbas tax_id tax_id_country contacts ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
118 119 120 121 122 123 |
# File 'lib/fdx_v660_api/models/employer_entity.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_s ⇒ Object
Provides a human-readable string representation of the object.
110 111 112 113 114 115 |
# File 'lib/fdx_v660_api/models/employer_entity.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 |