Class: TqlOtrFactoringDataExchange::ReferenceNumberInput
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- TqlOtrFactoringDataExchange::ReferenceNumberInput
- Defined in:
- lib/tql_otr_factoring_data_exchange/models/reference_number_input.rb
Overview
A reference number using [EDI 210](www.stedi.com/edi/x12/transaction-set/210) Reference Identification Qualifier codes to cross-reference the invoice with the TQL load.
Instance Attribute Summary collapse
-
#reference_type ⇒ ReferenceType
Reference number qualifier.
-
#value ⇒ String
The reference number value.
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(reference_type:, value:, additional_properties: nil) ⇒ ReferenceNumberInput
constructor
A new instance of ReferenceNumberInput.
-
#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(reference_type:, value:, additional_properties: nil) ⇒ ReferenceNumberInput
Returns a new instance of ReferenceNumberInput.
43 44 45 46 47 48 49 50 |
# File 'lib/tql_otr_factoring_data_exchange/models/reference_number_input.rb', line 43 def initialize(reference_type:, value:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @reference_type = reference_type @value = value @additional_properties = additional_properties end |
Instance Attribute Details
#reference_type ⇒ ReferenceType
Reference number qualifier. Values follow [EDI 210](www.stedi.com/edi/x12/transaction-set/210) / [ANSI X12](www.x12.org/) Reference Identification Qualifier codes.
19 20 21 |
# File 'lib/tql_otr_factoring_data_exchange/models/reference_number_input.rb', line 19 def reference_type @reference_type end |
#value ⇒ String
The reference number value.
23 24 25 |
# File 'lib/tql_otr_factoring_data_exchange/models/reference_number_input.rb', line 23 def value @value end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/tql_otr_factoring_data_exchange/models/reference_number_input.rb', line 53 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. reference_type = hash.key?('referenceType') ? hash['referenceType'] : nil value = hash.key?('value') ? hash['value'] : nil # 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. ReferenceNumberInput.new(reference_type: reference_type, value: value, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
26 27 28 29 30 31 |
# File 'lib/tql_otr_factoring_data_exchange/models/reference_number_input.rb', line 26 def self.names @_hash = {} if @_hash.nil? @_hash['reference_type'] = 'referenceType' @_hash['value'] = 'value' @_hash end |
.nullables ⇒ Object
An array for nullable fields
39 40 41 |
# File 'lib/tql_otr_factoring_data_exchange/models/reference_number_input.rb', line 39 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
34 35 36 |
# File 'lib/tql_otr_factoring_data_exchange/models/reference_number_input.rb', line 34 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/tql_otr_factoring_data_exchange/models/reference_number_input.rb', line 75 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.reference_type, ->(val) { ReferenceType.validate(val) }) and APIHelper.valid_type?(value.value, ->(val) { val.instance_of? String }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['referenceType'], ->(val) { ReferenceType.validate(val) }) and APIHelper.valid_type?(value['value'], ->(val) { val.instance_of? String }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
103 104 105 106 107 |
# File 'lib/tql_otr_factoring_data_exchange/models/reference_number_input.rb', line 103 def inspect class_name = self.class.name.split('::').last "<#{class_name} reference_type: #{@reference_type.inspect}, value: #{@value.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
96 97 98 99 100 |
# File 'lib/tql_otr_factoring_data_exchange/models/reference_number_input.rb', line 96 def to_s class_name = self.class.name.split('::').last "<#{class_name} reference_type: #{@reference_type}, value: #{@value},"\ " additional_properties: #{@additional_properties}>" end |