Class: ApiReference::EvaluateMultiplePricesBody

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

Overview

EvaluateMultiplePricesBody 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(timeframe_start:, timeframe_end:, customer_id: SKIP, external_customer_id: SKIP, price_evaluations: SKIP) ⇒ EvaluateMultiplePricesBody

Returns a new instance of EvaluateMultiplePricesBody.



62
63
64
65
66
67
68
69
# File 'lib/api_reference/models/evaluate_multiple_prices_body.rb', line 62

def initialize(timeframe_start:, timeframe_end:, customer_id: SKIP,
               external_customer_id: 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
  @price_evaluations = price_evaluations unless price_evaluations == SKIP
end

Instance Attribute Details

#customer_idString

The ID of the customer to which this evaluation is scoped.

Returns:

  • (String)


15
16
17
# File 'lib/api_reference/models/evaluate_multiple_prices_body.rb', line 15

def customer_id
  @customer_id
end

#external_customer_idString

The external customer ID of the customer to which this evaluation is scoped.

Returns:

  • (String)


20
21
22
# File 'lib/api_reference/models/evaluate_multiple_prices_body.rb', line 20

def external_customer_id
  @external_customer_id
end

#price_evaluationsArray[PriceEvaluationRequest]

List of prices to evaluate (max 100)

Returns:



32
33
34
# File 'lib/api_reference/models/evaluate_multiple_prices_body.rb', line 32

def price_evaluations
  @price_evaluations
end

#timeframe_endDateTime

The exclusive upper bound for event timestamps

Returns:

  • (DateTime)


28
29
30
# File 'lib/api_reference/models/evaluate_multiple_prices_body.rb', line 28

def timeframe_end
  @timeframe_end
end

#timeframe_startDateTime

The inclusive lower bound for event timestamps

Returns:

  • (DateTime)


24
25
26
# File 'lib/api_reference/models/evaluate_multiple_prices_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.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/api_reference/models/evaluate_multiple_prices_body.rb', line 72

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
  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.
  EvaluateMultiplePricesBody.new(timeframe_start: timeframe_start,
                                 timeframe_end: timeframe_end,
                                 customer_id: customer_id,
                                 external_customer_id: external_customer_id,
                                 price_evaluations: price_evaluations)
end

.namesObject

A mapping from model property names to API property names.



35
36
37
38
39
40
41
42
43
# File 'lib/api_reference/models/evaluate_multiple_prices_body.rb', line 35

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['price_evaluations'] = 'price_evaluations'
  @_hash
end

.nullablesObject

An array for nullable fields



55
56
57
58
59
60
# File 'lib/api_reference/models/evaluate_multiple_prices_body.rb', line 55

def self.nullables
  %w[
    customer_id
    external_customer_id
  ]
end

.optionalsObject

An array for optional fields



46
47
48
49
50
51
52
# File 'lib/api_reference/models/evaluate_multiple_prices_body.rb', line 46

def self.optionals
  %w[
    customer_id
    external_customer_id
    price_evaluations
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



121
122
123
124
125
126
127
# File 'lib/api_reference/models/evaluate_multiple_prices_body.rb', line 121

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}, price_evaluations:"\
  " #{@price_evaluations.inspect}>"
end

#to_custom_timeframe_endObject



108
109
110
# File 'lib/api_reference/models/evaluate_multiple_prices_body.rb', line 108

def to_custom_timeframe_end
  DateTimeHelper.to_rfc3339(timeframe_end)
end

#to_custom_timeframe_startObject



104
105
106
# File 'lib/api_reference/models/evaluate_multiple_prices_body.rb', line 104

def to_custom_timeframe_start
  DateTimeHelper.to_rfc3339(timeframe_start)
end

#to_sObject

Provides a human-readable string representation of the object.



113
114
115
116
117
118
# File 'lib/api_reference/models/evaluate_multiple_prices_body.rb', line 113

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}, price_evaluations: #{@price_evaluations}>"
end