Class: Pago::V2026_04::Models::CustomerStateSubscriptionMeter

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

Overview

Current consumption and spending for a subscription meter.

Constant Summary collapse

JSON_KEYS =

Returns:

  • (Hash[Symbol, String])
{
  created_at: "created_at",
  modified_at: "modified_at",
  id: "id",
  consumed_units: "consumed_units",
  credited_units: "credited_units",
  amount: "amount",
  meter_id: "meter_id"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
["created_at", "modified_at", "id", "consumed_units", "credited_units", "amount", "meter_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:, consumed_units:, credited_units:, amount:, meter_id:) ⇒ CustomerStateSubscriptionMeter

Returns a new instance of CustomerStateSubscriptionMeter.

Parameters:

  • created_at: (String)
  • modified_at: (String, nil)
  • id: (String)
  • consumed_units: (Float)
  • credited_units: (Integer)
  • amount: (Integer)
  • meter_id: (String)


20498
20499
20500
20501
20502
20503
20504
20505
20506
20507
20508
20509
20510
20511
20512
20513
20514
20515
# File 'lib/pago/v2026_04/models.rb', line 20498

def initialize(
  created_at:,
  modified_at:,
  id:,
  consumed_units:,
  credited_units:,
  amount:,
  meter_id:
)
  super()
  assign(:created_at, created_at)
  assign(:modified_at, modified_at)
  assign(:id, id)
  assign(:consumed_units, consumed_units)
  assign(:credited_units, credited_units)
  assign(:amount, amount)
  assign(:meter_id, meter_id)
end

Instance Attribute Details

#amountInteger (readonly)

The amount due in cents so far in this billing period.

Returns:

  • (Integer)


20492
20493
20494
# File 'lib/pago/v2026_04/models.rb', line 20492

def amount
  @amount
end

#consumed_unitsFloat (readonly)

The number of consumed units so far in this billing period.

Returns:

  • (Float)


20484
20485
20486
# File 'lib/pago/v2026_04/models.rb', line 20484

def consumed_units
  @consumed_units
end

#created_atString (readonly)

Creation timestamp of the object.

Returns:

  • (String)


20472
20473
20474
# File 'lib/pago/v2026_04/models.rb', line 20472

def created_at
  @created_at
end

#credited_unitsInteger (readonly)

The number of credited units so far in this billing period.

Returns:

  • (Integer)


20488
20489
20490
# File 'lib/pago/v2026_04/models.rb', line 20488

def credited_units
  @credited_units
end

#idString (readonly)

The ID of the object.

Returns:

  • (String)


20480
20481
20482
# File 'lib/pago/v2026_04/models.rb', line 20480

def id
  @id
end

#meter_idString (readonly)

The ID of the meter.

Returns:

  • (String)


20496
20497
20498
# File 'lib/pago/v2026_04/models.rb', line 20496

def meter_id
  @meter_id
end

#modified_atString? (readonly)

Last modification timestamp of the object.

Returns:

  • (String, nil)


20476
20477
20478
# File 'lib/pago/v2026_04/models.rb', line 20476

def modified_at
  @modified_at
end

Class Method Details

.from_json(data) ⇒ CustomerStateSubscriptionMeter?

Parameters:

  • data (Hash, String, nil)

Returns:



20519
20520
20521
20522
20523
20524
20525
20526
20527
20528
20529
20530
20531
20532
20533
20534
20535
20536
# File 'lib/pago/v2026_04/models.rb', line 20519

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),
      consumed_units: (data.key?("consumed_units") ? data["consumed_units"] : ::Pago::UNSET),
      credited_units: (data.key?("credited_units") ? data["credited_units"] : ::Pago::UNSET),
      amount: (data.key?("amount") ? data["amount"] : ::Pago::UNSET),
      meter_id: (data.key?("meter_id") ? data["meter_id"] : ::Pago::UNSET)
    ),
    data
  )
end