Class: Inttegro::Checkout::OrderLineItemGroup
- Inherits:
-
T::Struct
- Object
- T::Struct
- Inttegro::Checkout::OrderLineItemGroup
- Extended by:
- T::Sig
- Defined in:
- lib/inttegro/checkout/order_line_item_group.rb
Overview
Typed representation of the order line item group object in the Inttegro API.
This generated model is immutable. Construct it with .new, or decode a string-keyed API
payload with .from_hash. #serialize produces a string-keyed hash using the original wire
field names and serialized enum values.
Instance Attribute Summary collapse
-
#line_items ⇒ Array<Inttegro::Shared::LineItem>?
readonly
Value of the
line_itemsfield in the Inttegro API payload. -
#total ⇒ Inttegro::Money::Amount?
readonly
Value of the
totalfield in the Inttegro API payload.
Class Method Summary collapse
Instance Attribute Details
#line_items ⇒ Array<Inttegro::Shared::LineItem>? (readonly)
Value of the line_items field in the Inttegro API payload.
Optional in the API payload; omitted values default to nil. Wire name: line_items.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/inttegro/checkout/order_line_item_group.rb', line 31 class OrderLineItemGroup < T::Struct const :line_items, T.nilable(T::Array[Inttegro::Shared::LineItem]), default: nil const :total, T.nilable(Inttegro::Money::Amount), default: nil extend T::Sig sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) } def self.from_hash(hash, strict = false) data = hash.dup if (line_items_value = data["line_items"]).is_a?(Array) data["line_items"] = line_items_value.map do |item| next item unless item.is_a?(Hash) case item["type"] when "product" Inttegro::Product::LineItem.from_hash(item) when "fee" Inttegro::Shared::FeeLineItem.from_hash(item) when "shipping" Inttegro::Shared::ShippingLineItem.from_hash(item) else item end end end super(data, strict) end end |
#total ⇒ Inttegro::Money::Amount? (readonly)
Value of the total field in the Inttegro API payload.
Optional in the API payload; omitted values default to nil. Wire name: total.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/inttegro/checkout/order_line_item_group.rb', line 31 class OrderLineItemGroup < T::Struct const :line_items, T.nilable(T::Array[Inttegro::Shared::LineItem]), default: nil const :total, T.nilable(Inttegro::Money::Amount), default: nil extend T::Sig sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) } def self.from_hash(hash, strict = false) data = hash.dup if (line_items_value = data["line_items"]).is_a?(Array) data["line_items"] = line_items_value.map do |item| next item unless item.is_a?(Hash) case item["type"] when "product" Inttegro::Product::LineItem.from_hash(item) when "fee" Inttegro::Shared::FeeLineItem.from_hash(item) when "shipping" Inttegro::Shared::ShippingLineItem.from_hash(item) else item end end end super(data, strict) end end |
Class Method Details
.from_hash(hash, strict = false) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/inttegro/checkout/order_line_item_group.rb', line 38 def self.from_hash(hash, strict = false) data = hash.dup if (line_items_value = data["line_items"]).is_a?(Array) data["line_items"] = line_items_value.map do |item| next item unless item.is_a?(Hash) case item["type"] when "product" Inttegro::Product::LineItem.from_hash(item) when "fee" Inttegro::Shared::FeeLineItem.from_hash(item) when "shipping" Inttegro::Shared::ShippingLineItem.from_hash(item) else item end end end super(data, strict) end |