Class: Verizon::DataTrigger2
- Defined in:
- lib/verizon/models/data_trigger2.rb
Overview
DataTrigger2 Model.
Instance Attribute Summary collapse
-
#action ⇒ Actionobject
The interval to monitor for the threshold.
-
#allowance_threshold ⇒ AllowanceThreshold
The interval to monitor for the threshold.
-
#comparitor ⇒ Comparitor
The boolean of the comparison.
-
#condition_type ⇒ ConditionType
The condition type being monitored.
-
#cycle_type ⇒ RulesCycleType
The interval to monitor for the threshold.
-
#device_group ⇒ DeviceGroupFilterCriteria
TODO: Write general description for this method.
-
#threshold ⇒ Integer
The threshold value the trigger monitors for.
-
#threshold_unit ⇒ ThresholdUnit
The units of the threshold.
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(device_group: SKIP, condition_type: SKIP, comparitor: SKIP, threshold: SKIP, threshold_unit: SKIP, cycle_type: SKIP, allowance_threshold: SKIP, action: SKIP, additional_properties: nil) ⇒ DataTrigger2
constructor
A new instance of DataTrigger2.
-
#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(device_group: SKIP, condition_type: SKIP, comparitor: SKIP, threshold: SKIP, threshold_unit: SKIP, cycle_type: SKIP, allowance_threshold: SKIP, action: SKIP, additional_properties: nil) ⇒ DataTrigger2
Returns a new instance of DataTrigger2.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/verizon/models/data_trigger2.rb', line 82 def initialize(device_group: SKIP, condition_type: SKIP, comparitor: SKIP, threshold: SKIP, threshold_unit: SKIP, cycle_type: SKIP, allowance_threshold: SKIP, action: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @device_group = device_group unless device_group == SKIP @condition_type = condition_type unless condition_type == SKIP @comparitor = comparitor unless comparitor == SKIP @threshold = threshold unless threshold == SKIP @threshold_unit = threshold_unit unless threshold_unit == SKIP @cycle_type = cycle_type unless cycle_type == SKIP @allowance_threshold = allowance_threshold unless allowance_threshold == SKIP @action = action unless action == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#action ⇒ Actionobject
The interval to monitor for the threshold. This can be Daily, Weekly or Monthly
47 48 49 |
# File 'lib/verizon/models/data_trigger2.rb', line 47 def action @action end |
#allowance_threshold ⇒ AllowanceThreshold
The interval to monitor for the threshold. This can be Daily, Weekly or Monthly
42 43 44 |
# File 'lib/verizon/models/data_trigger2.rb', line 42 def allowance_threshold @allowance_threshold end |
#comparitor ⇒ Comparitor
The boolean of the comparison. ‘gt` is Greater Than, `lt` is Less Than and `eq` is Equal To
23 24 25 |
# File 'lib/verizon/models/data_trigger2.rb', line 23 def comparitor @comparitor end |
#condition_type ⇒ ConditionType
The condition type being monitored
18 19 20 |
# File 'lib/verizon/models/data_trigger2.rb', line 18 def condition_type @condition_type end |
#cycle_type ⇒ RulesCycleType
The interval to monitor for the threshold. This can be Daily, Weekly or Monthly
37 38 39 |
# File 'lib/verizon/models/data_trigger2.rb', line 37 def cycle_type @cycle_type end |
#device_group ⇒ DeviceGroupFilterCriteria
TODO: Write general description for this method
14 15 16 |
# File 'lib/verizon/models/data_trigger2.rb', line 14 def device_group @device_group end |
#threshold ⇒ Integer
The threshold value the trigger monitors for
27 28 29 |
# File 'lib/verizon/models/data_trigger2.rb', line 27 def threshold @threshold end |
#threshold_unit ⇒ ThresholdUnit
The units of the threshold. This can be KB, Kilobits, MB, Megabits, or GB, Gigabits
32 33 34 |
# File 'lib/verizon/models/data_trigger2.rb', line 32 def threshold_unit @threshold_unit end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 133 |
# File 'lib/verizon/models/data_trigger2.rb', line 101 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. device_group = DeviceGroupFilterCriteria.from_hash(hash['deviceGroup']) if hash['deviceGroup'] condition_type = hash.key?('conditionType') ? hash['conditionType'] : SKIP comparitor = hash.key?('comparitor') ? hash['comparitor'] : SKIP threshold = hash.key?('threshold') ? hash['threshold'] : SKIP threshold_unit = hash.key?('thresholdUnit') ? hash['thresholdUnit'] : SKIP cycle_type = hash.key?('cycleType') ? hash['cycleType'] : SKIP allowance_threshold = AllowanceThreshold.from_hash(hash['allowanceThreshold']) if hash['allowanceThreshold'] action = Actionobject.from_hash(hash['action']) if hash['action'] # 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. DataTrigger2.new(device_group: device_group, condition_type: condition_type, comparitor: comparitor, threshold: threshold, threshold_unit: threshold_unit, cycle_type: cycle_type, allowance_threshold: allowance_threshold, action: action, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/verizon/models/data_trigger2.rb', line 50 def self.names @_hash = {} if @_hash.nil? @_hash['device_group'] = 'deviceGroup' @_hash['condition_type'] = 'conditionType' @_hash['comparitor'] = 'comparitor' @_hash['threshold'] = 'threshold' @_hash['threshold_unit'] = 'thresholdUnit' @_hash['cycle_type'] = 'cycleType' @_hash['allowance_threshold'] = 'allowanceThreshold' @_hash['action'] = 'action' @_hash end |
.nullables ⇒ Object
An array for nullable fields
78 79 80 |
# File 'lib/verizon/models/data_trigger2.rb', line 78 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/verizon/models/data_trigger2.rb', line 64 def self.optionals %w[ device_group condition_type comparitor threshold threshold_unit cycle_type allowance_threshold action ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
137 138 139 140 141 142 143 |
# File 'lib/verizon/models/data_trigger2.rb', line 137 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
155 156 157 158 159 160 161 162 |
# File 'lib/verizon/models/data_trigger2.rb', line 155 def inspect class_name = self.class.name.split('::').last "<#{class_name} device_group: #{@device_group.inspect}, condition_type:"\ " #{@condition_type.inspect}, comparitor: #{@comparitor.inspect}, threshold:"\ " #{@threshold.inspect}, threshold_unit: #{@threshold_unit.inspect}, cycle_type:"\ " #{@cycle_type.inspect}, allowance_threshold: #{@allowance_threshold.inspect}, action:"\ " #{@action.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
146 147 148 149 150 151 152 |
# File 'lib/verizon/models/data_trigger2.rb', line 146 def to_s class_name = self.class.name.split('::').last "<#{class_name} device_group: #{@device_group}, condition_type: #{@condition_type},"\ " comparitor: #{@comparitor}, threshold: #{@threshold}, threshold_unit: #{@threshold_unit},"\ " cycle_type: #{@cycle_type}, allowance_threshold: #{@allowance_threshold}, action:"\ " #{@action}, additional_properties: #{@additional_properties}>" end |