Class: Verizon::DataTrigger5

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/verizon/models/data_trigger5.rb

Overview

DataTrigger5 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(filter_criteria = SKIP, condition = SKIP, action = SKIP, condition_type = SKIP, comparitor = SKIP, threshold = SKIP, threshold_unit = SKIP, cycle_type = SKIP, allowance_threshold = SKIP, device_group = SKIP, account_group_share = SKIP) ⇒ DataTrigger5

Returns a new instance of DataTrigger5.



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/verizon/models/data_trigger5.rb', line 101

def initialize(filter_criteria = SKIP, condition = SKIP, action = SKIP,
               condition_type = SKIP, comparitor = SKIP, threshold = SKIP,
               threshold_unit = SKIP, cycle_type = SKIP,
               allowance_threshold = SKIP, device_group = SKIP,
                = SKIP)
  @filter_criteria = filter_criteria unless filter_criteria == SKIP
  @condition = condition unless condition == SKIP
  @action = action unless action == 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
  @device_group = device_group unless device_group == SKIP
  @account_group_share =  unless  == SKIP
end

Instance Attribute Details

#account_group_shareAccountGroupShareIndividual1

The interval to monitor for the threshold. This can be Daily, Weekly or Monthly



60
61
62
# File 'lib/verizon/models/data_trigger5.rb', line 60

def 
  @account_group_share
end

#actionAccountLevelActionEnum

The action taken when trigger conditions are met



22
23
24
# File 'lib/verizon/models/data_trigger5.rb', line 22

def action
  @action
end

#allowance_thresholdAllowanceThreshold

The interval to monitor for the threshold. This can be Daily, Weekly or Monthly

Returns:



50
51
52
# File 'lib/verizon/models/data_trigger5.rb', line 50

def allowance_threshold
  @allowance_threshold
end

#comparitorComparitorEnum

The boolean of the comparison. ‘gt` is Greater Than, `lt` is Less Than and `eq` is Equal To

Returns:



31
32
33
# File 'lib/verizon/models/data_trigger5.rb', line 31

def comparitor
  @comparitor
end

#conditionRateplantype2Condition

TODO: Write general description for this method



18
19
20
# File 'lib/verizon/models/data_trigger5.rb', line 18

def condition
  @condition
end

#condition_typeConditionTypeEnum

The condition type being monitored

Returns:



26
27
28
# File 'lib/verizon/models/data_trigger5.rb', line 26

def condition_type
  @condition_type
end

#cycle_typeRulesCycleTypeEnum

The interval to monitor for the threshold. This can be Daily, Weekly or Monthly

Returns:



45
46
47
# File 'lib/verizon/models/data_trigger5.rb', line 45

def cycle_type
  @cycle_type
end

#device_groupDeviceGroupFilterCriteria

The interval to monitor for the threshold. This can be Daily, Weekly or Monthly



55
56
57
# File 'lib/verizon/models/data_trigger5.rb', line 55

def device_group
  @device_group
end

#filter_criteriaAccountLevelFilter

TODO: Write general description for this method

Returns:



14
15
16
# File 'lib/verizon/models/data_trigger5.rb', line 14

def filter_criteria
  @filter_criteria
end

#thresholdInteger

The threshold value the trigger monitors for

Returns:

  • (Integer)


35
36
37
# File 'lib/verizon/models/data_trigger5.rb', line 35

def threshold
  @threshold
end

#threshold_unitThresholdUnitEnum

The units of the threshold. This can be KB, Kilobits, MB, Megabits, or GB, Gigabits

Returns:



40
41
42
# File 'lib/verizon/models/data_trigger5.rb', line 40

def threshold_unit
  @threshold_unit
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/verizon/models/data_trigger5.rb', line 120

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  filter_criteria = AccountLevelFilter.from_hash(hash['filterCriteria']) if
    hash['filterCriteria']
  condition = hash.key?('condition') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:DataTrigger5Condition), hash['condition']
  ) : SKIP
  action = hash.key?('action') ? hash['action'] : SKIP
  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']
  device_group = DeviceGroupFilterCriteria.from_hash(hash['deviceGroup']) if
    hash['deviceGroup']
   = AccountGroupShareIndividual1.from_hash(hash['accountGroupShare']) if
    hash['accountGroupShare']

  # Create object from extracted values.
  DataTrigger5.new(filter_criteria,
                   condition,
                   action,
                   condition_type,
                   comparitor,
                   threshold,
                   threshold_unit,
                   cycle_type,
                   allowance_threshold,
                   device_group,
                   )
end

.namesObject

A mapping from model property names to API property names.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/verizon/models/data_trigger5.rb', line 63

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['filter_criteria'] = 'filterCriteria'
  @_hash['condition'] = 'condition'
  @_hash['action'] = 'action'
  @_hash['condition_type'] = 'conditionType'
  @_hash['comparitor'] = 'comparitor'
  @_hash['threshold'] = 'threshold'
  @_hash['threshold_unit'] = 'thresholdUnit'
  @_hash['cycle_type'] = 'cycleType'
  @_hash['allowance_threshold'] = 'allowanceThreshold'
  @_hash['device_group'] = 'deviceGroup'
  @_hash['account_group_share'] = 'accountGroupShare'
  @_hash
end

.nullablesObject

An array for nullable fields



97
98
99
# File 'lib/verizon/models/data_trigger5.rb', line 97

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    filter_criteria
    condition
    action
    condition_type
    comparitor
    threshold
    threshold_unit
    cycle_type
    allowance_threshold
    device_group
    account_group_share
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (DataTrigger5 | Hash)

    value against the validation is performed.



158
159
160
161
162
163
164
# File 'lib/verizon/models/data_trigger5.rb', line 158

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.



177
178
179
180
181
182
183
184
185
186
# File 'lib/verizon/models/data_trigger5.rb', line 177

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} filter_criteria: #{@filter_criteria.inspect}, condition:"\
  " #{@condition.inspect}, action: #{@action.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},"\
  " device_group: #{@device_group.inspect}, account_group_share:"\
  " #{@account_group_share.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



167
168
169
170
171
172
173
174
# File 'lib/verizon/models/data_trigger5.rb', line 167

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} filter_criteria: #{@filter_criteria}, condition: #{@condition}, action:"\
  " #{@action}, condition_type: #{@condition_type}, comparitor: #{@comparitor}, threshold:"\
  " #{@threshold}, threshold_unit: #{@threshold_unit}, cycle_type: #{@cycle_type},"\
  " allowance_threshold: #{@allowance_threshold}, device_group: #{@device_group},"\
  " account_group_share: #{@account_group_share}>"
end