Class: TqlOtrFactoringDataExchange::Carrier1

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/tql_otr_factoring_data_exchange/models/carrier1.rb

Overview

Carrier that was assigned/unassigned.

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(carrier_name: SKIP, mc_number: SKIP, dot_number: SKIP, additional_properties: nil) ⇒ Carrier1

Returns a new instance of Carrier1.



50
51
52
53
54
55
56
57
58
59
# File 'lib/tql_otr_factoring_data_exchange/models/carrier1.rb', line 50

def initialize(carrier_name: SKIP, mc_number: SKIP, dot_number: 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 unless mc_number == SKIP
  @dot_number = dot_number unless dot_number == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#carrier_nameString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/tql_otr_factoring_data_exchange/models/carrier1.rb', line 14

def carrier_name
  @carrier_name
end

#dot_numberString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/tql_otr_factoring_data_exchange/models/carrier1.rb', line 22

def dot_number
  @dot_number
end

#mc_numberString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/tql_otr_factoring_data_exchange/models/carrier1.rb', line 18

def mc_number
  @mc_number
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/tql_otr_factoring_data_exchange/models/carrier1.rb', line 62

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  carrier_name = hash.key?('carrierName') ? hash['carrierName'] : SKIP
  mc_number = hash.key?('mcNumber') ? hash['mcNumber'] : SKIP
  dot_number = hash.key?('dotNumber') ? hash['dotNumber'] : 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.
  Carrier1.new(carrier_name: carrier_name,
               mc_number: mc_number,
               dot_number: dot_number,
               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
31
# File 'lib/tql_otr_factoring_data_exchange/models/carrier1.rb', line 25

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['carrier_name'] = 'carrierName'
  @_hash['mc_number'] = 'mcNumber'
  @_hash['dot_number'] = 'dotNumber'
  @_hash
end

.nullablesObject

An array for nullable fields



43
44
45
46
47
48
# File 'lib/tql_otr_factoring_data_exchange/models/carrier1.rb', line 43

def self.nullables
  %w[
    mc_number
    dot_number
  ]
end

.optionalsObject

An array for optional fields



34
35
36
37
38
39
40
# File 'lib/tql_otr_factoring_data_exchange/models/carrier1.rb', line 34

def self.optionals
  %w[
    carrier_name
    mc_number
    dot_number
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



92
93
94
95
96
# File 'lib/tql_otr_factoring_data_exchange/models/carrier1.rb', line 92

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}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



85
86
87
88
89
# File 'lib/tql_otr_factoring_data_exchange/models/carrier1.rb', line 85

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} carrier_name: #{@carrier_name}, mc_number: #{@mc_number}, dot_number:"\
  " #{@dot_number}, additional_properties: #{@additional_properties}>"
end