Class: ApiReference::NewBillableMetric
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::NewBillableMetric
- Defined in:
- lib/api_reference/models/new_billable_metric.rb
Overview
NewBillableMetric Model.
Instance Attribute Summary collapse
-
#description ⇒ String
A description of the metric.
-
#item_id ⇒ String
The id of the item.
-
#metadata ⇒ Hash[String, String]
User-specified key/value pairs for the resource.
-
#name ⇒ String
The name of the metric.
-
#sql ⇒ String
A sql string defining the metric.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(sql:, name:, item_id:, description:, metadata: SKIP) ⇒ NewBillableMetric
constructor
A new instance of NewBillableMetric.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(sql:, name:, item_id:, description:, metadata: SKIP) ⇒ NewBillableMetric
Returns a new instance of NewBillableMetric.
60 61 62 63 64 65 66 |
# File 'lib/api_reference/models/new_billable_metric.rb', line 60 def initialize(sql:, name:, item_id:, description:, metadata: SKIP) @metadata = unless == SKIP @sql = sql @name = name @item_id = item_id @description = description end |
Instance Attribute Details
#description ⇒ String
A description of the metric.
32 33 34 |
# File 'lib/api_reference/models/new_billable_metric.rb', line 32 def description @description end |
#item_id ⇒ String
The id of the item
28 29 30 |
# File 'lib/api_reference/models/new_billable_metric.rb', line 28 def item_id @item_id end |
#metadata ⇒ Hash[String, String]
User-specified key/value pairs for the resource. Individual keys can be
removed by setting the value to null, and the entire metadata mapping
can be cleared by setting metadata to null.
16 17 18 |
# File 'lib/api_reference/models/new_billable_metric.rb', line 16 def @metadata end |
#name ⇒ String
The name of the metric.
24 25 26 |
# File 'lib/api_reference/models/new_billable_metric.rb', line 24 def name @name end |
#sql ⇒ String
A sql string defining the metric.
20 21 22 |
# File 'lib/api_reference/models/new_billable_metric.rb', line 20 def sql @sql end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/api_reference/models/new_billable_metric.rb', line 69 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. sql = hash.key?('sql') ? hash['sql'] : nil name = hash.key?('name') ? hash['name'] : nil item_id = hash.key?('item_id') ? hash['item_id'] : nil description = hash.key?('description') ? hash['description'] : nil = hash.key?('metadata') ? hash['metadata'] : SKIP # Create object from extracted values. NewBillableMetric.new(sql: sql, name: name, item_id: item_id, description: description, metadata: ) end |
.names ⇒ Object
A mapping from model property names to API property names.
35 36 37 38 39 40 41 42 43 |
# File 'lib/api_reference/models/new_billable_metric.rb', line 35 def self.names @_hash = {} if @_hash.nil? @_hash['metadata'] = 'metadata' @_hash['sql'] = 'sql' @_hash['name'] = 'name' @_hash['item_id'] = 'item_id' @_hash['description'] = 'description' @_hash end |
.nullables ⇒ Object
An array for nullable fields
53 54 55 56 57 58 |
# File 'lib/api_reference/models/new_billable_metric.rb', line 53 def self.nullables %w[ metadata description ] end |
.optionals ⇒ Object
An array for optional fields
46 47 48 49 50 |
# File 'lib/api_reference/models/new_billable_metric.rb', line 46 def self.optionals %w[ metadata ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
95 96 97 98 99 |
# File 'lib/api_reference/models/new_billable_metric.rb', line 95 def inspect class_name = self.class.name.split('::').last "<#{class_name} metadata: #{@metadata.inspect}, sql: #{@sql.inspect}, name:"\ " #{@name.inspect}, item_id: #{@item_id.inspect}, description: #{@description.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
88 89 90 91 92 |
# File 'lib/api_reference/models/new_billable_metric.rb', line 88 def to_s class_name = self.class.name.split('::').last "<#{class_name} metadata: #{@metadata}, sql: #{@sql}, name: #{@name}, item_id: #{@item_id},"\ " description: #{@description}>" end |