Class: FdxV660Api::LineItemEntity
- Defined in:
- lib/fdx_v660_api/models/line_item_entity.rb
Overview
A line item within a transaction
Instance Attribute Summary collapse
-
#amount ⇒ Float
The amount of money attributable to this line item.
-
#check_number ⇒ Integer
Check number.
-
#description ⇒ String
The description of the line item.
-
#image_ids ⇒ Array[String]
Array of image identifiers (unique to transaction) used to retrieve images of check or transaction receipt.
-
#links ⇒ Array[HateoasLink]
Links (unique to this Transaction) used to retrieve images of checks or transaction receipts, or invoke other APIs.
-
#memo ⇒ String
Secondary item description.
-
#reference ⇒ String
A reference number.
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(description: SKIP, amount: SKIP, check_number: SKIP, memo: SKIP, reference: SKIP, image_ids: SKIP, links: SKIP, additional_properties: nil) ⇒ LineItemEntity
constructor
A new instance of LineItemEntity.
-
#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, amount: SKIP, check_number: SKIP, memo: SKIP, reference: SKIP, image_ids: SKIP, links: SKIP, additional_properties: nil) ⇒ LineItemEntity
Returns a new instance of LineItemEntity.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/fdx_v660_api/models/line_item_entity.rb', line 73 def initialize(description: SKIP, amount: SKIP, check_number: SKIP, memo: SKIP, reference: SKIP, image_ids: SKIP, links: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @description = description unless description == SKIP @amount = amount unless amount == SKIP @check_number = check_number unless check_number == SKIP @memo = memo unless memo == SKIP @reference = reference unless reference == SKIP @image_ids = image_ids unless image_ids == SKIP @links = links unless links == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#amount ⇒ Float
The amount of money attributable to this line item
18 19 20 |
# File 'lib/fdx_v660_api/models/line_item_entity.rb', line 18 def amount @amount end |
#check_number ⇒ Integer
Check number
22 23 24 |
# File 'lib/fdx_v660_api/models/line_item_entity.rb', line 22 def check_number @check_number end |
#description ⇒ String
The description of the line item
14 15 16 |
# File 'lib/fdx_v660_api/models/line_item_entity.rb', line 14 def description @description end |
#image_ids ⇒ Array[String]
Array of image identifiers (unique to transaction) used to retrieve images of check or transaction receipt
35 36 37 |
# File 'lib/fdx_v660_api/models/line_item_entity.rb', line 35 def image_ids @image_ids end |
#links ⇒ Array[HateoasLink]
Links (unique to this Transaction) used to retrieve images of checks or transaction receipts, or invoke other APIs
40 41 42 |
# File 'lib/fdx_v660_api/models/line_item_entity.rb', line 40 def links @links end |
#memo ⇒ String
Secondary item description
26 27 28 |
# File 'lib/fdx_v660_api/models/line_item_entity.rb', line 26 def memo @memo end |
#reference ⇒ String
A reference number
30 31 32 |
# File 'lib/fdx_v660_api/models/line_item_entity.rb', line 30 def reference @reference end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/fdx_v660_api/models/line_item_entity.rb', line 90 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. description = hash.key?('description') ? hash['description'] : SKIP amount = hash.key?('amount') ? hash['amount'] : SKIP check_number = hash.key?('checkNumber') ? hash['checkNumber'] : SKIP memo = hash.key?('memo') ? hash['memo'] : SKIP reference = hash.key?('reference') ? hash['reference'] : SKIP image_ids = hash.key?('imageIds') ? hash['imageIds'] : SKIP # Parameter is an array, so we need to iterate through it links = nil unless hash['links'].nil? links = [] hash['links'].each do |structure| links << (HateoasLink.from_hash(structure) if structure) end end links = SKIP unless hash.key?('links') # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. LineItemEntity.new(description: description, amount: amount, check_number: check_number, memo: memo, reference: reference, image_ids: image_ids, links: links, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/fdx_v660_api/models/line_item_entity.rb', line 43 def self.names @_hash = {} if @_hash.nil? @_hash['description'] = 'description' @_hash['amount'] = 'amount' @_hash['check_number'] = 'checkNumber' @_hash['memo'] = 'memo' @_hash['reference'] = 'reference' @_hash['image_ids'] = 'imageIds' @_hash['links'] = 'links' @_hash end |
.nullables ⇒ Object
An array for nullable fields
69 70 71 |
# File 'lib/fdx_v660_api/models/line_item_entity.rb', line 69 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/fdx_v660_api/models/line_item_entity.rb', line 56 def self.optionals %w[ description amount check_number memo reference image_ids links ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
131 132 133 134 135 136 137 |
# File 'lib/fdx_v660_api/models/line_item_entity.rb', line 131 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
148 149 150 151 152 153 154 |
# File 'lib/fdx_v660_api/models/line_item_entity.rb', line 148 def inspect class_name = self.class.name.split('::').last "<#{class_name} description: #{@description.inspect}, amount: #{@amount.inspect},"\ " check_number: #{@check_number.inspect}, memo: #{@memo.inspect}, reference:"\ " #{@reference.inspect}, image_ids: #{@image_ids.inspect}, links: #{@links.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
140 141 142 143 144 145 |
# File 'lib/fdx_v660_api/models/line_item_entity.rb', line 140 def to_s class_name = self.class.name.split('::').last "<#{class_name} description: #{@description}, amount: #{@amount}, check_number:"\ " #{@check_number}, memo: #{@memo}, reference: #{@reference}, image_ids: #{@image_ids},"\ " links: #{@links}, additional_properties: #{@additional_properties}>" end |