Class: ApiReference::UpdateAlertRequestParams

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

Overview

UpdateAlertRequestParams 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(thresholds:, price_filters: SKIP, threshold_overrides: SKIP) ⇒ UpdateAlertRequestParams

Returns a new instance of UpdateAlertRequestParams.



54
55
56
57
58
# File 'lib/api_reference/models/update_alert_request_params.rb', line 54

def initialize(thresholds:, price_filters: SKIP, threshold_overrides: SKIP)
  @thresholds = thresholds
  @price_filters = price_filters unless price_filters == SKIP
  @threshold_overrides = threshold_overrides unless threshold_overrides == SKIP
end

Instance Attribute Details

#price_filtersArray[PriceFilter]

Replaces the price filters on a grouped cost alert; an empty list clears them. Only applicable to cost alerts with grouping_keys. Omit to leave unchanged.

Returns:



21
22
23
# File 'lib/api_reference/models/update_alert_request_params.rb', line 21

def price_filters
  @price_filters
end

#threshold_overridesArray[ThresholdOverrideParams]

Replaces the per-group threshold overrides on a grouped cost alert; an empty list clears them. Only applicable to cost alerts with grouping_keys. Omit to leave unchanged.

Returns:



27
28
29
# File 'lib/api_reference/models/update_alert_request_params.rb', line 27

def threshold_overrides
  @threshold_overrides
end

#thresholdsArray[Threshold]

The thresholds that define the values at which the alert will be triggered.

Returns:



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

def thresholds
  @thresholds
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



61
62
63
64
65
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
95
96
97
98
99
100
# File 'lib/api_reference/models/update_alert_request_params.rb', line 61

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  # Parameter is an array, so we need to iterate through it
  thresholds = nil
  unless hash['thresholds'].nil?
    thresholds = []
    hash['thresholds'].each do |structure|
      thresholds << (Threshold.from_hash(structure) if structure)
    end
  end

  thresholds = nil unless hash.key?('thresholds')
  # Parameter is an array, so we need to iterate through it
  price_filters = nil
  unless hash['price_filters'].nil?
    price_filters = []
    hash['price_filters'].each do |structure|
      price_filters << (PriceFilter.from_hash(structure) if structure)
    end
  end

  price_filters = SKIP unless hash.key?('price_filters')
  # Parameter is an array, so we need to iterate through it
  threshold_overrides = nil
  unless hash['threshold_overrides'].nil?
    threshold_overrides = []
    hash['threshold_overrides'].each do |structure|
      threshold_overrides << (ThresholdOverrideParams.from_hash(structure) if structure)
    end
  end

  threshold_overrides = SKIP unless hash.key?('threshold_overrides')

  # Create object from extracted values.
  UpdateAlertRequestParams.new(thresholds: thresholds,
                               price_filters: price_filters,
                               threshold_overrides: threshold_overrides)
end

.namesObject

A mapping from model property names to API property names.



30
31
32
33
34
35
36
# File 'lib/api_reference/models/update_alert_request_params.rb', line 30

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['thresholds'] = 'thresholds'
  @_hash['price_filters'] = 'price_filters'
  @_hash['threshold_overrides'] = 'threshold_overrides'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  %w[
    price_filters
    threshold_overrides
  ]
end

.optionalsObject

An array for optional fields



39
40
41
42
43
44
# File 'lib/api_reference/models/update_alert_request_params.rb', line 39

def self.optionals
  %w[
    price_filters
    threshold_overrides
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



110
111
112
113
114
# File 'lib/api_reference/models/update_alert_request_params.rb', line 110

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} thresholds: #{@thresholds.inspect}, price_filters:"\
  " #{@price_filters.inspect}, threshold_overrides: #{@threshold_overrides.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



103
104
105
106
107
# File 'lib/api_reference/models/update_alert_request_params.rb', line 103

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} thresholds: #{@thresholds}, price_filters: #{@price_filters},"\
  " threshold_overrides: #{@threshold_overrides}>"
end