Class: ApiReference::EvaluateMultiplePricesWithPreviewEventsBody
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::EvaluateMultiplePricesWithPreviewEventsBody
- Defined in:
- lib/api_reference/models/evaluate_multiple_prices_with_preview_events_body.rb
Overview
EvaluateMultiplePricesWithPreviewEventsBody Model.
Instance Attribute Summary collapse
-
#customer_id ⇒ String
The ID of the customer to which this evaluation is scoped.
-
#events ⇒ Array[PreviewEvent]
List of preview events to use instead of actual usage data.
-
#external_customer_id ⇒ String
The external customer ID of the customer to which this evaluation is scoped.
-
#price_evaluations ⇒ Array[PriceEvaluationRequest]
List of prices to evaluate (max 100).
-
#timeframe_end ⇒ DateTime
The exclusive upper bound for event timestamps.
-
#timeframe_start ⇒ DateTime
The inclusive lower bound for event timestamps.
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(timeframe_start:, timeframe_end:, customer_id: SKIP, external_customer_id: SKIP, events: SKIP, price_evaluations: SKIP) ⇒ EvaluateMultiplePricesWithPreviewEventsBody
constructor
A new instance of EvaluateMultiplePricesWithPreviewEventsBody.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_timeframe_end ⇒ Object
- #to_custom_timeframe_start ⇒ Object
-
#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(timeframe_start:, timeframe_end:, customer_id: SKIP, external_customer_id: SKIP, events: SKIP, price_evaluations: SKIP) ⇒ EvaluateMultiplePricesWithPreviewEventsBody
Returns a new instance of EvaluateMultiplePricesWithPreviewEventsBody.
68 69 70 71 72 73 74 75 76 77 |
# File 'lib/api_reference/models/evaluate_multiple_prices_with_preview_events_body.rb', line 68 def initialize(timeframe_start:, timeframe_end:, customer_id: SKIP, external_customer_id: SKIP, events: SKIP, price_evaluations: SKIP) @customer_id = customer_id unless customer_id == SKIP @external_customer_id = external_customer_id unless external_customer_id == SKIP @timeframe_start = timeframe_start @timeframe_end = timeframe_end @events = events unless events == SKIP @price_evaluations = price_evaluations unless price_evaluations == SKIP end |
Instance Attribute Details
#customer_id ⇒ String
The ID of the customer to which this evaluation is scoped.
15 16 17 |
# File 'lib/api_reference/models/evaluate_multiple_prices_with_preview_events_body.rb', line 15 def customer_id @customer_id end |
#events ⇒ Array[PreviewEvent]
List of preview events to use instead of actual usage data
32 33 34 |
# File 'lib/api_reference/models/evaluate_multiple_prices_with_preview_events_body.rb', line 32 def events @events end |
#external_customer_id ⇒ String
The external customer ID of the customer to which this evaluation is scoped.
20 21 22 |
# File 'lib/api_reference/models/evaluate_multiple_prices_with_preview_events_body.rb', line 20 def external_customer_id @external_customer_id end |
#price_evaluations ⇒ Array[PriceEvaluationRequest]
List of prices to evaluate (max 100)
36 37 38 |
# File 'lib/api_reference/models/evaluate_multiple_prices_with_preview_events_body.rb', line 36 def price_evaluations @price_evaluations end |
#timeframe_end ⇒ DateTime
The exclusive upper bound for event timestamps
28 29 30 |
# File 'lib/api_reference/models/evaluate_multiple_prices_with_preview_events_body.rb', line 28 def timeframe_end @timeframe_end end |
#timeframe_start ⇒ DateTime
The inclusive lower bound for event timestamps
24 25 26 |
# File 'lib/api_reference/models/evaluate_multiple_prices_with_preview_events_body.rb', line 24 def timeframe_start @timeframe_start end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/api_reference/models/evaluate_multiple_prices_with_preview_events_body.rb', line 80 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. timeframe_start = if hash.key?('timeframe_start') (DateTimeHelper.from_rfc3339(hash['timeframe_start']) if hash['timeframe_start']) end timeframe_end = if hash.key?('timeframe_end') (DateTimeHelper.from_rfc3339(hash['timeframe_end']) if hash['timeframe_end']) end customer_id = hash.key?('customer_id') ? hash['customer_id'] : SKIP external_customer_id = hash.key?('external_customer_id') ? hash['external_customer_id'] : SKIP # Parameter is an array, so we need to iterate through it events = nil unless hash['events'].nil? events = [] hash['events'].each do |structure| events << (PreviewEvent.from_hash(structure) if structure) end end events = SKIP unless hash.key?('events') # Parameter is an array, so we need to iterate through it price_evaluations = nil unless hash['price_evaluations'].nil? price_evaluations = [] hash['price_evaluations'].each do |structure| price_evaluations << (PriceEvaluationRequest.from_hash(structure) if structure) end end price_evaluations = SKIP unless hash.key?('price_evaluations') # Create object from extracted values. EvaluateMultiplePricesWithPreviewEventsBody.new(timeframe_start: timeframe_start, timeframe_end: timeframe_end, customer_id: customer_id, external_customer_id: external_customer_id, events: events, price_evaluations: price_evaluations) end |
.names ⇒ Object
A mapping from model property names to API property names.
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/api_reference/models/evaluate_multiple_prices_with_preview_events_body.rb', line 39 def self.names @_hash = {} if @_hash.nil? @_hash['customer_id'] = 'customer_id' @_hash['external_customer_id'] = 'external_customer_id' @_hash['timeframe_start'] = 'timeframe_start' @_hash['timeframe_end'] = 'timeframe_end' @_hash['events'] = 'events' @_hash['price_evaluations'] = 'price_evaluations' @_hash end |
.nullables ⇒ Object
An array for nullable fields
61 62 63 64 65 66 |
# File 'lib/api_reference/models/evaluate_multiple_prices_with_preview_events_body.rb', line 61 def self.nullables %w[ customer_id external_customer_id ] end |
.optionals ⇒ Object
An array for optional fields
51 52 53 54 55 56 57 58 |
# File 'lib/api_reference/models/evaluate_multiple_prices_with_preview_events_body.rb', line 51 def self.optionals %w[ customer_id external_customer_id events price_evaluations ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
140 141 142 143 144 145 146 |
# File 'lib/api_reference/models/evaluate_multiple_prices_with_preview_events_body.rb', line 140 def inspect class_name = self.class.name.split('::').last "<#{class_name} customer_id: #{@customer_id.inspect}, external_customer_id:"\ " #{@external_customer_id.inspect}, timeframe_start: #{@timeframe_start.inspect},"\ " timeframe_end: #{@timeframe_end.inspect}, events: #{@events.inspect}, price_evaluations:"\ " #{@price_evaluations.inspect}>" end |
#to_custom_timeframe_end ⇒ Object
127 128 129 |
# File 'lib/api_reference/models/evaluate_multiple_prices_with_preview_events_body.rb', line 127 def to_custom_timeframe_end DateTimeHelper.to_rfc3339(timeframe_end) end |
#to_custom_timeframe_start ⇒ Object
123 124 125 |
# File 'lib/api_reference/models/evaluate_multiple_prices_with_preview_events_body.rb', line 123 def to_custom_timeframe_start DateTimeHelper.to_rfc3339(timeframe_start) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
132 133 134 135 136 137 |
# File 'lib/api_reference/models/evaluate_multiple_prices_with_preview_events_body.rb', line 132 def to_s class_name = self.class.name.split('::').last "<#{class_name} customer_id: #{@customer_id}, external_customer_id:"\ " #{@external_customer_id}, timeframe_start: #{@timeframe_start}, timeframe_end:"\ " #{@timeframe_end}, events: #{@events}, price_evaluations: #{@price_evaluations}>" end |