Class: Pago::V2026_04::Models::MeterUpdate
- Defined in:
- lib/pago/v2026_04/models.rb,
sig/pago/v2026_04/generated.rbs
Constant Summary collapse
- JSON_KEYS =
{ metadata: "metadata", name: "name", unit: "unit", custom_label: "custom_label", custom_multiplier: "custom_multiplier", filter: "filter", aggregation: "aggregation", is_archived: "is_archived" }.freeze
- REQUIRED_KEYS =
[].freeze
Instance Attribute Summary collapse
-
#aggregation ⇒ Models::CountAggregation, ...
readonly
The aggregation to apply on the filtered events to calculate the meter.
-
#custom_label ⇒ String?
readonly
The label for the custom unit.
-
#custom_multiplier ⇒ Integer?
readonly
The multiplier to convert from base unit to display scale.
-
#filter ⇒ Models::Filter?
readonly
The filter to apply on events that'll be used to calculate the meter.
-
#is_archived ⇒ Boolean?
readonly
Whether the meter is archived.
-
#metadata ⇒ Hash{String => String, Integer, Float, Boolean}
readonly
Key-value object allowing you to store additional information.
-
#name ⇒ String?
readonly
The name of the meter.
-
#unit ⇒ String?
readonly
The unit of the meter.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(metadata: ::Pago::UNSET, name: ::Pago::UNSET, unit: ::Pago::UNSET, custom_label: ::Pago::UNSET, custom_multiplier: ::Pago::UNSET, filter: ::Pago::UNSET, aggregation: ::Pago::UNSET, is_archived: ::Pago::UNSET) ⇒ MeterUpdate
constructor
A new instance of MeterUpdate.
Methods inherited from Model
#==, #[], #field_set?, #hash, #inspect, json_keys, required_json_keys, #to_json, #to_json_hash, wrap_raw
Constructor Details
#initialize(metadata: ::Pago::UNSET, name: ::Pago::UNSET, unit: ::Pago::UNSET, custom_label: ::Pago::UNSET, custom_multiplier: ::Pago::UNSET, filter: ::Pago::UNSET, aggregation: ::Pago::UNSET, is_archived: ::Pago::UNSET) ⇒ MeterUpdate
Returns a new instance of MeterUpdate.
29708 29709 29710 29711 29712 29713 29714 29715 29716 29717 29718 29719 29720 29721 29722 29723 29724 29725 29726 29727 |
# File 'lib/pago/v2026_04/models.rb', line 29708 def initialize( metadata: ::Pago::UNSET, name: ::Pago::UNSET, unit: ::Pago::UNSET, custom_label: ::Pago::UNSET, custom_multiplier: ::Pago::UNSET, filter: ::Pago::UNSET, aggregation: ::Pago::UNSET, is_archived: ::Pago::UNSET ) super() assign(:metadata, ) assign(:name, name) assign(:unit, unit) assign(:custom_label, custom_label) assign(:custom_multiplier, custom_multiplier) assign(:filter, filter) assign(:aggregation, aggregation) assign(:is_archived, is_archived) end |
Instance Attribute Details
#aggregation ⇒ Models::CountAggregation, ... (readonly)
The aggregation to apply on the filtered events to calculate the meter.
29702 29703 29704 |
# File 'lib/pago/v2026_04/models.rb', line 29702 def aggregation @aggregation end |
#custom_label ⇒ String? (readonly)
The label for the custom unit. Required when unit is 'custom'.
29690 29691 29692 |
# File 'lib/pago/v2026_04/models.rb', line 29690 def custom_label @custom_label end |
#custom_multiplier ⇒ Integer? (readonly)
The multiplier to convert from base unit to display scale. Required when unit is 'custom'.
29694 29695 29696 |
# File 'lib/pago/v2026_04/models.rb', line 29694 def custom_multiplier @custom_multiplier end |
#filter ⇒ Models::Filter? (readonly)
The filter to apply on events that'll be used to calculate the meter.
29698 29699 29700 |
# File 'lib/pago/v2026_04/models.rb', line 29698 def filter @filter end |
#is_archived ⇒ Boolean? (readonly)
Whether the meter is archived. Archived meters are no longer used for billing.
29706 29707 29708 |
# File 'lib/pago/v2026_04/models.rb', line 29706 def is_archived @is_archived end |
#metadata ⇒ Hash{String => String, Integer, Float, Boolean} (readonly)
Key-value object allowing you to store additional information.
The key must be a string with a maximum length of 40 characters. The value must be either:
- A string with a maximum length of 500 characters
- An integer
- A floating-point number
- A boolean
You can store up to 50 key-value pairs.
29678 29679 29680 |
# File 'lib/pago/v2026_04/models.rb', line 29678 def @metadata end |
#name ⇒ String? (readonly)
The name of the meter. Will be shown on customer's invoices and usage.
29682 29683 29684 |
# File 'lib/pago/v2026_04/models.rb', line 29682 def name @name end |
#unit ⇒ String? (readonly)
The unit of the meter.
29686 29687 29688 |
# File 'lib/pago/v2026_04/models.rb', line 29686 def unit @unit end |
Class Method Details
.from_json(data) ⇒ MeterUpdate?
29731 29732 29733 29734 29735 29736 29737 29738 29739 29740 29741 29742 29743 29744 29745 29746 29747 29748 29749 |
# File 'lib/pago/v2026_04/models.rb', line 29731 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( metadata: (data.key?("metadata") ? data["metadata"] : ::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), filter: (data.key?("filter") ? Models::Filter.from_json(data["filter"]) : ::Pago::UNSET), aggregation: (data.key?("aggregation") ? ::Pago::Serde.union(data["aggregation"], discriminator: "func", mapping: { "avg" => Models::PropertyAggregation, "count" => Models::CountAggregation, "max" => Models::PropertyAggregation, "min" => Models::PropertyAggregation, "sum" => Models::PropertyAggregation, "unique" => Models::UniqueAggregation }, variants: [Models::CountAggregation, Models::PropertyAggregation, Models::UniqueAggregation]) : ::Pago::UNSET), is_archived: (data.key?("is_archived") ? data["is_archived"] : ::Pago::UNSET) ), data ) end |