Class: FreightFinancialsWebhookIngestionApi::InvoiceIssue

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/freight_financials_webhook_ingestion_api/models/invoice_issue.rb

Overview

InvoiceIssue Model.

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(code: SKIP, created_at: SKIP, exception_id: SKIP, field: SKIP, message: SKIP, severity: SKIP) ⇒ InvoiceIssue

Returns a new instance of InvoiceIssue.



68
69
70
71
72
73
74
75
76
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice_issue.rb', line 68

def initialize(code: SKIP, created_at: SKIP, exception_id: SKIP,
               field: SKIP, message: SKIP, severity: SKIP)
  @code = code unless code == SKIP
  @created_at = created_at unless created_at == SKIP
  @exception_id = exception_id unless exception_id == SKIP
  @field = field unless field == SKIP
  @message = message unless message == SKIP
  @severity = severity unless severity == SKIP
end

Instance Attribute Details

#codeString

TODO: Write general description for this method

Returns:

  • (String)


15
16
17
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice_issue.rb', line 15

def code
  @code
end

#created_atDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


19
20
21
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice_issue.rb', line 19

def created_at
  @created_at
end

#exception_idUUID | String

TODO: Write general description for this method

Returns:

  • (UUID | String)


23
24
25
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice_issue.rb', line 23

def exception_id
  @exception_id
end

#fieldString

TODO: Write general description for this method

Returns:

  • (String)


27
28
29
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice_issue.rb', line 27

def field
  @field
end

#messageString

TODO: Write general description for this method

Returns:

  • (String)


31
32
33
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice_issue.rb', line 31

def message
  @message
end

#severityInteger

TODO: Write general description for this method

Returns:

  • (Integer)


35
36
37
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice_issue.rb', line 35

def severity
  @severity
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice_issue.rb', line 79

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  code = hash.key?('code') ? hash['code'] : SKIP
  created_at = if hash.key?('createdAt')
                 (DateTimeHelper.from_rfc3339(hash['createdAt']) if hash['createdAt'])
               else
                 SKIP
               end
  exception_id = hash.key?('exceptionId') ? hash['exceptionId'] : SKIP
  field = hash.key?('field') ? hash['field'] : SKIP
  message = hash.key?('message') ? hash['message'] : SKIP
  severity = hash.key?('severity') ? hash['severity'] : SKIP

  # Create object from extracted values.
  InvoiceIssue.new(code: code,
                   created_at: created_at,
                   exception_id: exception_id,
                   field: field,
                   message: message,
                   severity: severity)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['code'] = 'code'
  @_hash['created_at'] = 'createdAt'
  @_hash['exception_id'] = 'exceptionId'
  @_hash['field'] = 'field'
  @_hash['message'] = 'message'
  @_hash['severity'] = 'severity'
  @_hash
end

.nullablesObject

An array for nullable fields



62
63
64
65
66
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice_issue.rb', line 62

def self.nullables
  %w[
    field
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    code
    created_at
    exception_id
    field
    message
    severity
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



115
116
117
118
119
120
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice_issue.rb', line 115

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} code: #{@code.inspect}, created_at: #{@created_at.inspect}, exception_id:"\
  " #{@exception_id.inspect}, field: #{@field.inspect}, message: #{@message.inspect},"\
  " severity: #{@severity.inspect}>"
end

#to_custom_created_atObject



103
104
105
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice_issue.rb', line 103

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end

#to_sObject

Provides a human-readable string representation of the object.



108
109
110
111
112
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice_issue.rb', line 108

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} code: #{@code}, created_at: #{@created_at}, exception_id: #{@exception_id},"\
  " field: #{@field}, message: #{@message}, severity: #{@severity}>"
end