Class: FreightFinancialsWebhookIngestionApi::Carrier
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- FreightFinancialsWebhookIngestionApi::Carrier
- Defined in:
- lib/freight_financials_webhook_ingestion_api/models/carrier.rb
Overview
Carrier Model.
Instance Attribute Summary collapse
-
#carrier_name ⇒ String
TODO: Write general description for this method.
-
#dot_number ⇒ String
TODO: Write general description for this method.
-
#mc_number ⇒ String
TODO: Write general description for this method.
-
#scac ⇒ String
TODO: Write general description for this method.
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(carrier_name: SKIP, dot_number: SKIP, mc_number: SKIP, scac: SKIP) ⇒ Carrier
constructor
A new instance of Carrier.
-
#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(carrier_name: SKIP, dot_number: SKIP, mc_number: SKIP, scac: SKIP) ⇒ Carrier
Returns a new instance of Carrier.
57 58 59 60 61 62 63 |
# File 'lib/freight_financials_webhook_ingestion_api/models/carrier.rb', line 57 def initialize(carrier_name: SKIP, dot_number: SKIP, mc_number: SKIP, scac: SKIP) @carrier_name = carrier_name unless carrier_name == SKIP @dot_number = dot_number unless dot_number == SKIP @mc_number = mc_number unless mc_number == SKIP @scac = scac unless scac == SKIP end |
Instance Attribute Details
#carrier_name ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/freight_financials_webhook_ingestion_api/models/carrier.rb', line 14 def carrier_name @carrier_name end |
#dot_number ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/freight_financials_webhook_ingestion_api/models/carrier.rb', line 18 def dot_number @dot_number end |
#mc_number ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/freight_financials_webhook_ingestion_api/models/carrier.rb', line 22 def mc_number @mc_number end |
#scac ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/freight_financials_webhook_ingestion_api/models/carrier.rb', line 26 def scac @scac end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/freight_financials_webhook_ingestion_api/models/carrier.rb', line 66 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. carrier_name = hash.key?('carrierName') ? hash['carrierName'] : SKIP dot_number = hash.key?('dotNumber') ? hash['dotNumber'] : SKIP mc_number = hash.key?('mcNumber') ? hash['mcNumber'] : SKIP scac = hash.key?('scac') ? hash['scac'] : SKIP # Create object from extracted values. Carrier.new(carrier_name: carrier_name, dot_number: dot_number, mc_number: mc_number, scac: scac) end |
.names ⇒ Object
A mapping from model property names to API property names.
29 30 31 32 33 34 35 36 |
# File 'lib/freight_financials_webhook_ingestion_api/models/carrier.rb', line 29 def self.names @_hash = {} if @_hash.nil? @_hash['carrier_name'] = 'carrierName' @_hash['dot_number'] = 'dotNumber' @_hash['mc_number'] = 'mcNumber' @_hash['scac'] = 'scac' @_hash end |
.nullables ⇒ Object
An array for nullable fields
49 50 51 52 53 54 55 |
# File 'lib/freight_financials_webhook_ingestion_api/models/carrier.rb', line 49 def self.nullables %w[ dot_number mc_number scac ] end |
.optionals ⇒ Object
An array for optional fields
39 40 41 42 43 44 45 46 |
# File 'lib/freight_financials_webhook_ingestion_api/models/carrier.rb', line 39 def self.optionals %w[ carrier_name dot_number mc_number scac ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
90 91 92 93 94 |
# File 'lib/freight_financials_webhook_ingestion_api/models/carrier.rb', line 90 def inspect class_name = self.class.name.split('::').last "<#{class_name} carrier_name: #{@carrier_name.inspect}, dot_number: #{@dot_number.inspect},"\ " mc_number: #{@mc_number.inspect}, scac: #{@scac.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
83 84 85 86 87 |
# File 'lib/freight_financials_webhook_ingestion_api/models/carrier.rb', line 83 def to_s class_name = self.class.name.split('::').last "<#{class_name} carrier_name: #{@carrier_name}, dot_number: #{@dot_number}, mc_number:"\ " #{@mc_number}, scac: #{@scac}>" end |