Class: ApiReference::EventOutputConfig1
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::EventOutputConfig1
- Defined in:
- lib/api_reference/models/event_output_config1.rb
Overview
Configuration for event_output pricing
Instance Attribute Summary collapse
-
#default_unit_rate ⇒ String
If provided, this amount will be used as the unit rate when an event does not have a value for the
unit_rating_key. -
#grouping_key ⇒ String
An optional key in the event data to group by (e.g., event ID).
-
#unit_rating_key ⇒ String
The key in the event data to extract the unit rate from.
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(unit_rating_key:, grouping_key: SKIP, default_unit_rate: SKIP) ⇒ EventOutputConfig1
constructor
A new instance of EventOutputConfig1.
-
#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(unit_rating_key:, grouping_key: SKIP, default_unit_rate: SKIP) ⇒ EventOutputConfig1
Returns a new instance of EventOutputConfig1.
52 53 54 55 56 57 |
# File 'lib/api_reference/models/event_output_config1.rb', line 52 def initialize(unit_rating_key:, grouping_key: SKIP, default_unit_rate: SKIP) @unit_rating_key = @grouping_key = grouping_key unless grouping_key == SKIP @default_unit_rate = default_unit_rate unless default_unit_rate == SKIP end |
Instance Attribute Details
#default_unit_rate ⇒ String
If provided, this amount will be used as the unit rate when an event does
not have a value for the unit_rating_key. If not provided, events
missing a unit rate will be ignored.
25 26 27 |
# File 'lib/api_reference/models/event_output_config1.rb', line 25 def default_unit_rate @default_unit_rate end |
#grouping_key ⇒ String
An optional key in the event data to group by (e.g., event ID). All events will also be grouped by their unit rate.
19 20 21 |
# File 'lib/api_reference/models/event_output_config1.rb', line 19 def grouping_key @grouping_key end |
#unit_rating_key ⇒ String
The key in the event data to extract the unit rate from.
14 15 16 |
# File 'lib/api_reference/models/event_output_config1.rb', line 14 def @unit_rating_key end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/api_reference/models/event_output_config1.rb', line 60 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. = hash.key?('unit_rating_key') ? hash['unit_rating_key'] : nil grouping_key = hash.key?('grouping_key') ? hash['grouping_key'] : SKIP default_unit_rate = hash.key?('default_unit_rate') ? hash['default_unit_rate'] : SKIP # Create object from extracted values. EventOutputConfig1.new(unit_rating_key: , grouping_key: grouping_key, default_unit_rate: default_unit_rate) end |
.names ⇒ Object
A mapping from model property names to API property names.
28 29 30 31 32 33 34 |
# File 'lib/api_reference/models/event_output_config1.rb', line 28 def self.names @_hash = {} if @_hash.nil? @_hash['unit_rating_key'] = 'unit_rating_key' @_hash['grouping_key'] = 'grouping_key' @_hash['default_unit_rate'] = 'default_unit_rate' @_hash end |
.nullables ⇒ Object
An array for nullable fields
45 46 47 48 49 50 |
# File 'lib/api_reference/models/event_output_config1.rb', line 45 def self.nullables %w[ grouping_key default_unit_rate ] end |
.optionals ⇒ Object
An array for optional fields
37 38 39 40 41 42 |
# File 'lib/api_reference/models/event_output_config1.rb', line 37 def self.optionals %w[ grouping_key default_unit_rate ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/api_reference/models/event_output_config1.rb', line 78 def self.validate(value) if value.instance_of? self return APIHelper.valid_type?(value., ->(val) { val.instance_of? String }) end return false unless value.instance_of? Hash APIHelper.valid_type?(value['unit_rating_key'], ->(val) { val.instance_of? String }) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
98 99 100 101 102 |
# File 'lib/api_reference/models/event_output_config1.rb', line 98 def inspect class_name = self.class.name.split('::').last "<#{class_name} unit_rating_key: #{@unit_rating_key.inspect}, grouping_key:"\ " #{@grouping_key.inspect}, default_unit_rate: #{@default_unit_rate.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
91 92 93 94 95 |
# File 'lib/api_reference/models/event_output_config1.rb', line 91 def to_s class_name = self.class.name.split('::').last "<#{class_name} unit_rating_key: #{@unit_rating_key}, grouping_key: #{@grouping_key},"\ " default_unit_rate: #{@default_unit_rate}>" end |