Class: ApiReference::DailyCreditAllowanceConfig1
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::DailyCreditAllowanceConfig1
- Defined in:
- lib/api_reference/models/daily_credit_allowance_config1.rb
Overview
Configuration for daily_credit_allowance pricing
Instance Attribute Summary collapse
-
#daily_allowance ⇒ String
Credits granted per day.
-
#default_unit_amount ⇒ String
Default per-unit credit rate for any usage not bucketed into a specified matrix_value.
-
#dimensions ⇒ Array[String]
One or two event property values to evaluate matrix groups by.
-
#event_day_property ⇒ String
Event property whose value identifies the day bucket the event belongs to (e.g. 'event_day' set to an ISO date string in the customer's timezone).
-
#matrix_values ⇒ Array[DailyCreditAllowanceMatrixValue]
Per-dimension credit rates.
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(event_day_property:, dimensions:, default_unit_amount:, daily_allowance:, matrix_values:) ⇒ DailyCreditAllowanceConfig1
constructor
A new instance of DailyCreditAllowanceConfig1.
-
#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(event_day_property:, dimensions:, default_unit_amount:, daily_allowance:, matrix_values:) ⇒ DailyCreditAllowanceConfig1
Returns a new instance of DailyCreditAllowanceConfig1.
56 57 58 59 60 61 62 63 |
# File 'lib/api_reference/models/daily_credit_allowance_config1.rb', line 56 def initialize(event_day_property:, dimensions:, default_unit_amount:, daily_allowance:, matrix_values:) @event_day_property = event_day_property @dimensions = dimensions @default_unit_amount = default_unit_amount @daily_allowance = daily_allowance @matrix_values = matrix_values end |
Instance Attribute Details
#daily_allowance ⇒ String
Credits granted per day. Lose-it-or-use-it; does not roll over.
29 30 31 |
# File 'lib/api_reference/models/daily_credit_allowance_config1.rb', line 29 def daily_allowance @daily_allowance end |
#default_unit_amount ⇒ String
Default per-unit credit rate for any usage not bucketed into a specified matrix_value
25 26 27 |
# File 'lib/api_reference/models/daily_credit_allowance_config1.rb', line 25 def default_unit_amount @default_unit_amount end |
#dimensions ⇒ Array[String]
One or two event property values to evaluate matrix groups by
20 21 22 |
# File 'lib/api_reference/models/daily_credit_allowance_config1.rb', line 20 def dimensions @dimensions end |
#event_day_property ⇒ String
Event property whose value identifies the day bucket the event belongs to (e.g. 'event_day' set to an ISO date string in the customer's timezone). The allowance resets per distinct value of this property.
16 17 18 |
# File 'lib/api_reference/models/daily_credit_allowance_config1.rb', line 16 def event_day_property @event_day_property end |
#matrix_values ⇒ Array[DailyCreditAllowanceMatrixValue]
Per-dimension credit rates
33 34 35 |
# File 'lib/api_reference/models/daily_credit_allowance_config1.rb', line 33 def matrix_values @matrix_values end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/api_reference/models/daily_credit_allowance_config1.rb', line 66 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. event_day_property = hash.key?('event_day_property') ? hash['event_day_property'] : nil dimensions = hash.key?('dimensions') ? hash['dimensions'] : nil default_unit_amount = hash.key?('default_unit_amount') ? hash['default_unit_amount'] : nil daily_allowance = hash.key?('daily_allowance') ? hash['daily_allowance'] : nil # Parameter is an array, so we need to iterate through it matrix_values = nil unless hash['matrix_values'].nil? matrix_values = [] hash['matrix_values'].each do |structure| matrix_values << (DailyCreditAllowanceMatrixValue.from_hash(structure) if structure) end end matrix_values = nil unless hash.key?('matrix_values') # Create object from extracted values. DailyCreditAllowanceConfig1.new(event_day_property: event_day_property, dimensions: dimensions, default_unit_amount: default_unit_amount, daily_allowance: daily_allowance, matrix_values: matrix_values) end |
.names ⇒ Object
A mapping from model property names to API property names.
36 37 38 39 40 41 42 43 44 |
# File 'lib/api_reference/models/daily_credit_allowance_config1.rb', line 36 def self.names @_hash = {} if @_hash.nil? @_hash['event_day_property'] = 'event_day_property' @_hash['dimensions'] = 'dimensions' @_hash['default_unit_amount'] = 'default_unit_amount' @_hash['daily_allowance'] = 'daily_allowance' @_hash['matrix_values'] = 'matrix_values' @_hash end |
.nullables ⇒ Object
An array for nullable fields
52 53 54 |
# File 'lib/api_reference/models/daily_credit_allowance_config1.rb', line 52 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
47 48 49 |
# File 'lib/api_reference/models/daily_credit_allowance_config1.rb', line 47 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/api_reference/models/daily_credit_allowance_config1.rb', line 98 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.event_day_property, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.dimensions, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.default_unit_amount, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.daily_allowance, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.matrix_values, ->(val) { DailyCreditAllowanceMatrixValue.validate(val) }, is_model_hash: true, is_inner_model_hash: true) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['event_day_property'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['dimensions'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['default_unit_amount'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['daily_allowance'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['matrix_values'], ->(val) { DailyCreditAllowanceMatrixValue.validate(val) }, is_model_hash: true, is_inner_model_hash: true) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
143 144 145 146 147 148 |
# File 'lib/api_reference/models/daily_credit_allowance_config1.rb', line 143 def inspect class_name = self.class.name.split('::').last "<#{class_name} event_day_property: #{@event_day_property.inspect}, dimensions:"\ " #{@dimensions.inspect}, default_unit_amount: #{@default_unit_amount.inspect},"\ " daily_allowance: #{@daily_allowance.inspect}, matrix_values: #{@matrix_values.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
135 136 137 138 139 140 |
# File 'lib/api_reference/models/daily_credit_allowance_config1.rb', line 135 def to_s class_name = self.class.name.split('::').last "<#{class_name} event_day_property: #{@event_day_property}, dimensions: #{@dimensions},"\ " default_unit_amount: #{@default_unit_amount}, daily_allowance: #{@daily_allowance},"\ " matrix_values: #{@matrix_values}>" end |