Class: Pago::V2026_04::Models::OrderItemSchema

Inherits:
Model
  • Object
show all
Defined in:
lib/pago/v2026_04/models.rb,
sig/pago/v2026_04/generated.rbs

Overview

An order line item.

Constant Summary collapse

JSON_KEYS =

Returns:

  • (Hash[Symbol, String])
{
  created_at: "created_at",
  modified_at: "modified_at",
  id: "id",
  label: "label",
  amount: "amount",
  tax_amount: "tax_amount",
  proration: "proration",
  product_price_id: "product_price_id"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
["created_at", "modified_at", "id", "label", "amount", "tax_amount", "proration", "product_price_id"].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#==, #[], #field_set?, #hash, #inspect, json_keys, required_json_keys, #to_json, #to_json_hash, wrap_raw

Constructor Details

#initialize(created_at:, modified_at:, id:, label:, amount:, tax_amount:, proration:, product_price_id:) ⇒ OrderItemSchema

Returns a new instance of OrderItemSchema.

Parameters:

  • created_at: (String)
  • modified_at: (String, nil)
  • id: (String)
  • label: (String)
  • amount: (Integer)
  • tax_amount: (Integer)
  • proration: (Boolean)
  • product_price_id: (String, nil)


32547
32548
32549
32550
32551
32552
32553
32554
32555
32556
32557
32558
32559
32560
32561
32562
32563
32564
32565
32566
# File 'lib/pago/v2026_04/models.rb', line 32547

def initialize(
  created_at:,
  modified_at:,
  id:,
  label:,
  amount:,
  tax_amount:,
  proration:,
  product_price_id:
)
  super()
  assign(:created_at, created_at)
  assign(:modified_at, modified_at)
  assign(:id, id)
  assign(:label, label)
  assign(:amount, amount)
  assign(:tax_amount, tax_amount)
  assign(:proration, proration)
  assign(:product_price_id, product_price_id)
end

Instance Attribute Details

#amountInteger (readonly)

Amount in cents, before discounts and taxes.

Returns:

  • (Integer)


32533
32534
32535
# File 'lib/pago/v2026_04/models.rb', line 32533

def amount
  @amount
end

#created_atString (readonly)

Creation timestamp of the object.

Returns:

  • (String)


32517
32518
32519
# File 'lib/pago/v2026_04/models.rb', line 32517

def created_at
  @created_at
end

#idString (readonly)

The ID of the object.

Returns:

  • (String)


32525
32526
32527
# File 'lib/pago/v2026_04/models.rb', line 32525

def id
  @id
end

#labelString (readonly)

Description of the line item charge.

Returns:

  • (String)


32529
32530
32531
# File 'lib/pago/v2026_04/models.rb', line 32529

def label
  @label
end

#modified_atString? (readonly)

Last modification timestamp of the object.

Returns:

  • (String, nil)


32521
32522
32523
# File 'lib/pago/v2026_04/models.rb', line 32521

def modified_at
  @modified_at
end

#product_price_idString? (readonly)

Associated price ID, if any.

Returns:

  • (String, nil)


32545
32546
32547
# File 'lib/pago/v2026_04/models.rb', line 32545

def product_price_id
  @product_price_id
end

#prorationBoolean (readonly)

Whether this charge is due to a proration.

Returns:

  • (Boolean)


32541
32542
32543
# File 'lib/pago/v2026_04/models.rb', line 32541

def proration
  @proration
end

#tax_amountInteger (readonly)

Sales tax amount in cents.

Returns:

  • (Integer)


32537
32538
32539
# File 'lib/pago/v2026_04/models.rb', line 32537

def tax_amount
  @tax_amount
end

Class Method Details

.from_json(data) ⇒ OrderItemSchema?

Parameters:

  • data (Hash, String, nil)

Returns:



32570
32571
32572
32573
32574
32575
32576
32577
32578
32579
32580
32581
32582
32583
32584
32585
32586
32587
32588
# File 'lib/pago/v2026_04/models.rb', line 32570

def self.from_json(data)
  data = ::JSON.parse(data) if data.is_a?(String)
  data = ::Pago::Serde.object(data)
  return nil if data.nil?

  wrap_raw(
    new(
      created_at: (data.key?("created_at") ? data["created_at"] : ::Pago::UNSET),
      modified_at: (data.key?("modified_at") ? data["modified_at"] : ::Pago::UNSET),
      id: (data.key?("id") ? data["id"] : ::Pago::UNSET),
      label: (data.key?("label") ? data["label"] : ::Pago::UNSET),
      amount: (data.key?("amount") ? data["amount"] : ::Pago::UNSET),
      tax_amount: (data.key?("tax_amount") ? data["tax_amount"] : ::Pago::UNSET),
      proration: (data.key?("proration") ? data["proration"] : ::Pago::UNSET),
      product_price_id: (data.key?("product_price_id") ? data["product_price_id"] : ::Pago::UNSET)
    ),
    data
  )
end