Class: TqlOtrFactoringDataExchange::Base64DocumentUploadRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- TqlOtrFactoringDataExchange::Base64DocumentUploadRequest
- Defined in:
- lib/tql_otr_factoring_data_exchange/models/base64_document_upload_request.rb
Overview
JSON request to upload a document as a base64-encoded string, linked to an invoice.
Instance Attribute Summary collapse
-
#document ⇒ Base64Document
An optional document to include with the request, encoded as a base64 string.
-
#document_type ⇒ DocumentType
Document type classification used for categorizing uploaded documents.
-
#invoice_number ⇒ String
The factoring company’s invoice number this document is associated with.
-
#tags ⇒ Hash[String, String]
Arbitrary key-value metadata tags for this document.
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(invoice_number:, document_type:, document:, tags: SKIP, additional_properties: nil) ⇒ Base64DocumentUploadRequest
constructor
A new instance of Base64DocumentUploadRequest.
-
#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(invoice_number:, document_type:, document:, tags: SKIP, additional_properties: nil) ⇒ Base64DocumentUploadRequest
Returns a new instance of Base64DocumentUploadRequest.
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/tql_otr_factoring_data_exchange/models/base64_document_upload_request.rb', line 55 def initialize(invoice_number:, document_type:, document:, tags: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @invoice_number = invoice_number @document_type = document_type @document = document @tags = unless == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#document ⇒ Base64Document
An optional document to include with the request, encoded as a base64 string.
24 25 26 |
# File 'lib/tql_otr_factoring_data_exchange/models/base64_document_upload_request.rb', line 24 def document @document end |
#document_type ⇒ DocumentType
Document type classification used for categorizing uploaded documents.
19 20 21 |
# File 'lib/tql_otr_factoring_data_exchange/models/base64_document_upload_request.rb', line 19 def document_type @document_type end |
#invoice_number ⇒ String
The factoring company’s invoice number this document is associated with.
15 16 17 |
# File 'lib/tql_otr_factoring_data_exchange/models/base64_document_upload_request.rb', line 15 def invoice_number @invoice_number end |
#tags ⇒ Hash[String, String]
Arbitrary key-value metadata tags for this document.
28 29 30 |
# File 'lib/tql_otr_factoring_data_exchange/models/base64_document_upload_request.rb', line 28 def @tags end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/tql_otr_factoring_data_exchange/models/base64_document_upload_request.rb', line 68 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. invoice_number = hash.key?('invoiceNumber') ? hash['invoiceNumber'] : nil document_type = hash.key?('documentType') ? hash['documentType'] : nil document = Base64Document.from_hash(hash['document']) if hash['document'] = hash.key?('tags') ? hash['tags'] : 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. Base64DocumentUploadRequest.new(invoice_number: invoice_number, document_type: document_type, document: document, tags: , additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
31 32 33 34 35 36 37 38 |
# File 'lib/tql_otr_factoring_data_exchange/models/base64_document_upload_request.rb', line 31 def self.names @_hash = {} if @_hash.nil? @_hash['invoice_number'] = 'invoiceNumber' @_hash['document_type'] = 'documentType' @_hash['document'] = 'document' @_hash['tags'] = 'tags' @_hash end |
.nullables ⇒ Object
An array for nullable fields
48 49 50 51 52 53 |
# File 'lib/tql_otr_factoring_data_exchange/models/base64_document_upload_request.rb', line 48 def self.nullables %w[ document tags ] end |
.optionals ⇒ Object
An array for optional fields
41 42 43 44 45 |
# File 'lib/tql_otr_factoring_data_exchange/models/base64_document_upload_request.rb', line 41 def self.optionals %w[ tags ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
100 101 102 103 104 105 |
# File 'lib/tql_otr_factoring_data_exchange/models/base64_document_upload_request.rb', line 100 def inspect class_name = self.class.name.split('::').last "<#{class_name} invoice_number: #{@invoice_number.inspect}, document_type:"\ " #{@document_type.inspect}, document: #{@document.inspect}, tags: #{@tags.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
93 94 95 96 97 |
# File 'lib/tql_otr_factoring_data_exchange/models/base64_document_upload_request.rb', line 93 def to_s class_name = self.class.name.split('::').last "<#{class_name} invoice_number: #{@invoice_number}, document_type: #{@document_type},"\ " document: #{@document}, tags: #{@tags}, additional_properties: #{@additional_properties}>" end |