Class: ApiReference::PriceEvaluationRequest

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

Overview

PriceEvaluationRequest 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(price_id: SKIP, price: SKIP, external_price_id: SKIP, filter: SKIP, grouping_keys:, metric_parameter_overrides: SKIP, additional_properties: nil) ⇒ PriceEvaluationRequest

Returns a new instance of PriceEvaluationRequest.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/api_reference/models/price_evaluation_request.rb', line 78

def initialize(price_id: SKIP, price: SKIP, external_price_id: SKIP,
               filter: SKIP, grouping_keys:,
               metric_parameter_overrides: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @price_id = price_id unless price_id == SKIP
  @price = price unless price == SKIP
  @external_price_id = external_price_id unless external_price_id == SKIP
  @filter = filter unless filter == SKIP
  @grouping_keys = grouping_keys unless grouping_keys == SKIP
  unless metric_parameter_overrides == SKIP
    @metric_parameter_overrides =
      metric_parameter_overrides
  end
  @additional_properties = additional_properties
end

Instance Attribute Details

#external_price_idString

The external ID of a price to evaluate that exists in your Orb account.

Returns:

  • (String)


23
24
25
# File 'lib/api_reference/models/price_evaluation_request.rb', line 23

def external_price_id
  @external_price_id
end

#filterString

A boolean computed property used to filter the underlying billable metric

Returns:

  • (String)


29
30
31
# File 'lib/api_reference/models/price_evaluation_request.rb', line 29

def filter
  @filter
end

#grouping_keysArray[String]

Properties (or computed properties) used to group the underlying billable metric

Returns:

  • (Array[String])


35
36
37
# File 'lib/api_reference/models/price_evaluation_request.rb', line 35

def grouping_keys
  @grouping_keys
end

#metric_parameter_overridesObject

Optional overrides for parameterized billable metric parameters. If the metric has parameter definitions and no overrides are provided, defaults will be used.

Returns:

  • (Object)


41
42
43
# File 'lib/api_reference/models/price_evaluation_request.rb', line 41

def metric_parameter_overrides
  @metric_parameter_overrides
end

#priceObject

An inline price definition to evaluate, allowing you to test price configurations before adding them to Orb.

Returns:

  • (Object)


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

def price
  @price
end

#price_idString

The ID of a price to evaluate that exists in your Orb account.

Returns:

  • (String)


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

def price_id
  @price_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
122
123
124
125
126
127
# File 'lib/api_reference/models/price_evaluation_request.rb', line 97

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  price_id = hash.key?('price_id') ? hash['price_id'] : SKIP
  price = hash.key?('price') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:NewFloatingPrice), hash['price']
  ) : SKIP
  external_price_id =
    hash.key?('external_price_id') ? hash['external_price_id'] : SKIP
  filter = hash.key?('filter') ? hash['filter'] : SKIP
  grouping_keys = hash['grouping_keys'] ||= 
  metric_parameter_overrides =
    hash.key?('metric_parameter_overrides') ? hash['metric_parameter_overrides'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  PriceEvaluationRequest.new(price_id: price_id,
                             price: price,
                             external_price_id: external_price_id,
                             filter: filter,
                             grouping_keys: grouping_keys,
                             metric_parameter_overrides: metric_parameter_overrides,
                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



44
45
46
47
48
49
50
51
52
53
# File 'lib/api_reference/models/price_evaluation_request.rb', line 44

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['price_id'] = 'price_id'
  @_hash['price'] = 'price'
  @_hash['external_price_id'] = 'external_price_id'
  @_hash['filter'] = 'filter'
  @_hash['grouping_keys'] = 'grouping_keys'
  @_hash['metric_parameter_overrides'] = 'metric_parameter_overrides'
  @_hash
end

.nullablesObject

An array for nullable fields



68
69
70
71
72
73
74
75
76
# File 'lib/api_reference/models/price_evaluation_request.rb', line 68

def self.nullables
  %w[
    price_id
    price
    external_price_id
    filter
    metric_parameter_overrides
  ]
end

.optionalsObject

An array for optional fields



56
57
58
59
60
61
62
63
64
65
# File 'lib/api_reference/models/price_evaluation_request.rb', line 56

def self.optionals
  %w[
    price_id
    price
    external_price_id
    filter
    grouping_keys
    metric_parameter_overrides
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



131
132
133
134
135
136
137
# File 'lib/api_reference/models/price_evaluation_request.rb', line 131

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



149
150
151
152
153
154
155
# File 'lib/api_reference/models/price_evaluation_request.rb', line 149

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} price_id: #{@price_id.inspect}, price: #{@price.inspect},"\
  " external_price_id: #{@external_price_id.inspect}, filter: #{@filter.inspect},"\
  " grouping_keys: #{@grouping_keys.inspect}, metric_parameter_overrides:"\
  " #{@metric_parameter_overrides.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



140
141
142
143
144
145
146
# File 'lib/api_reference/models/price_evaluation_request.rb', line 140

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} price_id: #{@price_id}, price: #{@price}, external_price_id:"\
  " #{@external_price_id}, filter: #{@filter}, grouping_keys: #{@grouping_keys},"\
  " metric_parameter_overrides: #{@metric_parameter_overrides}, additional_properties:"\
  " #{@additional_properties}>"
end