Class: FreightFinancialsWebhookIngestionApi::NavixRateResponse

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

Overview

NavixRateResponse 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(raw_response: SKIP, raw_response_type: SKIP, vendor_charges: SKIP, customer_charges: SKIP) ⇒ NavixRateResponse

Returns a new instance of NavixRateResponse.



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

def initialize(raw_response: SKIP, raw_response_type: SKIP,
               vendor_charges: SKIP, customer_charges: SKIP)
  @raw_response = raw_response unless raw_response == SKIP
  @raw_response_type = raw_response_type unless raw_response_type == SKIP
  @vendor_charges = vendor_charges unless vendor_charges == SKIP
  @customer_charges = customer_charges unless customer_charges == SKIP
end

Instance Attribute Details

#customer_chargesArray[NavixRateCharge]

TODO: Write general description for this method

Returns:



26
27
28
# File 'lib/freight_financials_webhook_ingestion_api/models/navix_rate_response.rb', line 26

def customer_charges
  @customer_charges
end

#raw_responseString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/freight_financials_webhook_ingestion_api/models/navix_rate_response.rb', line 14

def raw_response
  @raw_response
end

#raw_response_typeRatingResponseFormat

TODO: Write general description for this method



18
19
20
# File 'lib/freight_financials_webhook_ingestion_api/models/navix_rate_response.rb', line 18

def raw_response_type
  @raw_response_type
end

#vendor_chargesArray[NavixRateCharge]

TODO: Write general description for this method

Returns:



22
23
24
# File 'lib/freight_financials_webhook_ingestion_api/models/navix_rate_response.rb', line 22

def vendor_charges
  @vendor_charges
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/freight_financials_webhook_ingestion_api/models/navix_rate_response.rb', line 62

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  raw_response = hash.key?('RawResponse') ? hash['RawResponse'] : SKIP
  raw_response_type =
    hash.key?('RawResponseType') ? hash['RawResponseType'] : SKIP
  # 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 << (NavixRateCharge.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
  customer_charges = nil
  unless hash['CustomerCharges'].nil?
    customer_charges = []
    hash['CustomerCharges'].each do |structure|
      customer_charges << (NavixRateCharge.from_hash(structure) if structure)
    end
  end

  customer_charges = SKIP unless hash.key?('CustomerCharges')

  # Create object from extracted values.
  NavixRateResponse.new(raw_response: raw_response,
                        raw_response_type: raw_response_type,
                        vendor_charges: vendor_charges,
                        customer_charges: customer_charges)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['raw_response'] = 'RawResponse'
  @_hash['raw_response_type'] = 'RawResponseType'
  @_hash['vendor_charges'] = 'VendorCharges'
  @_hash['customer_charges'] = 'CustomerCharges'
  @_hash
end

.nullablesObject

An array for nullable fields



49
50
51
# File 'lib/freight_financials_webhook_ingestion_api/models/navix_rate_response.rb', line 49

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    raw_response
    raw_response_type
    vendor_charges
    customer_charges
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



105
106
107
108
109
110
# File 'lib/freight_financials_webhook_ingestion_api/models/navix_rate_response.rb', line 105

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} raw_response: #{@raw_response.inspect}, raw_response_type:"\
  " #{@raw_response_type.inspect}, vendor_charges: #{@vendor_charges.inspect},"\
  " customer_charges: #{@customer_charges.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



98
99
100
101
102
# File 'lib/freight_financials_webhook_ingestion_api/models/navix_rate_response.rb', line 98

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} raw_response: #{@raw_response}, raw_response_type: #{@raw_response_type},"\
  " vendor_charges: #{@vendor_charges}, customer_charges: #{@customer_charges}>"
end