Class: TqlOtrFactoringDataExchange::AssignmentRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- TqlOtrFactoringDataExchange::AssignmentRequest
- Defined in:
- lib/tql_otr_factoring_data_exchange/models/assignment_request.rb
Overview
Request to assign or unassign a factoring company from a carrier. The carrier is identified by ‘carrier`. The `effectiveDate` indicates when the assignment or un-assignment took effect.
Instance Attribute Summary collapse
-
#carrier ⇒ Object
Carrier information for the invoiced shipment.
-
#document ⇒ Base64Document
An optional document to include with the request, encoded as a base64 string.
-
#effective_date ⇒ Date
The date the assignment or un-assignment took effect (“as of” date).
-
#status ⇒ AssignmentStatus
Whether the factoring company is assigned to or unassigned from the carrier.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(carrier:, status:, effective_date:, document: SKIP, additional_properties: nil) ⇒ AssignmentRequest
constructor
A new instance of AssignmentRequest.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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:, status:, effective_date:, document: SKIP, additional_properties: nil) ⇒ AssignmentRequest
Returns a new instance of AssignmentRequest.
59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/tql_otr_factoring_data_exchange/models/assignment_request.rb', line 59 def initialize(carrier:, status:, effective_date:, document: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @carrier = carrier @status = status @effective_date = effective_date @document = document unless document == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#carrier ⇒ Object
Carrier information for the invoiced shipment. At least one of ‘mcNumber` or `dotNumber` must be provided.
17 18 19 |
# File 'lib/tql_otr_factoring_data_exchange/models/assignment_request.rb', line 17 def carrier @carrier end |
#document ⇒ Base64Document
An optional document to include with the request, encoded as a base64 string.
33 34 35 |
# File 'lib/tql_otr_factoring_data_exchange/models/assignment_request.rb', line 33 def document @document end |
#effective_date ⇒ Date
The date the assignment or un-assignment took effect (“as of” date). [ISO 8601](www.iso.org/iso-8601-date-and-time-format.html) date format (YYYY-MM-DD).
28 29 30 |
# File 'lib/tql_otr_factoring_data_exchange/models/assignment_request.rb', line 28 def effective_date @effective_date end |
#status ⇒ AssignmentStatus
Whether the factoring company is assigned to or unassigned from the carrier.
22 23 24 |
# File 'lib/tql_otr_factoring_data_exchange/models/assignment_request.rb', line 22 def status @status end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/tql_otr_factoring_data_exchange/models/assignment_request.rb', line 72 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. carrier = hash.key?('carrier') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:CarrierInput2), hash['carrier'] ) : nil status = hash.key?('status') ? hash['status'] : nil effective_date = hash.key?('effectiveDate') ? hash['effectiveDate'] : nil document = Base64Document.from_hash(hash['document']) if hash['document'] # 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. AssignmentRequest.new(carrier: carrier, status: status, effective_date: effective_date, document: document, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
36 37 38 39 40 41 42 43 |
# File 'lib/tql_otr_factoring_data_exchange/models/assignment_request.rb', line 36 def self.names @_hash = {} if @_hash.nil? @_hash['carrier'] = 'carrier' @_hash['status'] = 'status' @_hash['effective_date'] = 'effectiveDate' @_hash['document'] = 'document' @_hash end |
.nullables ⇒ Object
An array for nullable fields
53 54 55 56 57 |
# File 'lib/tql_otr_factoring_data_exchange/models/assignment_request.rb', line 53 def self.nullables %w[ document ] end |
.optionals ⇒ Object
An array for optional fields
46 47 48 49 50 |
# File 'lib/tql_otr_factoring_data_exchange/models/assignment_request.rb', line 46 def self.optionals %w[ document ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
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/tql_otr_factoring_data_exchange/models/assignment_request.rb', line 100 def self.validate(value) if value.instance_of? self return ( UnionTypeLookUp.get(:CarrierInput2) .validate(value.carrier) and APIHelper.valid_type?(value.status, ->(val) { AssignmentStatus.validate(val) }) and APIHelper.valid_type?(value.effective_date, ->(val) { val.instance_of? String }) ) end return false unless value.instance_of? Hash ( UnionTypeLookUp.get(:CarrierInput2) .validate(value['carrier']) and APIHelper.valid_type?(value['status'], ->(val) { AssignmentStatus.validate(val) }) and APIHelper.valid_type?(value['effectiveDate'], ->(val) { val.instance_of? String }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
133 134 135 136 137 138 |
# File 'lib/tql_otr_factoring_data_exchange/models/assignment_request.rb', line 133 def inspect class_name = self.class.name.split('::').last "<#{class_name} carrier: #{@carrier.inspect}, status: #{@status.inspect}, effective_date:"\ " #{@effective_date.inspect}, document: #{@document.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
125 126 127 128 129 130 |
# File 'lib/tql_otr_factoring_data_exchange/models/assignment_request.rb', line 125 def to_s class_name = self.class.name.split('::').last "<#{class_name} carrier: #{@carrier}, status: #{@status}, effective_date:"\ " #{@effective_date}, document: #{@document}, additional_properties:"\ " #{@additional_properties}>" end |