Class: FreightFinancialsWebhookIngestionApi::LoadResponseData

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/freight_financials_webhook_ingestion_api/models/load_response_data.rb

Overview

LoadResponseData Model.

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(bol_number: SKIP, carrier: SKIP, delivery_date: SKIP, load_number: SKIP, pro_number: SKIP, ship_date: SKIP, status: SKIP, additional_properties: nil) ⇒ LoadResponseData

Returns a new instance of LoadResponseData.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/freight_financials_webhook_ingestion_api/models/load_response_data.rb', line 77

def initialize(bol_number: SKIP, carrier: SKIP, delivery_date: SKIP,
               load_number: SKIP, pro_number: SKIP, ship_date: SKIP,
               status: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @bol_number = bol_number unless bol_number == SKIP
  @carrier = carrier unless carrier == SKIP
  @delivery_date = delivery_date unless delivery_date == SKIP
  @load_number = load_number unless load_number == SKIP
  @pro_number = pro_number unless pro_number == SKIP
  @ship_date = ship_date unless ship_date == SKIP
  @status = status unless status == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#bol_numberString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/freight_financials_webhook_ingestion_api/models/load_response_data.rb', line 14

def bol_number
  @bol_number
end

#carrierCarrier

TODO: Write general description for this method

Returns:



18
19
20
# File 'lib/freight_financials_webhook_ingestion_api/models/load_response_data.rb', line 18

def carrier
  @carrier
end

#delivery_dateDate

TODO: Write general description for this method

Returns:

  • (Date)


22
23
24
# File 'lib/freight_financials_webhook_ingestion_api/models/load_response_data.rb', line 22

def delivery_date
  @delivery_date
end

#load_numberString

TODO: Write general description for this method

Returns:

  • (String)


26
27
28
# File 'lib/freight_financials_webhook_ingestion_api/models/load_response_data.rb', line 26

def load_number
  @load_number
end

#pro_numberString

TODO: Write general description for this method

Returns:

  • (String)


30
31
32
# File 'lib/freight_financials_webhook_ingestion_api/models/load_response_data.rb', line 30

def pro_number
  @pro_number
end

#ship_dateDate

TODO: Write general description for this method

Returns:

  • (Date)


34
35
36
# File 'lib/freight_financials_webhook_ingestion_api/models/load_response_data.rb', line 34

def ship_date
  @ship_date
end

#statusInteger

TODO: Write general description for this method

Returns:

  • (Integer)


38
39
40
# File 'lib/freight_financials_webhook_ingestion_api/models/load_response_data.rb', line 38

def status
  @status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/freight_financials_webhook_ingestion_api/models/load_response_data.rb', line 94

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  bol_number = hash.key?('bolNumber') ? hash['bolNumber'] : SKIP
  carrier = Carrier.from_hash(hash['carrier']) if hash['carrier']
  delivery_date = hash.key?('deliveryDate') ? hash['deliveryDate'] : SKIP
  load_number = hash.key?('loadNumber') ? hash['loadNumber'] : SKIP
  pro_number = hash.key?('proNumber') ? hash['proNumber'] : SKIP
  ship_date = hash.key?('shipDate') ? hash['shipDate'] : SKIP
  status = hash.key?('status') ? hash['status'] : 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.
  LoadResponseData.new(bol_number: bol_number,
                       carrier: carrier,
                       delivery_date: delivery_date,
                       load_number: load_number,
                       pro_number: pro_number,
                       ship_date: ship_date,
                       status: status,
                       additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/freight_financials_webhook_ingestion_api/models/load_response_data.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['bol_number'] = 'bolNumber'
  @_hash['carrier'] = 'carrier'
  @_hash['delivery_date'] = 'deliveryDate'
  @_hash['load_number'] = 'loadNumber'
  @_hash['pro_number'] = 'proNumber'
  @_hash['ship_date'] = 'shipDate'
  @_hash['status'] = 'status'
  @_hash
end

.nullablesObject

An array for nullable fields



67
68
69
70
71
72
73
74
75
# File 'lib/freight_financials_webhook_ingestion_api/models/load_response_data.rb', line 67

def self.nullables
  %w[
    bol_number
    carrier
    delivery_date
    pro_number
    ship_date
  ]
end

.optionalsObject

An array for optional fields



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/freight_financials_webhook_ingestion_api/models/load_response_data.rb', line 54

def self.optionals
  %w[
    bol_number
    carrier
    delivery_date
    load_number
    pro_number
    ship_date
    status
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



133
134
135
136
137
138
139
# File 'lib/freight_financials_webhook_ingestion_api/models/load_response_data.rb', line 133

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} bol_number: #{@bol_number.inspect}, carrier: #{@carrier.inspect},"\
  " delivery_date: #{@delivery_date.inspect}, load_number: #{@load_number.inspect},"\
  " pro_number: #{@pro_number.inspect}, ship_date: #{@ship_date.inspect}, status:"\
  " #{@status.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



125
126
127
128
129
130
# File 'lib/freight_financials_webhook_ingestion_api/models/load_response_data.rb', line 125

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} bol_number: #{@bol_number}, carrier: #{@carrier}, delivery_date:"\
  " #{@delivery_date}, load_number: #{@load_number}, pro_number: #{@pro_number}, ship_date:"\
  " #{@ship_date}, status: #{@status}, additional_properties: #{@additional_properties}>"
end