Class: FreightFinancialsWebhookIngestionApi::AssignmentRequest

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

Overview

AssignmentRequest 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(carrier: SKIP, document: SKIP, effective_date: SKIP, status: SKIP) ⇒ AssignmentRequest

Returns a new instance of AssignmentRequest.



55
56
57
58
59
60
61
# File 'lib/freight_financials_webhook_ingestion_api/models/assignment_request.rb', line 55

def initialize(carrier: SKIP, document: SKIP, effective_date: SKIP,
               status: SKIP)
  @carrier = carrier unless carrier == SKIP
  @document = document unless document == SKIP
  @effective_date = effective_date unless effective_date == SKIP
  @status = status unless status == SKIP
end

Instance Attribute Details

#carrierCarrier

TODO: Write general description for this method

Returns:



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

def carrier
  @carrier
end

#documentUploadRequest

TODO: Write general description for this method

Returns:



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

def document
  @document
end

#effective_dateDate

TODO: Write general description for this method

Returns:

  • (Date)


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

def effective_date
  @effective_date
end

#statusInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def status
  @status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/freight_financials_webhook_ingestion_api/models/assignment_request.rb', line 64

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  carrier = Carrier.from_hash(hash['carrier']) if hash['carrier']
  document = UploadRequest.from_hash(hash['document']) if hash['document']
  effective_date = hash.key?('effectiveDate') ? hash['effectiveDate'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP

  # Create object from extracted values.
  AssignmentRequest.new(carrier: carrier,
                        document: document,
                        effective_date: effective_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/assignment_request.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['carrier'] = 'carrier'
  @_hash['document'] = 'document'
  @_hash['effective_date'] = 'effectiveDate'
  @_hash['status'] = 'status'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  %w[
    document
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    carrier
    document
    effective_date
    status
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



88
89
90
91
92
# File 'lib/freight_financials_webhook_ingestion_api/models/assignment_request.rb', line 88

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

#to_sObject

Provides a human-readable string representation of the object.



81
82
83
84
85
# File 'lib/freight_financials_webhook_ingestion_api/models/assignment_request.rb', line 81

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