Class: Pago::V2026_04::Models::CustomerStateMeter
- Defined in:
- lib/pago/v2026_04/models.rb,
sig/pago/v2026_04/generated.rbs
Overview
An active meter for a customer, with latest consumed and credited units.
Constant Summary collapse
- JSON_KEYS =
{ id: "id", created_at: "created_at", modified_at: "modified_at", meter_id: "meter_id", consumed_units: "consumed_units", credited_units: "credited_units", balance: "balance" }.freeze
- REQUIRED_KEYS =
["id", "created_at", "modified_at", "meter_id", "consumed_units", "credited_units", "balance"].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.
-
#id ⇒ String
readonly
The ID of the object.
-
#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:, meter_id:, consumed_units:, credited_units:, balance:) ⇒ CustomerStateMeter
constructor
A new instance of CustomerStateMeter.
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:, meter_id:, consumed_units:, credited_units:, balance:) ⇒ CustomerStateMeter
Returns a new instance of CustomerStateMeter.
20233 20234 20235 20236 20237 20238 20239 20240 20241 20242 20243 20244 20245 20246 20247 20248 20249 20250 |
# File 'lib/pago/v2026_04/models.rb', line 20233 def initialize( id:, created_at:, modified_at:, meter_id:, consumed_units:, credited_units:, balance: ) super() assign(:id, id) assign(:created_at, created_at) assign(:modified_at, modified_at) assign(:meter_id, meter_id) assign(:consumed_units, consumed_units) assign(:credited_units, credited_units) assign(:balance, balance) end |
Instance Attribute Details
#balance ⇒ Float (readonly)
The balance of the meter, i.e. the difference between credited and consumed units.
20231 20232 20233 |
# File 'lib/pago/v2026_04/models.rb', line 20231 def balance @balance end |
#consumed_units ⇒ Float (readonly)
The number of consumed units.
20223 20224 20225 |
# File 'lib/pago/v2026_04/models.rb', line 20223 def consumed_units @consumed_units end |
#created_at ⇒ String (readonly)
Creation timestamp of the object.
20211 20212 20213 |
# File 'lib/pago/v2026_04/models.rb', line 20211 def created_at @created_at end |
#credited_units ⇒ Integer (readonly)
The number of credited units.
20227 20228 20229 |
# File 'lib/pago/v2026_04/models.rb', line 20227 def credited_units @credited_units end |
#id ⇒ String (readonly)
The ID of the object.
20207 20208 20209 |
# File 'lib/pago/v2026_04/models.rb', line 20207 def id @id end |
#meter_id ⇒ String (readonly)
The ID of the meter.
20219 20220 20221 |
# File 'lib/pago/v2026_04/models.rb', line 20219 def meter_id @meter_id end |
#modified_at ⇒ String? (readonly)
Last modification timestamp of the object.
20215 20216 20217 |
# File 'lib/pago/v2026_04/models.rb', line 20215 def modified_at @modified_at end |
Class Method Details
.from_json(data) ⇒ CustomerStateMeter?
20254 20255 20256 20257 20258 20259 20260 20261 20262 20263 20264 20265 20266 20267 20268 20269 20270 20271 |
# File 'lib/pago/v2026_04/models.rb', line 20254 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), 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) ), data ) end |