Class: FreightFinancialsWebhookIngestionApi::NavixWebhookRequest

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

Overview

NavixWebhookRequest 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(id: SKIP, type: SKIP, time: SKIP, data: SKIP) ⇒ NavixWebhookRequest

Returns a new instance of NavixWebhookRequest.



54
55
56
57
58
59
# File 'lib/freight_financials_webhook_ingestion_api/models/navix_webhook_request.rb', line 54

def initialize(id: SKIP, type: SKIP, time: SKIP, data: SKIP)
  @id = id unless id == SKIP
  @type = type unless type == SKIP
  @time = time unless time == SKIP
  @data = data unless data == SKIP
end

Instance Attribute Details

#dataString

TODO: Write general description for this method

Returns:

  • (String)


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

def data
  @data
end

#idUUID | String

TODO: Write general description for this method

Returns:

  • (UUID | String)


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

def id
  @id
end

#timeDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


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

def time
  @time
end

#typeNavixWebhookEventType

TODO: Write general description for this method



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

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/freight_financials_webhook_ingestion_api/models/navix_webhook_request.rb', line 62

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : SKIP
  type = hash.key?('type') ? hash['type'] : SKIP
  time = if hash.key?('time')
           (DateTimeHelper.from_rfc3339(hash['time']) if hash['time'])
         else
           SKIP
         end
  data = hash.key?('data') ? hash['data'] : SKIP

  # Create object from extracted values.
  NavixWebhookRequest.new(id: id,
                          type: type,
                          time: time,
                          data: data)
end

.namesObject

A mapping from model property names to API property names.



30
31
32
33
34
35
36
37
# File 'lib/freight_financials_webhook_ingestion_api/models/navix_webhook_request.rb', line 30

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['type'] = 'type'
  @_hash['time'] = 'time'
  @_hash['data'] = 'data'
  @_hash
end

.nullablesObject

An array for nullable fields



50
51
52
# File 'lib/freight_financials_webhook_ingestion_api/models/navix_webhook_request.rb', line 50

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    id
    type
    time
    data
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



93
94
95
96
97
# File 'lib/freight_financials_webhook_ingestion_api/models/navix_webhook_request.rb', line 93

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, type: #{@type.inspect}, time: #{@time.inspect}, data:"\
  " #{@data.inspect}>"
end

#to_custom_timeObject



82
83
84
# File 'lib/freight_financials_webhook_ingestion_api/models/navix_webhook_request.rb', line 82

def to_custom_time
  DateTimeHelper.to_rfc3339(time)
end

#to_sObject

Provides a human-readable string representation of the object.



87
88
89
90
# File 'lib/freight_financials_webhook_ingestion_api/models/navix_webhook_request.rb', line 87

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, type: #{@type}, time: #{@time}, data: #{@data}>"
end