Class: FreightFinancialsWebhookIngestionApi::NavixRateRequest

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

Overview

NavixRateRequest 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(uuid: SKIP, freight_charge_terms: SKIP, external_order_id: SKIP, ship_date: SKIP, delivery_date: SKIP, customer: SKIP, vendor: SKIP, vendor_charges: SKIP, stops: SKIP, line_items: SKIP) ⇒ NavixRateRequest

Returns a new instance of NavixRateRequest.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/freight_financials_webhook_ingestion_api/models/navix_rate_request.rb', line 99

def initialize(uuid: SKIP, freight_charge_terms: SKIP,
               external_order_id: SKIP, ship_date: SKIP,
               delivery_date: SKIP, customer: SKIP, vendor: SKIP,
               vendor_charges: SKIP, stops: SKIP, line_items: SKIP)
  @uuid = uuid unless uuid == SKIP
  @freight_charge_terms = freight_charge_terms unless freight_charge_terms == SKIP
  @external_order_id = external_order_id unless external_order_id == SKIP
  @ship_date = ship_date unless ship_date == SKIP
  @delivery_date = delivery_date unless delivery_date == SKIP
  @customer = customer unless customer == SKIP
  @vendor = vendor unless vendor == SKIP
  @vendor_charges = vendor_charges unless vendor_charges == SKIP
  @stops = stops unless stops == SKIP
  @line_items = line_items unless line_items == SKIP
end

Instance Attribute Details

#customerNavixRateCustomer

TODO: Write general description for this method

Returns:



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

def customer
  @customer
end

#delivery_dateDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


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

def delivery_date
  @delivery_date
end

#external_order_idString

TODO: Write general description for this method

Returns:

  • (String)


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

def external_order_id
  @external_order_id
end

#freight_charge_termsString

TODO: Write general description for this method

Returns:

  • (String)


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

def freight_charge_terms
  @freight_charge_terms
end

#line_itemsArray[NavixRateLineItem]

TODO: Write general description for this method

Returns:



51
52
53
# File 'lib/freight_financials_webhook_ingestion_api/models/navix_rate_request.rb', line 51

def line_items
  @line_items
end

#ship_dateDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


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

def ship_date
  @ship_date
end

#stopsArray[NavixRateStop]

TODO: Write general description for this method

Returns:



47
48
49
# File 'lib/freight_financials_webhook_ingestion_api/models/navix_rate_request.rb', line 47

def stops
  @stops
end

#uuidString

TODO: Write general description for this method

Returns:

  • (String)


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

def uuid
  @uuid
end

#vendorNavixRateVendor

TODO: Write general description for this method

Returns:



39
40
41
# File 'lib/freight_financials_webhook_ingestion_api/models/navix_rate_request.rb', line 39

def vendor
  @vendor
end

#vendor_chargesArray[NavixRateRequestedCharge]

TODO: Write general description for this method

Returns:



43
44
45
# File 'lib/freight_financials_webhook_ingestion_api/models/navix_rate_request.rb', line 43

def vendor_charges
  @vendor_charges
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/freight_financials_webhook_ingestion_api/models/navix_rate_request.rb', line 116

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  uuid = hash.key?('uuid') ? hash['uuid'] : SKIP
  freight_charge_terms =
    hash.key?('freightChargeTerms') ? hash['freightChargeTerms'] : SKIP
  external_order_id =
    hash.key?('externalOrderId') ? hash['externalOrderId'] : SKIP
  ship_date = if hash.key?('shipDate')
                (DateTimeHelper.from_rfc3339(hash['shipDate']) if hash['shipDate'])
              else
                SKIP
              end
  delivery_date = if hash.key?('deliveryDate')
                    (DateTimeHelper.from_rfc3339(hash['deliveryDate']) if hash['deliveryDate'])
                  else
                    SKIP
                  end
  customer = NavixRateCustomer.from_hash(hash['customer']) if hash['customer']
  vendor = NavixRateVendor.from_hash(hash['vendor']) if hash['vendor']
  # Parameter is an array, so we need to iterate through it
  vendor_charges = nil
  unless hash['vendorCharges'].nil?
    vendor_charges = []
    hash['vendorCharges'].each do |structure|
      vendor_charges << (NavixRateRequestedCharge.from_hash(structure) if structure)
    end
  end

  vendor_charges = SKIP unless hash.key?('vendorCharges')
  # Parameter is an array, so we need to iterate through it
  stops = nil
  unless hash['stops'].nil?
    stops = []
    hash['stops'].each do |structure|
      stops << (NavixRateStop.from_hash(structure) if structure)
    end
  end

  stops = SKIP unless hash.key?('stops')
  # Parameter is an array, so we need to iterate through it
  line_items = nil
  unless hash['lineItems'].nil?
    line_items = []
    hash['lineItems'].each do |structure|
      line_items << (NavixRateLineItem.from_hash(structure) if structure)
    end
  end

  line_items = SKIP unless hash.key?('lineItems')

  # Create object from extracted values.
  NavixRateRequest.new(uuid: uuid,
                       freight_charge_terms: freight_charge_terms,
                       external_order_id: external_order_id,
                       ship_date: ship_date,
                       delivery_date: delivery_date,
                       customer: customer,
                       vendor: vendor,
                       vendor_charges: vendor_charges,
                       stops: stops,
                       line_items: line_items)
