Class: Pago::V2026_04::Models::CustomerMeter
- Defined in:
- lib/pago/v2026_04/models.rb,
sig/pago/v2026_04/generated.rbs
Overview
An active customer meter, with current consumed and credited units.
Constant Summary collapse
- JSON_KEYS =
{ 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", customer: "customer", meter: "meter" }.freeze
- REQUIRED_KEYS =
["id", "created_at", "modified_at", "customer_id", "meter_id", "consumed_units", "credited_units", "balance", "customer", "meter"].freeze
Instance Attribute Summary collapse
-
#balance ⇒ Float
readonly
The balance of the meter, i.e.
-
#consumed_units ⇒ Float
readonly
The number of consumed units.
-
#created_at ⇒ String
readonly
Creation timestamp of the object.
-
#credited_units ⇒ Integer
readonly
The number of credited units.
- #customer ⇒ Object readonly
-
#customer_id ⇒ String
readonly
The ID of the customer.
-
#id ⇒ String
readonly
The ID of the object.
- #meter ⇒ Models::Meter readonly
-
#meter_id ⇒ String
readonly
The ID of the meter.
-
#modified_at ⇒ String?
readonly
Last modification timestamp of the object.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id:, created_at:, modified_at:, customer_id:, meter_id:, consumed_units:, credited_units:, balance:, customer:, meter:) ⇒ CustomerMeter
constructor
A new instance of CustomerMeter.
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:, customer:, meter:) ⇒ CustomerMeter
Returns a new instance of CustomerMeter.
17197 17198 17199 17200 17201 17202 17203 17204 17205 17206 17207 17208 17209 17210 17211 17212 17213 17214 17215 17216 17217 17218 17219 17220 |
# File 'lib/pago/v2026_04/models.rb', line 17197 def initialize( id:, created_at:, modified_at:, customer_id:, meter_id:, consumed_units:, credited_units:, balance:, customer:, 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(:customer, customer) assign(:meter, meter) end |
Instance Attribute Details
#balance ⇒ Float (readonly)
The balance of the meter, i.e. the difference between credited and consumed units.
17189 17190 17191 |
# File 'lib/pago/v2026_04/models.rb', line 17189 def balance @balance end |
#consumed_units ⇒ Float (readonly)
The number of consumed units.
17181 17182 17183 |
# File 'lib/pago/v2026_04/models.rb', line 17181 def consumed_units @consumed_units end |
#created_at ⇒ String (readonly)
Creation timestamp of the object.
17165 17166 17167 |
# File 'lib/pago/v2026_04/models.rb', line 17165 def created_at @created_at end |
#credited_units ⇒ Integer (readonly)
The number of credited units.
17185 17186 17187 |
# File 'lib/pago/v2026_04/models.rb', line 17185 def credited_units @credited_units end |
#customer ⇒ Object (readonly)
17192 17193 17194 |
# File 'lib/pago/v2026_04/models.rb', line 17192 def customer @customer end |
#customer_id ⇒ String (readonly)
The ID of the customer.
17173 17174 17175 |
# File 'lib/pago/v2026_04/models.rb', line 17173 def customer_id @customer_id end |
#id ⇒ String (readonly)
The ID of the object.
17161 17162 17163 |
# File 'lib/pago/v2026_04/models.rb', line 17161 def id @id end |
#meter ⇒ Models::Meter (readonly)
17195 17196 17197 |
# File 'lib/pago/v2026_04/models.rb', line 17195 def meter @meter end |
#meter_id ⇒ String (readonly)
The ID of the meter.
17177 17178 17179 |
# File 'lib/pago/v2026_04/models.rb', line 17177 def meter_id @meter_id end |
#modified_at ⇒ String? (readonly)
Last modification timestamp of the object.
17169 17170 17171 |
# File 'lib/pago/v2026_04/models.rb', line 17169 def modified_at @modified_at end |
Class Method Details
.from_json(data) ⇒ CustomerMeter?
17224 17225 17226 17227 17228 17229 17230 17231 17232 17233 17234 17235 17236 17237 17238 17239 17240 17241 17242 17243 17244 |
# File 'lib/pago/v2026_04/models.rb', line 17224 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), customer: (data.key?("customer") ? Unions::Customer.from_json(data["customer"]) : ::Pago::UNSET), meter: (data.key?("meter") ? Models::Meter.from_json(data["meter"]) : ::Pago::UNSET) ), data ) end |