Class: Pago::V2026_04::Models::Meter
- Defined in:
- lib/pago/v2026_04/models.rb,
sig/pago/v2026_04/generated.rbs
Constant Summary collapse
- JSON_KEYS =
{ metadata: "metadata", created_at: "created_at", modified_at: "modified_at", id: "id", name: "name", unit: "unit", custom_label: "custom_label", custom_multiplier: "custom_multiplier", filter: "filter", aggregation: "aggregation", organization_id: "organization_id", archived_at: "archived_at" }.freeze
- REQUIRED_KEYS =
["metadata", "created_at", "modified_at", "id", "name", "unit", "filter", "aggregation", "organization_id"].freeze
Instance Attribute Summary collapse
-
#aggregation ⇒ Models::CountAggregation, ...
readonly
The aggregation to apply on the filtered events to calculate the meter.
-
#archived_at ⇒ String?
readonly
Whether the meter is archived and the time it was archived.
-
#created_at ⇒ String
readonly
Creation timestamp of the object.
-
#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
-
#id ⇒ String
readonly
The ID of the object.
- #metadata ⇒ Hash{String => String, Integer, Float, Boolean} readonly
-
#modified_at ⇒ String?
readonly
Last modification timestamp of the object.
-
#name ⇒ String
readonly
The name of the meter.
-
#organization_id ⇒ String
readonly
The ID of the organization owning the meter.
- #unit ⇒ String readonly
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(metadata:, created_at:, modified_at:, id:, name:, unit:, custom_label: ::Pago::UNSET, custom_multiplier: ::Pago::UNSET, filter:, aggregation:, organization_id:, archived_at: ::Pago::UNSET) ⇒ Meter
constructor
A new instance of Meter.
Methods inherited from Model
#==, #[], #field_set?, #hash, #inspect, json_keys, required_json_keys, #to_json, #to_json_hash, wrap_raw
Constructor Details
#initialize(metadata:, created_at:, modified_at:, id:, name:, unit:, custom_label: ::Pago::UNSET, custom_multiplier: ::Pago::UNSET, filter:, aggregation:, organization_id:, archived_at: ::Pago::UNSET) ⇒ Meter
Returns a new instance of Meter.
29067 29068 29069 29070 29071 29072 29073 29074 29075 29076 29077 29078 29079 29080 29081 29082 29083 29084 29085 29086 29087 29088 29089 29090 29091 29092 29093 29094 |
# File 'lib/pago/v2026_04/models.rb', line 29067 def initialize( metadata:, created_at:, modified_at:, id:, name:, unit:, custom_label: ::Pago::UNSET, custom_multiplier: ::Pago::UNSET, filter:, aggregation:, organization_id:, archived_at: ::Pago::UNSET ) super() assign(:metadata, ) assign(:created_at, created_at) assign(:modified_at, modified_at) assign(:id, id) assign(:name, name) assign(:unit, unit) assign(:custom_label, custom_label) assign(:custom_multiplier, custom_multiplier) assign(:filter, filter) assign(:aggregation, aggregation) assign(:organization_id, organization_id) assign(:archived_at, archived_at) end |
Instance Attribute Details
#aggregation ⇒ Models::CountAggregation, ... (readonly)
The aggregation to apply on the filtered events to calculate the meter.
29057 29058 29059 |
# File 'lib/pago/v2026_04/models.rb', line 29057 def aggregation @aggregation end |
#archived_at ⇒ String? (readonly)
Whether the meter is archived and the time it was archived.
29065 29066 29067 |
# File 'lib/pago/v2026_04/models.rb', line 29065 def archived_at @archived_at end |
#created_at ⇒ String (readonly)
Creation timestamp of the object.
29027 29028 29029 |
# File 'lib/pago/v2026_04/models.rb', line 29027 def created_at @created_at end |
#custom_label ⇒ String? (readonly)
The label for the custom unit.
29046 29047 29048 |
# File 'lib/pago/v2026_04/models.rb', line 29046 def custom_label @custom_label end |
#custom_multiplier ⇒ Integer? (readonly)
The multiplier to convert from base unit to display scale.
29050 29051 29052 |
# File 'lib/pago/v2026_04/models.rb', line 29050 def custom_multiplier @custom_multiplier end |
#filter ⇒ Models::Filter (readonly)
29053 29054 29055 |
# File 'lib/pago/v2026_04/models.rb', line 29053 def filter @filter end |
#id ⇒ String (readonly)
The ID of the object.
29035 29036 29037 |
# File 'lib/pago/v2026_04/models.rb', line 29035 def id @id end |
#metadata ⇒ Hash{String => String, Integer, Float, Boolean} (readonly)
29023 29024 29025 |
# File 'lib/pago/v2026_04/models.rb', line 29023 def @metadata end |
#modified_at ⇒ String? (readonly)
Last modification timestamp of the object.
29031 29032 29033 |
# File 'lib/pago/v2026_04/models.rb', line 29031 def modified_at @modified_at end |
#name ⇒ String (readonly)
The name of the meter. Will be shown on customer's invoices and usage.
29039 29040 29041 |
# File 'lib/pago/v2026_04/models.rb', line 29039 def name @name end |
#organization_id ⇒ String (readonly)
The ID of the organization owning the meter.
29061 29062 29063 |
# File 'lib/pago/v2026_04/models.rb', line 29061 def organization_id @organization_id end |
#unit ⇒ String (readonly)
29042 29043 29044 |
# File 'lib/pago/v2026_04/models.rb', line 29042 def unit @unit end |
Class Method Details
.from_json(data) ⇒ Meter?
29098 29099 29100 29101 29102 29103 29104 29105 29106 29107 29108 29109 29110 29111 29112 29113 29114 29115 29116 29117 29118 29119 29120 |
# File 'lib/pago/v2026_04/models.rb', line 29098 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), 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), 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), organization_id: (data.key?("organization_id") ? data["organization_id"] : ::Pago::UNSET), archived_at: (data.key?("archived_at") ? data["archived_at"] : ::Pago::UNSET) ), data ) end |