end

.namesObject

A mapping from model property names to API property names.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/freight_financials_webhook_ingestion_api/models/navix_rate_request.rb', line 54

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['uuid'] = 'uuid'
  @_hash['freight_charge_terms'] = 'freightChargeTerms'
  @_hash['external_order_id'] = 'externalOrderId'
  @_hash['ship_date'] = 'shipDate'
  @_hash['delivery_date'] = 'deliveryDate'
  @_hash['customer'] = 'customer'
  @_hash['vendor'] = 'vendor'
  @_hash['vendor_charges'] = 'vendorCharges'
  @_hash['stops'] = 'stops'
  @_hash['line_items'] = 'lineItems'
  @_hash
end

.nullablesObject

An array for nullable fields



86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/freight_financials_webhook_ingestion_api/models/navix_rate_request.rb', line 86

def self.nullables
  %w[
    freight_charge_terms
    ship_date
    delivery_date
    customer
    vendor
    vendor_charges
    stops
    line_items
  ]
end

.optionalsObject

An array for optional fields



70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/freight_financials_webhook_ingestion_api/models/navix_rate_request.rb', line 70

def self.optionals
  %w[
    uuid
    freight_charge_terms
    external_order_id
    ship_date
    delivery_date
    customer
    vendor
    vendor_charges
    stops
    line_items
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



199
200
201
202
203
204
205
206
# File 'lib/freight_financials_webhook_ingestion_api/models/navix_rate_request.rb', line 199

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} uuid: #{@uuid.inspect}, freight_charge_terms:"\
  " #{@freight_charge_terms.inspect}, external_order_id: #{@external_order_id.inspect},"\
  " ship_date: #{@ship_date.inspect}, delivery_date: #{@delivery_date.inspect}, customer:"\
  " #{@customer.inspect}, vendor: #{@vendor.inspect}, vendor_charges:"\
  " #{@vendor_charges.inspect}, stops: #{@stops.inspect}, line_items: #{@line_items.inspect}>"
end

#to_custom_delivery_dateObject



185
186
187
# File 'lib/freight_financials_webhook_ingestion_api/models/navix_rate_request.rb', line 185

def to_custom_delivery_date
  DateTimeHelper.to_rfc3339(delivery_date)
end

#to_custom_ship_dateObject



181
182
183
# File 'lib/freight_financials_webhook_ingestion_api/models/navix_rate_request.rb', line 181

def to_custom_ship_date
  DateTimeHelper.to_rfc3339(ship_date)
end

#to_sObject

Provides a human-readable string representation of the object.



190
191
192
193
194
195
196
# File 'lib/freight_financials_webhook_ingestion_api/models/navix_rate_request.rb', line 190

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} uuid: #{@uuid}, freight_charge_terms: #{@freight_charge_terms},"\
  " external_order_id: #{@external_order_id}, ship_date: #{@ship_date}, delivery_date:"\
  " #{@delivery_date}, customer: #{@customer}, vendor: #{@vendor}, vendor_charges:"\
  " #{@vendor_charges}, stops: #{@stops}, line_items: #{@line_items}>"
end