Class: FreightFinancialsWebhookIngestionApi::LineItem
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- FreightFinancialsWebhookIngestionApi::LineItem
- Defined in:
- lib/freight_financials_webhook_ingestion_api/models/line_item.rb
Overview
LineItem Model.
Instance Attribute Summary collapse
-
#description ⇒ String
TODO: Write general description for this method.
-
#freight_class ⇒ Float
TODO: Write general description for this method.
-
#handling_unit ⇒ String
TODO: Write general description for this method.
-
#handling_unit_count ⇒ Integer
TODO: Write general description for this method.
-
#item_id ⇒ String
TODO: Write general description for this method.
-
#weight ⇒ Float
TODO: Write general description for this method.
-
#weight_unit ⇒ String
TODO: Write general description for this method.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(description: SKIP, freight_class: SKIP, handling_unit: SKIP, handling_unit_count: SKIP, item_id: SKIP, weight: SKIP, weight_unit: SKIP) ⇒ LineItem
constructor
A new instance of LineItem.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(description: SKIP, freight_class: SKIP, handling_unit: SKIP, handling_unit_count: SKIP, item_id: SKIP, weight: SKIP, weight_unit: SKIP) ⇒ LineItem
Returns a new instance of LineItem.
78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/freight_financials_webhook_ingestion_api/models/line_item.rb', line 78 def initialize(description: SKIP, freight_class: SKIP, handling_unit: SKIP, handling_unit_count: SKIP, item_id: SKIP, weight: SKIP, weight_unit: SKIP) @description = description unless description == SKIP @freight_class = freight_class unless freight_class == SKIP @handling_unit = handling_unit unless handling_unit == SKIP @handling_unit_count = handling_unit_count unless handling_unit_count == SKIP @item_id = item_id unless item_id == SKIP @weight = weight unless weight == SKIP @weight_unit = weight_unit unless weight_unit == SKIP end |
Instance Attribute Details
#description ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/freight_financials_webhook_ingestion_api/models/line_item.rb', line 14 def description @description end |
#freight_class ⇒ Float
TODO: Write general description for this method
18 19 20 |
# File 'lib/freight_financials_webhook_ingestion_api/models/line_item.rb', line 18 def freight_class @freight_class end |
#handling_unit ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/freight_financials_webhook_ingestion_api/models/line_item.rb', line 22 def handling_unit @handling_unit end |
#handling_unit_count ⇒ Integer
TODO: Write general description for this method
26 27 28 |
# File 'lib/freight_financials_webhook_ingestion_api/models/line_item.rb', line 26 def handling_unit_count @handling_unit_count end |
#item_id ⇒ String
TODO: Write general description for this method
30 31 32 |
# File 'lib/freight_financials_webhook_ingestion_api/models/line_item.rb', line 30 def item_id @item_id end |
#weight ⇒ Float
TODO: Write general description for this method
34 35 36 |
# File 'lib/freight_financials_webhook_ingestion_api/models/line_item.rb', line 34 def weight @weight end |
#weight_unit ⇒ String
TODO: Write general description for this method
38 39 40 |
# File 'lib/freight_financials_webhook_ingestion_api/models/line_item.rb', line 38 def weight_unit @weight_unit end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/freight_financials_webhook_ingestion_api/models/line_item.rb', line 91 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. description = hash.key?('description') ? hash['description'] : SKIP freight_class = hash.key?('freightClass') ? hash['freightClass'] : SKIP handling_unit = hash.key?('handlingUnit') ? hash['handlingUnit'] : SKIP handling_unit_count = hash.key?('handlingUnitCount') ? hash['handlingUnitCount'] : SKIP item_id = hash.key?('itemId') ? hash['itemId'] : SKIP weight = hash.key?('weight') ? hash['weight'] : SKIP weight_unit = hash.key?('weightUnit') ? hash['weightUnit'] : SKIP # Create object from extracted values. LineItem.new(description: description, freight_class: freight_class, handling_unit: handling_unit, handling_unit_count: handling_unit_count, item_id: item_id, weight: weight, weight_unit: weight_unit) end |
.names ⇒ Object
A mapping from model property names to API property names.
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/freight_financials_webhook_ingestion_api/models/line_item.rb', line 41 def self.names @_hash = {} if @_hash.nil? @_hash['description'] = 'description' @_hash['freight_class'] = 'freightClass' @_hash['handling_unit'] = 'handlingUnit' @_hash['handling_unit_count'] = 'handlingUnitCount' @_hash['item_id'] = 'itemId' @_hash['weight'] = 'weight' @_hash['weight_unit'] = 'weightUnit' @_hash end |
.nullables ⇒ Object
An array for nullable fields
67 68 69 70 71 72 73 74 75 76 |
# File 'lib/freight_financials_webhook_ingestion_api/models/line_item.rb', line 67 def self.nullables %w[ description freight_class handling_unit handling_unit_count weight weight_unit ] end |
.optionals ⇒ Object
An array for optional fields
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/freight_financials_webhook_ingestion_api/models/line_item.rb', line 54 def self.optionals %w[ description freight_class handling_unit handling_unit_count item_id weight weight_unit ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
123 124 125 126 127 128 129 |
# File 'lib/freight_financials_webhook_ingestion_api/models/line_item.rb', line 123 def inspect class_name = self.class.name.split('::').last "<#{class_name} description: #{@description.inspect}, freight_class:"\ " #{@freight_class.inspect}, handling_unit: #{@handling_unit.inspect}, handling_unit_count:"\ " #{@handling_unit_count.inspect}, item_id: #{@item_id.inspect}, weight: #{@weight.inspect},"\ " weight_unit: #{@weight_unit.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
115 116 117 118 119 120 |
# File 'lib/freight_financials_webhook_ingestion_api/models/line_item.rb', line 115 def to_s class_name = self.class.name.split('::').last "<#{class_name} description: #{@description}, freight_class: #{@freight_class},"\ " handling_unit: #{@handling_unit}, handling_unit_count: #{@handling_unit_count}, item_id:"\ " #{@item_id}, weight: #{@weight}, weight_unit: #{@weight_unit}>" end |