Class: TqlOtrFactoringDataExchange::DocumentUploadResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/tql_otr_factoring_data_exchange/models/document_upload_response.rb

Overview

Acknowledgement that the document was accepted for processing.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(document_id: SKIP, invoice_number: SKIP, document_type: SKIP, status: SKIP, tags: SKIP, received_at: SKIP, additional_properties: nil) ⇒ DocumentUploadResponse

Returns a new instance of DocumentUploadResponse.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/tql_otr_factoring_data_exchange/models/document_upload_response.rb', line 68

def initialize(document_id: SKIP, invoice_number: SKIP, document_type: SKIP,
               status: SKIP, tags: SKIP, received_at: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @document_id = document_id unless document_id == SKIP
  @invoice_number = invoice_number unless invoice_number == SKIP
  @document_type = document_type unless document_type == SKIP
  @status = status unless status == SKIP
  @tags = tags unless tags == SKIP
  @received_at = received_at unless received_at == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#document_idUUID | String

System-generated unique identifier for this document.

Returns:

  • (UUID | String)


15
16
17
# File 'lib/tql_otr_factoring_data_exchange/models/document_upload_response.rb', line 15

def document_id
  @document_id
end

#document_typeDocumentType

Document type classification used for categorizing uploaded documents.

Returns:



23
24
25
# File 'lib/tql_otr_factoring_data_exchange/models/document_upload_response.rb', line 23

def document_type
  @document_type
end

#invoice_numberString

The invoice this document was linked to.

Returns:

  • (String)


19
20
21
# File 'lib/tql_otr_factoring_data_exchange/models/document_upload_response.rb', line 19

def invoice_number
  @invoice_number
end

#received_atDateTime

UTC timestamp when the document was received.

Returns:

  • (DateTime)


35
36
37
# File 'lib/tql_otr_factoring_data_exchange/models/document_upload_response.rb', line 35

def received_at
  @received_at
end

#statusStatus

Processing status of this document.

Returns:



27
28
29
# File 'lib/tql_otr_factoring_data_exchange/models/document_upload_response.rb', line 27

def status
  @status
end

#tagsHash[String, String]

The tags that were submitted with this document (echoed back).

Returns:

  • (Hash[String, String])


31
32
33
# File 'lib/tql_otr_factoring_data_exchange/models/document_upload_response.rb', line 31

def tags
  @tags
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/tql_otr_factoring_data_exchange/models/document_upload_response.rb', line 84

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  document_id = hash.key?('documentId') ? hash['documentId'] : SKIP
  invoice_number = hash.key?('invoiceNumber') ? hash['invoiceNumber'] : SKIP
  document_type = hash.key?('documentType') ? hash['documentType'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  tags = hash.key?('tags') ? hash['tags'] : SKIP
  received_at = if hash.key?('receivedAt')
                  (DateTimeHelper.from_rfc3339(hash['receivedAt']) if hash['receivedAt'])
                else
                  SKIP
                end

  # 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.
  DocumentUploadResponse.new(document_id: document_id,
                             invoice_number: invoice_number,
                             document_type: document_type,
                             status: status,
                             tags: tags,
                             received_at: received_at,
                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
45
46
47
# File 'lib/tql_otr_factoring_data_exchange/models/document_upload_response.rb', line 38

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['document_id'] = 'documentId'
  @_hash['invoice_number'] = 'invoiceNumber'
  @_hash['document_type'] = 'documentType'
  @_hash['status'] = 'status'
  @_hash['tags'] = 'tags'
  @_hash['received_at'] = 'receivedAt'
  @_hash
end

.nullablesObject

An array for nullable fields



62
63
64
65
66
# File 'lib/tql_otr_factoring_data_exchange/models/document_upload_response.rb', line 62

def self.nullables
  %w[
    tags
  ]
end

.optionalsObject

An array for optional fields



50
51
52
53
54
55
56
57
58
59
# File 'lib/tql_otr_factoring_data_exchange/models/document_upload_response.rb', line 50

def self.optionals
  %w[
    document_id
    invoice_number
    document_type
    status
    tags
    received_at
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



129
130
131
132
133
134
135
# File 'lib/tql_otr_factoring_data_exchange/models/document_upload_response.rb', line 129

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} document_id: #{@document_id.inspect}, invoice_number:"\
  " #{@invoice_number.inspect}, document_type: #{@document_type.inspect}, status:"\
  " #{@status.inspect}, tags: #{@tags.inspect}, received_at: #{@received_at.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_custom_received_atObject



116
117
118
# File 'lib/tql_otr_factoring_data_exchange/models/document_upload_response.rb', line 116

def to_custom_received_at
  DateTimeHelper.to_rfc3339(received_at)
end

#to_sObject

Provides a human-readable string representation of the object.



121
122
123
124
125
126
# File 'lib/tql_otr_factoring_data_exchange/models/document_upload_response.rb', line 121

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} document_id: #{@document_id}, invoice_number: #{@invoice_number},"\
  " document_type: #{@document_type}, status: #{@status}, tags: #{@tags}, received_at:"\
  " #{@received_at}, additional_properties: #{@additional_properties}>"
end