Class: FreightFinancialsWebhookIngestionApi::LoadSlim

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

Overview

LoadSlim 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(delivery_date: SKIP, load_number: SKIP, pickup_date: SKIP, status: SKIP) ⇒ LoadSlim

Returns a new instance of LoadSlim.



57
58
59
60
61
62
63
# File 'lib/freight_financials_webhook_ingestion_api/models/load_slim.rb', line 57

def initialize(delivery_date: SKIP, load_number: SKIP, pickup_date: SKIP,
               status: SKIP)
  @delivery_date = delivery_date unless delivery_date == SKIP
  @load_number = load_number unless load_number == SKIP
  @pickup_date = pickup_date unless pickup_date == SKIP
  @status = status unless status == SKIP
end

Instance Attribute Details

#delivery_dateDate

TODO: Write general description for this method

Returns:

  • (Date)


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

def delivery_date
  @delivery_date
end

#load_numberString

TODO: Write general description for this method

Returns:

  • (String)


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

def load_number
  @load_number
end

#pickup_dateDate

TODO: Write general description for this method

Returns:

  • (Date)


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

def pickup_date
  @pickup_date
end

#statusString

TODO: Write general description for this method

Returns:

  • (String)


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

def status
  @status
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/load_slim.rb', line 66

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  delivery_date = hash.key?('deliveryDate') ? hash['deliveryDate'] : SKIP
  load_number = hash.key?('loadNumber') ? hash['loadNumber'] : SKIP
  pickup_date = hash.key?('pickupDate') ? hash['pickupDate'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP

  # Create object from extracted values.
  LoadSlim.new(delivery_date: delivery_date,
               load_number: load_number,
               pickup_date: pickup_date,
               status: status)
end

.namesObject

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/load_slim.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['delivery_date'] = 'deliveryDate'
  @_hash['load_number'] = 'loadNumber'
  @_hash['pickup_date'] = 'pickupDate'
  @_hash['status'] = 'status'
  @_hash
end

.nullablesObject

An array for nullable fields



49
50
51
52
53
54
55
# File 'lib/freight_financials_webhook_ingestion_api/models/load_slim.rb', line 49

def self.nullables
  %w[
    delivery_date
    pickup_date
    status
  ]
end

.optionalsObject

An array for optional fields



39
40
41
42
43
44
45
46
# File 'lib/freight_financials_webhook_ingestion_api/models/load_slim.rb', line 39

def self.optionals
  %w[
    delivery_date
    load_number
    pickup_date
    status
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



90
91
92
93
94
95
# File 'lib/freight_financials_webhook_ingestion_api/models/load_slim.rb', line 90

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

#to_sObject

Provides a human-readable string representation of the object.



83
84
85
86
87
# File 'lib/freight_financials_webhook_ingestion_api/models/load_slim.rb', line 83

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