Class: Pago::V2026_04::Models::CustomerCustomerMeter

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

Constant Summary collapse

JSON_KEYS =

Returns:

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

Returns:

  • (Array[String])
["id", "created_at", "modified_at", "customer_id", "meter_id", "consumed_units", "credited_units", "balance", "meter"].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(id:, created_at:, modified_at:, customer_id:, meter_id:, consumed_units:, credited_units:, balance:, meter:) ⇒ CustomerCustomerMeter

Returns a new instance of CustomerCustomerMeter.

Parameters:

  • id: (String)
  • created_at: (String)
  • modified_at: (String, nil)
  • customer_id: (String)
  • meter_id: (String)
  • consumed_units: (Float)
  • credited_units: (Integer)
  • balance: (Float)
  • meter: (Models::CustomerCustomerMeterMeter)


16447
16448
16449
16450
16451
16452
16453
16454
16455
16456
16457
16458
16459
16460
16461
16462
16463
16464
16465
16466
16467
16468
# File 'lib/pago/v2026_04/models.rb', line 16447

def initialize(
  id:,
  created_at:,
  modified_at:,
  customer_id:,
  meter_id:,
  consumed_units:,
  credited_units:,
  balance:,
  meter:
)
  super()
  assign(:id, id)
  assign(:created_at, created_at)
  assign(:modified_at, modified_at)
  assign(:customer_id, customer_id)
  assign(:meter_id, meter_id)
  assign(:consumed_units, consumed_units)
  assign(:credited_units, credited_units)
  assign(:balance, balance)
  assign(:meter, meter)
end

Instance Attribute Details

#balanceFloat (readonly)

The balance of the meter, i.e. the difference between credited and consumed units.

Returns:

  • (Float)


16442
16443
16444
# File 'lib/pago/v2026_04/models.rb', line 16442

def balance
  @balance
end

#consumed_unitsFloat (readonly)

The number of consumed units.

Returns:

  • (Float)


16434
16435
16436
# File 'lib/pago/v2026_04/models.rb', line 16434

def consumed_units
  @consumed_units
end

#created_atString (readonly)

Creation timestamp of the object.

Returns:

  • (String)


16418
16419
16420
# File 'lib/pago/v2026_04/models.rb', line 16418

def created_at
  @created_at
end

#credited_unitsInteger (readonly)

The number of credited units.

Returns:

  • (Integer)


16438
16439
16440
# File 'lib/pago/v2026_04/models.rb', line 16438

def credited_units
  @credited_units
end

#customer_idString (readonly)

The ID of the customer.

Returns:

  • (String)


16426
16427
16428
# File 'lib/pago/v2026_04/models.rb', line 16426

def customer_id
  @customer_id
end

#idString (readonly)

The ID of the object.

Returns:

  • (String)


16414
16415
16416
# File 'lib/pago/v2026_04/models.rb', line 16414

def id
  @id
end

#meterModels::CustomerCustomerMeterMeter (readonly)



16445
16446
16447
# File 'lib/pago/v2026_04/models.rb', line 16445

def meter
  @meter
end

#meter_idString (readonly)

The ID of the meter.

Returns:

  • (String)


16430
16431
16432
# File 'lib/pago/v2026_04/models.rb', line 16430

def meter_id
  @meter_id
end

#modified_atString? (readonly)

Last modification timestamp of the object.

Returns:

  • (String, nil)


16422
16423
16424
# File 'lib/pago/v2026_04/models.rb', line 16422

def modified_at
  @modified_at
end

Class Method Details

.from_json(data) ⇒ CustomerCustomerMeter?

Parameters:

  • data (Hash, String, nil)

Returns:



16472
16473
16474
16475
16476
16477
16478
16479
16480
16481
16482
16483
16484
16485
16486
16487
16488
16489
16490
16491
# File 'lib/pago/v2026_04/models.rb', line 16472

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(
      id: (data.key?("id") ? data["id"] : ::Pago::UNSET),
      created_at: (data.key?("created_at") ? data["created_at"] : ::Pago::UNSET),
      modified_at: (data.key?("modified_at") ? data["modified_at"] : ::Pago::UNSET),
      customer_id: (data.key?("customer_id") ? data["customer_id"] : ::Pago::UNSET),
      meter_id: (data.key?("meter_id") ? data["meter_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),
      balance: (data.key?("balance") ? data["balance"] : ::Pago::UNSET),
      meter: (data.key?("meter") ? Models::CustomerCustomerMeterMeter.from_json(data["meter"]) : ::Pago::UNSET)
    ),
    data
  )
end