Class: TqlOtrFactoringDataExchange::StopInput
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- TqlOtrFactoringDataExchange::StopInput
- Defined in:
- lib/tql_otr_factoring_data_exchange/models/stop_input.rb
Overview
A pickup or delivery stop on the shipment route, using [EDI 210](www.stedi.com/edi/x12/transaction-set/210) stop type codes.
Instance Attribute Summary collapse
-
#location ⇒ Location
Physical address of the stop.
-
#sequence ⇒ Integer
1-based ordering of the stop in the route.
-
#stop_type ⇒ StopType
Type of stop.
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(stop_type:, sequence:, location:, additional_properties: nil) ⇒ StopInput
constructor
A new instance of StopInput.
-
#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(stop_type:, sequence:, location:, additional_properties: nil) ⇒ StopInput
Returns a new instance of StopInput.
46 47 48 49 50 51 52 53 54 |
# File 'lib/tql_otr_factoring_data_exchange/models/stop_input.rb', line 46 def initialize(stop_type:, sequence:, location:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @stop_type = stop_type @sequence = sequence @location = location @additional_properties = additional_properties end |
Instance Attribute Details
#location ⇒ Location
Physical address of the stop.
25 26 27 |
# File 'lib/tql_otr_factoring_data_exchange/models/stop_input.rb', line 25 def location @location end |
#sequence ⇒ Integer
1-based ordering of the stop in the route.
21 22 23 |
# File 'lib/tql_otr_factoring_data_exchange/models/stop_input.rb', line 21 def sequence @sequence end |
#stop_type ⇒ StopType
Type of stop. Values align with [EDI 210](www.stedi.com/edi/x12/transaction-set/210) stop-off detail codes.
17 18 19 |
# File 'lib/tql_otr_factoring_data_exchange/models/stop_input.rb', line 17 def stop_type @stop_type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/tql_otr_factoring_data_exchange/models/stop_input.rb', line 57 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. stop_type = hash.key?('stopType') ? hash['stopType'] : nil sequence = hash.key?('sequence') ? hash['sequence'] : nil location = Location.from_hash(hash['location']) if hash['location'] # 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. StopInput.new(stop_type: stop_type, sequence: sequence, location: location, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
28 29 30 31 32 33 34 |
# File 'lib/tql_otr_factoring_data_exchange/models/stop_input.rb', line 28 def self.names @_hash = {} if @_hash.nil? @_hash['stop_type'] = 'stopType' @_hash['sequence'] = 'sequence' @_hash['location'] = 'location' @_hash end |
.nullables ⇒ Object
An array for nullable fields
42 43 44 |
# File 'lib/tql_otr_factoring_data_exchange/models/stop_input.rb', line 42 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
37 38 39 |
# File 'lib/tql_otr_factoring_data_exchange/models/stop_input.rb', line 37 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/tql_otr_factoring_data_exchange/models/stop_input.rb', line 81 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.stop_type, ->(val) { StopType.validate(val) }) and APIHelper.valid_type?(value.sequence, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.location, ->(val) { Location.validate(val) }, is_model_hash: true) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['stopType'], ->(val) { StopType.validate(val) }) and APIHelper.valid_type?(value['sequence'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['location'], ->(val) { Location.validate(val) }, is_model_hash: true) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
115 116 117 118 119 |
# File 'lib/tql_otr_factoring_data_exchange/models/stop_input.rb', line 115 def inspect class_name = self.class.name.split('::').last "<#{class_name} stop_type: #{@stop_type.inspect}, sequence: #{@sequence.inspect}, location:"\ " #{@location.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
108 109 110 111 112 |
# File 'lib/tql_otr_factoring_data_exchange/models/stop_input.rb', line 108 def to_s class_name = self.class.name.split('::').last "<#{class_name} stop_type: #{@stop_type}, sequence: #{@sequence}, location: #{@location},"\ " additional_properties: #{@additional_properties}>" end |