Class: Pago::V2026_04::Models::CustomerSubscriptionMeter

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])
{
  created_at: "created_at",
  modified_at: "modified_at",
  id: "id",
  consumed_units: "consumed_units",
  credited_units: "credited_units",
  amount: "amount",
  meter_id: "meter_id",
  meter: "meter"
}.freeze
REQUIRED_KEYS =

Returns:

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

Returns a new instance of CustomerSubscriptionMeter.

Parameters:

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


21119
21120
21121
21122
21123
21124
21125
21126
21127
21128
21129
21130
21131
21132
21133
21134
21135
21136
21137
21138
# File 'lib/pago/v2026_04/models.rb', line 21119

def initialize(
  created_at:,
  modified_at:,
  id:,
  consumed_units:,
  credited_units:,
  amount:,
  meter_id:,
  meter:
)
  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)
  assign(:meter, meter)
end

Instance Attribute Details

#amountInteger (readonly)

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

Returns:

  • (Integer)


21110
21111
21112
# File 'lib/pago/v2026_04/models.rb', line 21110

def amount
  @amount
end

#consumed_unitsFloat (readonly)

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

Returns:

  • (Float)


21102
21103
21104
# File 'lib/pago/v2026_04/models.rb', line 21102

def consumed_units
  @consumed_units
end

#created_atString (readonly)

Creation timestamp of the object.

Returns:

  • (String)


21090
21091
21092
# File 'lib/pago/v2026_04/models.rb', line 21090

def created_at
  @created_at
end

#credited_unitsInteger (readonly)

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

Returns:

  • (Integer)


21106
21107
21108
# File 'lib/pago/v2026_04/models.rb', line 21106

def credited_units
  @credited_units
end

#idString (readonly)

The ID of the object.

Returns:

  • (String)


21098
21099
21100
# File 'lib/pago/v2026_04/models.rb', line 21098

def id
  @id
end

#meterModels::CustomerSubscriptionMeterMeter (readonly)



21117
21118
21119
# File 'lib/pago/v2026_04/models.rb', line 21117

def meter
  @meter
end

#meter_idString (readonly)

The ID of the meter.

Returns:

  • (String)


21114
21115
21116
# File 'lib/pago/v2026_04/models.rb', line 21114

def meter_id
  @meter_id
end

#modified_atString? (readonly)

Last modification timestamp of the object.

Returns:

  • (String, nil)


21094
21095
21096
# File 'lib/pago/v2026_04/models.rb', line 21094

def modified_at
  @modified_at
end

Class Method Details

.from_json(data) ⇒ CustomerSubscriptionMeter?

Parameters:

  • data (Hash, String, nil)

Returns:



21142
21143
21144
21145
21146
21147
21148
21149
21150
21151
21152
21153
21154
21155
21156
21157
21158
21159
21160
# File 'lib/pago/v2026_04/models.rb', line 21142

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),
      meter: (data.key?("meter") ? Models::CustomerSubscriptionMeterMeter.from_json(data["meter"]) : ::Pago::UNSET)
    ),
    data
  )
end