Class: Pago::V2026_04::Models::ProductPriceMeter
- Defined in:
- lib/pago/v2026_04/models.rb,
sig/pago/v2026_04/generated.rbs
Overview
A meter associated to a metered price.
Constant Summary collapse
- JSON_KEYS =
{ id: "id", name: "name", unit: "unit", custom_label: "custom_label", custom_multiplier: "custom_multiplier" }.freeze
- REQUIRED_KEYS =
["id", "name", "unit", "custom_label", "custom_multiplier"].freeze
Instance Attribute Summary collapse
-
#custom_label ⇒ String?
readonly
The label for the custom unit.
-
#custom_multiplier ⇒ Integer?
readonly
The multiplier to convert from base unit to display scale.
-
#id ⇒ String
readonly
The ID of the object.
-
#name ⇒ String
readonly
The name of the meter.
- #unit ⇒ String readonly
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id:, name:, unit:, custom_label:, custom_multiplier:) ⇒ ProductPriceMeter
constructor
A new instance of ProductPriceMeter.
Methods inherited from Model
#==, #[], #field_set?, #hash, #inspect, json_keys, required_json_keys, #to_json, #to_json_hash, wrap_raw
Constructor Details
#initialize(id:, name:, unit:, custom_label:, custom_multiplier:) ⇒ ProductPriceMeter
Returns a new instance of ProductPriceMeter.
37480 37481 37482 37483 37484 37485 37486 37487 37488 37489 37490 37491 37492 37493 |
# File 'lib/pago/v2026_04/models.rb', line 37480 def initialize( id:, name:, unit:, custom_label:, custom_multiplier: ) super() assign(:id, id) assign(:name, name) assign(:unit, unit) assign(:custom_label, custom_label) assign(:custom_multiplier, custom_multiplier) end |
Instance Attribute Details
#custom_label ⇒ String? (readonly)
The label for the custom unit.
37474 37475 37476 |
# File 'lib/pago/v2026_04/models.rb', line 37474 def custom_label @custom_label end |
#custom_multiplier ⇒ Integer? (readonly)
The multiplier to convert from base unit to display scale.
37478 37479 37480 |
# File 'lib/pago/v2026_04/models.rb', line 37478 def custom_multiplier @custom_multiplier end |
#id ⇒ String (readonly)
The ID of the object.
37463 37464 37465 |
# File 'lib/pago/v2026_04/models.rb', line 37463 def id @id end |
#name ⇒ String (readonly)
The name of the meter.
37467 37468 37469 |
# File 'lib/pago/v2026_04/models.rb', line 37467 def name @name end |
#unit ⇒ String (readonly)
37470 37471 37472 |
# File 'lib/pago/v2026_04/models.rb', line 37470 def unit @unit end |
Class Method Details
.from_json(data) ⇒ ProductPriceMeter?
37497 37498 37499 37500 37501 37502 37503 37504 37505 37506 37507 37508 37509 37510 37511 37512 |
# File 'lib/pago/v2026_04/models.rb', line 37497 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), name: (data.key?("name") ? data["name"] : ::Pago::UNSET), unit: (data.key?("unit") ? data["unit"] : ::Pago::UNSET), custom_label: (data.key?("custom_label") ? data["custom_label"] : ::Pago::UNSET), custom_multiplier: (data.key?("custom_multiplier") ? data["custom_multiplier"] : ::Pago::UNSET) ), data ) end |