Class: TqlOtrFactoringDataExchange::AssignmentResponse

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

Overview

Acknowledgement that the assignment was recorded.

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, status: SKIP, effective_date: SKIP, recorded_at: SKIP, additional_properties: nil) ⇒ AssignmentResponse

Returns a new instance of AssignmentResponse.



61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/tql_otr_factoring_data_exchange/models/assignment_response.rb', line 61

def initialize(assignment_id: SKIP, carrier: SKIP, status: SKIP,
               effective_date: SKIP, recorded_at: 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
  @status = status unless status == SKIP
  @effective_date = effective_date unless effective_date == SKIP
  @recorded_at = recorded_at unless recorded_at == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#assignment_idUUID | String

System-generated unique identifier for this assignment record.

Returns:

  • (UUID | String)


15
16
17
# File 'lib/tql_otr_factoring_data_exchange/models/assignment_response.rb', line 15

def assignment_id
  @assignment_id
end

#carrierCarrier1

Carrier that was assigned/unassigned.

Returns:



19
20
21
# File 'lib/tql_otr_factoring_data_exchange/models/assignment_response.rb', line 19

def carrier
  @carrier
end

#effective_dateDate

The effective date that was recorded.

Returns:

  • (Date)


28
29
30
# File 'lib/tql_otr_factoring_data_exchange/models/assignment_response.rb', line 28

def effective_date
  @effective_date
end

#recorded_atDateTime

UTC timestamp when TQL recorded this assignment.

Returns:

  • (DateTime)


32
33
34
# File 'lib/tql_otr_factoring_data_exchange/models/assignment_response.rb', line 32

def recorded_at
  @recorded_at
end

#statusAssignmentStatus

Whether the factoring company is assigned to or unassigned from the carrier.

Returns:



24
25
26
# File 'lib/tql_otr_factoring_data_exchange/models/assignment_response.rb', line 24

def status
  @status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
103
104
# File 'lib/tql_otr_factoring_data_exchange/models/assignment_response.rb', line 76

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  assignment_id = hash.key?('assignmentId') ? hash['assignmentId'] : SKIP
  carrier = Carrier1.from_hash(hash['carrier']) if hash['carrier']
  status = hash.key?('status') ? hash['status'] : SKIP
  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

  # 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.
  AssignmentResponse.new(assignment_id: assignment_id,
                         carrier: carrier,
                         status: status,
                         effective_date: effective_date,
                         recorded_at: recorded_at,
                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



35
36
37
38
39
40
41
42
43
# File 'lib/tql_otr_factoring_data_exchange/models/assignment_response.rb', line 35

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

.nullablesObject

An array for nullable fields



57
58
59
# File 'lib/tql_otr_factoring_data_exchange/models/assignment_response.rb', line 57

def self.nullables
  []
end

.optionalsObject

An array for optional fields



46
47
48
49
50
51
52
53
54
# File 'lib/tql_otr_factoring_data_exchange/models/assignment_response.rb', line 46

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



119
120
121
122
123
124
# File 'lib/tql_otr_factoring_data_exchange/models/assignment_response.rb', line 119

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

#to_custom_recorded_atObject



106
107
108
# File 'lib/tql_otr_factoring_data_exchange/models/assignment_response.rb', line 106

def to_custom_recorded_at
  DateTimeHelper.to_rfc3339(recorded_at)
end

#to_sObject

Provides a human-readable string representation of the object.



111
112
113
114
115
116
# File 'lib/tql_otr_factoring_data_exchange/models/assignment_response.rb', line 111

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