Class: Pago::V2026_04::Models::Metric
- Defined in:
- lib/pago/v2026_04/models.rb,
sig/pago/v2026_04/generated.rbs
Overview
Information about a metric.
Constant Summary collapse
- JSON_KEYS =
{ slug: "slug", display_name: "display_name", type: "type" }.freeze
- REQUIRED_KEYS =
["slug", "display_name", "type"].freeze
Instance Attribute Summary collapse
-
#display_name ⇒ String
readonly
Human-readable name for the metric.
-
#slug ⇒ String
readonly
Unique identifier for the metric.
- #type ⇒ String readonly
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(slug:, display_name:, type:) ⇒ Metric
constructor
A new instance of Metric.
Methods inherited from Model
#==, #[], #field_set?, #hash, #inspect, json_keys, required_json_keys, #to_json, #to_json_hash, wrap_raw
Constructor Details
#initialize(slug:, display_name:, type:) ⇒ Metric
Returns a new instance of Metric.
29772 29773 29774 29775 29776 29777 29778 29779 29780 29781 |
# File 'lib/pago/v2026_04/models.rb', line 29772 def initialize( slug:, display_name:, type: ) super() assign(:slug, slug) assign(:display_name, display_name) assign(:type, type) end |
Instance Attribute Details
#display_name ⇒ String (readonly)
Human-readable name for the metric.
29767 29768 29769 |
# File 'lib/pago/v2026_04/models.rb', line 29767 def display_name @display_name end |
#slug ⇒ String (readonly)
Unique identifier for the metric.
29763 29764 29765 |
# File 'lib/pago/v2026_04/models.rb', line 29763 def slug @slug end |
#type ⇒ String (readonly)
29770 29771 29772 |
# File 'lib/pago/v2026_04/models.rb', line 29770 def type @type end |
Class Method Details
.from_json(data) ⇒ Metric?
29785 29786 29787 29788 29789 29790 29791 29792 29793 29794 29795 29796 29797 29798 |
# File 'lib/pago/v2026_04/models.rb', line 29785 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( slug: (data.key?("slug") ? data["slug"] : ::Pago::UNSET), display_name: (data.key?("display_name") ? data["display_name"] : ::Pago::UNSET), type: (data.key?("type") ? data["type"] : ::Pago::UNSET) ), data ) end |