Class: ApiReference::EventOutputConfig

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/api_reference/models/event_output_config.rb

Overview

EventOutputConfig Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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) ⇒ EventOutputConfig

Returns a new instance of EventOutputConfig.



52
53
54
55
56
57
# File 'lib/api_reference/models/event_output_config.rb', line 52

def initialize(unit_rating_key:, grouping_key: SKIP,
               default_unit_rate: SKIP)
  @unit_rating_key = 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_rateString

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.

Returns:

  • (String)


25
26
27
# File 'lib/api_reference/models/event_output_config.rb', line 25

def default_unit_rate
  @default_unit_rate
end

#grouping_keyString

An optional key in the event data to group by (e.g., event ID). All events will also be grouped by their unit rate.

Returns:

  • (String)


19
20
21
# File 'lib/api_reference/models/event_output_config.rb', line 19

def grouping_key
  @grouping_key
end

#unit_rating_keyString

The key in the event data to extract the unit rate from.

Returns:

  • (String)


14
15
16
# File 'lib/api_reference/models/event_output_config.rb', line 14

def unit_rating_key
  @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_config.rb', line 60

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  unit_rating_key =
    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.
  EventOutputConfig.new(unit_rating_key: unit_rating_key,
                        grouping_key: grouping_key,
                        default_unit_rate: default_unit_rate)
end

.namesObject

A mapping from model property names to API property names.



28
29
30
31
32
33
34
# File 'lib/api_reference/models/event_output_config.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

.nullablesObject

An array for nullable fields



45
46
47
48
49
50
# File 'lib/api_reference/models/event_output_config.rb', line 45

def self.nullables
  %w[
    grouping_key
    default_unit_rate
  ]
end

.optionalsObject

An array for optional fields



37
38
39
40
41
42
# File 'lib/api_reference/models/event_output_config.rb', line 37

def self.optionals
  %w[
    grouping_key
    default_unit_rate
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



84
85
86
87
88
# File 'lib/api_reference/models/event_output_config.rb', line 84

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_sObject

Provides a human-readable string representation of the object.



77
78
79
80
81
# File 'lib/api_reference/models/event_output_config.rb', line 77

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