Class: TqlOtrFactoringDataExchange::Load
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- TqlOtrFactoringDataExchange::Load
- Defined in:
- lib/tql_otr_factoring_data_exchange/models/load.rb
Overview
TQL load details associated with this invoice.
Instance Attribute Summary collapse
-
#delivery_date ⇒ Date
Date the load was delivered.
-
#load_number ⇒ String
The TQL load number.
-
#pickup_date ⇒ Date
Date the load was picked up.
-
#status ⇒ String
Current status of the underlying TQL load.
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.
Instance Method Summary collapse
-
#initialize(load_number: SKIP, status: SKIP, pickup_date: SKIP, delivery_date: SKIP, additional_properties: nil) ⇒ Load
constructor
A new instance of Load.
-
#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(load_number: SKIP, status: SKIP, pickup_date: SKIP, delivery_date: SKIP, additional_properties: nil) ⇒ Load
Returns a new instance of Load.
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/tql_otr_factoring_data_exchange/models/load.rb', line 57 def initialize(load_number: SKIP, status: SKIP, pickup_date: SKIP, delivery_date: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @load_number = load_number unless load_number == SKIP @status = status unless status == SKIP @pickup_date = pickup_date unless pickup_date == SKIP @delivery_date = delivery_date unless delivery_date == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#delivery_date ⇒ Date
Date the load was delivered.
26 27 28 |
# File 'lib/tql_otr_factoring_data_exchange/models/load.rb', line 26 def delivery_date @delivery_date end |
#load_number ⇒ String
The TQL load number.
14 15 16 |
# File 'lib/tql_otr_factoring_data_exchange/models/load.rb', line 14 def load_number @load_number end |
#pickup_date ⇒ Date
Date the load was picked up.
22 23 24 |
# File 'lib/tql_otr_factoring_data_exchange/models/load.rb', line 22 def pickup_date @pickup_date end |
#status ⇒ String
Current status of the underlying TQL load.
18 19 20 |
# File 'lib/tql_otr_factoring_data_exchange/models/load.rb', line 18 def status @status end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/tql_otr_factoring_data_exchange/models/load.rb', line 70 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. load_number = hash.key?('loadNumber') ? hash['loadNumber'] : SKIP status = hash.key?('status') ? hash['status'] : SKIP pickup_date = hash.key?('pickupDate') ? hash['pickupDate'] : SKIP delivery_date = hash.key?('deliveryDate') ? hash['deliveryDate'] : 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. Load.new(load_number: load_number, status: status, pickup_date: pickup_date, delivery_date: delivery_date, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
29 30 31 32 33 34 35 36 |
# File 'lib/tql_otr_factoring_data_exchange/models/load.rb', line 29 def self.names @_hash = {} if @_hash.nil? @_hash['load_number'] = 'loadNumber' @_hash['status'] = 'status' @_hash['pickup_date'] = 'pickupDate' @_hash['delivery_date'] = 'deliveryDate' @_hash end |
.nullables ⇒ Object
An array for nullable fields
49 50 51 52 53 54 55 |
# File 'lib/tql_otr_factoring_data_exchange/models/load.rb', line 49 def self.nullables %w[ status pickup_date delivery_date ] end |
.optionals ⇒ Object
An array for optional fields
39 40 41 42 43 44 45 46 |
# File 'lib/tql_otr_factoring_data_exchange/models/load.rb', line 39 def self.optionals %w[ load_number status pickup_date delivery_date ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
103 104 105 106 107 108 |
# File 'lib/tql_otr_factoring_data_exchange/models/load.rb', line 103 def inspect class_name = self.class.name.split('::').last "<#{class_name} load_number: #{@load_number.inspect}, status: #{@status.inspect},"\ " pickup_date: #{@pickup_date.inspect}, delivery_date: #{@delivery_date.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
95 96 97 98 99 100 |
# File 'lib/tql_otr_factoring_data_exchange/models/load.rb', line 95 def to_s class_name = self.class.name.split('::').last "<#{class_name} load_number: #{@load_number}, status: #{@status}, pickup_date:"\ " #{@pickup_date}, delivery_date: #{@delivery_date}, additional_properties:"\ " #{@additional_properties}>" end |