Class: FreightFinancialsWebhookIngestionApi::AssignmentResponseData

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

Overview

AssignmentResponseData 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(assignment_id: SKIP, carrier: SKIP, effective_date: SKIP, recorded_at: SKIP, status: SKIP, additional_properties: nil) ⇒ AssignmentResponseData

Returns a new instance of AssignmentResponseData.



60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/freight_financials_webhook_ingestion_api/models/assignment_response_data.rb', line 60

def initialize(assignment_id: SKIP, carrier: SKIP, effective_date: SKIP,
               recorded_at: SKIP, status: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @assignment_id = assignment_id unless assignment_id == SKIP
  @carrier = carrier unless carrier == SKIP
  @effective_date = effective_date unless effective_date == SKIP
  @recorded_at = recorded_at unless recorded_at == SKIP
  @status = status unless status == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#assignment_idUUID | String

TODO: Write general description for this method

Returns:

  • (UUID | String)


15
16
17
# File 'lib/freight_financials_webhook_ingestion_api/models/assignment_response_data.rb', line 15

def assignment_id
  @assignment_id
end

#carrierCarrier

TODO: Write general description for this method

Returns:



19
20
21
# File 'lib/freight_financials_webhook_ingestion_api/models/assignment_response_data.rb', line 19

def carrier
  @carrier
end

#effective_dateDate

TODO: Write general description for this method

Returns:

  • (Date)


23
24
25
# File 'lib/freight_financials_webhook_ingestion_api/models/assignment_response_data.rb', line 23

def effective_date
  @effective_date
end

#recorded_atDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


27
28
29
# File 'lib/freight_financials_webhook_ingestion_api/models/assignment_response_data.rb', line 27

def recorded_at
  @recorded_at
end

#statusInteger

TODO: Write general description for this method

Returns:

  • (Integer)


31
32
33
# File 'lib/freight_financials_webhook_ingestion_api/models/assignment_response_data.rb', line 31

def status
  @status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/freight_financials_webhook_ingestion_api/models/assignment_response_data.rb', line 74

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  assignment_id = hash.key?('assignmentId') ? hash['assignmentId'] : SKIP
  carrier = Carrier.from_hash(hash['carrier']) if hash['carrier']
  effective_date = hash.key?('effectiveDate') ? hash['effectiveDate'] : SKIP
  recorded_at = if hash.key?('recordedAt')
                  (DateTimeHelper.from_rfc3339(hash['recordedAt']) if hash['recordedAt'])
                else
                  SKIP
                end
  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.
  AssignmentResponseData.new(assignment_id: assignment_id,
                             carrier: carrier,
                             effective_date: effective_date,
                             recorded_at: recorded_at,
                             status: status,
                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



34
35
36
37
38
39
40
41
42
# File 'lib/freight_financials_webhook_ingestion_api/models/assignment_response_data.rb', line 34

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

.nullablesObject

An array for nullable fields



56
57
58
# File 'lib/freight_financials_webhook_ingestion_api/models/assignment_response_data.rb', line 56

def self.nullables
  []
end

.optionalsObject

An array for optional fields



45
46
47
48
49
50
51
52
53
# File 'lib/freight_financials_webhook_ingestion_api/models/assignment_response_data.rb', line 45

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



117
118
119
120
121
122
# File 'lib/freight_financials_webhook_ingestion_api/models/assignment_response_data.rb', line 117

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

#to_custom_recorded_atObject



104
105
106
# File 'lib/freight_financials_webhook_ingestion_api/models/assignment_response_data.rb', line 104

def to_custom_recorded_at
  DateTimeHelper.to_rfc3339(recorded_at)
end

#to_sObject

Provides a human-readable string representation of the object.



109
110
111
112
113
114
# File 'lib/freight_financials_webhook_ingestion_api/models/assignment_response_data.rb', line 109

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