Class: TqlOtrFactoringDataExchange::CarrierInput
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- TqlOtrFactoringDataExchange::CarrierInput
- Defined in:
- lib/tql_otr_factoring_data_exchange/models/carrier_input.rb
Overview
CarrierInput Model.
Instance Attribute Summary collapse
-
#carrier_name ⇒ String
Legal or DBA name of the carrier.
-
#dot_number ⇒ String
USDOT number issued by [FMCSA](www.fmcsa.dot.gov/).
-
#mc_number ⇒ String
Motor Carrier (MC) number issued by [FMCSA](www.fmcsa.dot.gov/).
-
#scac ⇒ String
Standard Carrier Alpha Code ([SCAC](nmfta.org/registration-listing/scac/)).
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(mc_number:, carrier_name: SKIP, dot_number: SKIP, scac: SKIP, additional_properties: nil) ⇒ CarrierInput
constructor
A new instance of CarrierInput.
-
#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(mc_number:, carrier_name: SKIP, dot_number: SKIP, scac: SKIP, additional_properties: nil) ⇒ CarrierInput
Returns a new instance of CarrierInput.
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/tql_otr_factoring_data_exchange/models/carrier_input.rb', line 57 def initialize(mc_number:, carrier_name: SKIP, dot_number: SKIP, scac: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @carrier_name = carrier_name unless carrier_name == SKIP @mc_number = mc_number @dot_number = dot_number unless dot_number == SKIP @scac = scac unless scac == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#carrier_name ⇒ String
Legal or DBA name of the carrier.
14 15 16 |
# File 'lib/tql_otr_factoring_data_exchange/models/carrier_input.rb', line 14 def carrier_name @carrier_name end |
#dot_number ⇒ String
USDOT number issued by [FMCSA](www.fmcsa.dot.gov/).
22 23 24 |
# File 'lib/tql_otr_factoring_data_exchange/models/carrier_input.rb', line 22 def dot_number @dot_number end |
#mc_number ⇒ String
Motor Carrier (MC) number issued by [FMCSA](www.fmcsa.dot.gov/).
18 19 20 |
# File 'lib/tql_otr_factoring_data_exchange/models/carrier_input.rb', line 18 def mc_number @mc_number end |
#scac ⇒ String
Standard Carrier Alpha Code ([SCAC](nmfta.org/registration-listing/scac/)).
27 28 29 |
# File 'lib/tql_otr_factoring_data_exchange/models/carrier_input.rb', line 27 def scac @scac end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/tql_otr_factoring_data_exchange/models/carrier_input.rb', line 70 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. mc_number = hash.key?('mcNumber') ? hash['mcNumber'] : nil carrier_name = hash.key?('carrierName') ? hash['carrierName'] : SKIP dot_number = hash.key?('dotNumber') ? hash['dotNumber'] : SKIP scac = hash.key?('scac') ? hash['scac'] : 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. CarrierInput.new(mc_number: mc_number, carrier_name: carrier_name, dot_number: dot_number, scac: scac, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
30 31 32 33 34 35 36 37 |
# File 'lib/tql_otr_factoring_data_exchange/models/carrier_input.rb', line 30 def self.names @_hash = {} if @_hash.nil? @_hash['carrier_name'] = 'carrierName' @_hash['mc_number'] = 'mcNumber' @_hash['dot_number'] = 'dotNumber' @_hash['scac'] = 'scac' @_hash end |
.nullables ⇒ Object
An array for nullable fields
49 50 51 52 53 54 55 |
# File 'lib/tql_otr_factoring_data_exchange/models/carrier_input.rb', line 49 def self.nullables %w[ mc_number dot_number scac ] end |
.optionals ⇒ Object
An array for optional fields
40 41 42 43 44 45 46 |
# File 'lib/tql_otr_factoring_data_exchange/models/carrier_input.rb', line 40 def self.optionals %w[ carrier_name dot_number scac ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/tql_otr_factoring_data_exchange/models/carrier_input.rb', line 96 def self.validate(value) if value.instance_of? self return APIHelper.valid_type?(value.mc_number, ->(val) { val.instance_of? String }) end return false unless value.instance_of? Hash APIHelper.valid_type?(value['mcNumber'], ->(val) { val.instance_of? String }) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
116 117 118 119 120 121 |
# File 'lib/tql_otr_factoring_data_exchange/models/carrier_input.rb', line 116 def inspect class_name = self.class.name.split('::').last "<#{class_name} carrier_name: #{@carrier_name.inspect}, mc_number: #{@mc_number.inspect},"\ " dot_number: #{@dot_number.inspect}, scac: #{@scac.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
109 110 111 112 113 |
# File 'lib/tql_otr_factoring_data_exchange/models/carrier_input.rb', line 109 def to_s class_name = self.class.name.split('::').last "<#{class_name} carrier_name: #{@carrier_name}, mc_number: #{@mc_number}, dot_number:"\ " #{@dot_number}, scac: #{@scac}, additional_properties: #{@additional_properties}>" end |