Class: Verizon::UsageTriggerAddRequest

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

Overview

UsageTriggerAddRequest Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(account_name = nil, service_name = ServiceNameEnum::LOCATION, threshold_value = nil, trigger_name = SKIP, allow_excess = SKIP, send_sms_notification = SKIP, sms_phone_numbers = SKIP, send_email_notification = SKIP, email_addresses = SKIP) ⇒ UsageTriggerAddRequest

Returns a new instance of UsageTriggerAddRequest.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/verizon/models/usage_trigger_add_request.rb', line 83

def initialize( = nil,
               service_name = ServiceNameEnum::LOCATION,
               threshold_value = nil,
               trigger_name = SKIP,
               allow_excess = SKIP,
               send_sms_notification = SKIP,
               sms_phone_numbers = SKIP,
               send_email_notification = SKIP,
               email_addresses = SKIP)
  @trigger_name = trigger_name unless trigger_name == SKIP
  @account_name = 
  @service_name = service_name
  @threshold_value = threshold_value
  @allow_excess = allow_excess unless allow_excess == SKIP
  @send_sms_notification = send_sms_notification unless send_sms_notification == SKIP
  @sms_phone_numbers = sms_phone_numbers unless sms_phone_numbers == SKIP
  @send_email_notification = send_email_notification unless send_email_notification == SKIP
  @email_addresses = email_addresses unless email_addresses == SKIP
end

Instance Attribute Details

#account_nameString

Account name

Returns:

  • (String)


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

def 
  @account_name
end

#allow_excessTrueClass | FalseClass

Allow additional requests after thresholdValue is reached. (currently not functional)

Returns:

  • (TrueClass | FalseClass)


32
33
34
# File 'lib/verizon/models/usage_trigger_add_request.rb', line 32

def allow_excess
  @allow_excess
end

#email_addressesString

Comma-separated list of email addresses to send alerts to.

Returns:

  • (String)


49
50
51
# File 'lib/verizon/models/usage_trigger_add_request.rb', line 49

def email_addresses
  @email_addresses
end

#send_email_notificationTrueClass | FalseClass

Send email alerts when the thresholdValue is reached.

Returns:

  • (TrueClass | FalseClass)


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

def send_email_notification
  @send_email_notification
end

#send_sms_notificationTrueClass | FalseClass

Send SMS (text) alerts when the thresholdValue is reached.

Returns:

  • (TrueClass | FalseClass)


36
37
38
# File 'lib/verizon/models/usage_trigger_add_request.rb', line 36

def send_sms_notification
  @send_sms_notification
end

#service_nameServiceNameEnum

Service name

Returns:



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

def service_name
  @service_name
end

#sms_phone_numbersString

Comma-separated list of phone numbers to send SMS alerts to. Digits only; no dashes or parentheses, etc.

Returns:

  • (String)


41
42
43
# File 'lib/verizon/models/usage_trigger_add_request.rb', line 41

def sms_phone_numbers
  @sms_phone_numbers
end

#threshold_valueString

The percent of subscribed usage required to activate the trigger, such as 90 or 100.

Returns:

  • (String)


27
28
29
# File 'lib/verizon/models/usage_trigger_add_request.rb', line 27

def threshold_value
  @threshold_value
end

#trigger_nameString

Usage trigger name

Returns:

  • (String)


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

def trigger_name
  @trigger_name
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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/usage_trigger_add_request.rb', line 104

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('accountName') ? hash['accountName'] : nil
  service_name = hash['serviceName'] ||= ServiceNameEnum::LOCATION
  threshold_value =
    hash.key?('thresholdValue') ? hash['thresholdValue'] : nil
  trigger_name = hash.key?('triggerName') ? hash['triggerName'] : SKIP
  allow_excess = hash.key?('allowExcess') ? hash['allowExcess'] : SKIP
  send_sms_notification =
    hash.key?('sendSmsNotification') ? hash['sendSmsNotification'] : SKIP
  sms_phone_numbers =
    hash.key?('smsPhoneNumbers') ? hash['smsPhoneNumbers'] : SKIP
  send_email_notification =
    hash.key?('sendEmailNotification') ? hash['sendEmailNotification'] : SKIP
  email_addresses =
    hash.key?('emailAddresses') ? hash['emailAddresses'] : SKIP

  # Create object from extracted values.
  UsageTriggerAddRequest.new(,
                             service_name,
                             threshold_value,
                             trigger_name,
                             allow_excess,
                             send_sms_notification,
                             sms_phone_numbers,
                             send_email_notification,
                             email_addresses)
end

.namesObject

A mapping from model property names to API property names.



52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/verizon/models/usage_trigger_add_request.rb', line 52

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['trigger_name'] = 'triggerName'
  @_hash['account_name'] = 'accountName'
  @_hash['service_name'] = 'serviceName'
  @_hash['threshold_value'] = 'thresholdValue'
  @_hash['allow_excess'] = 'allowExcess'
  @_hash['send_sms_notification'] = 'sendSmsNotification'
  @_hash['sms_phone_numbers'] = 'smsPhoneNumbers'
  @_hash['send_email_notification'] = 'sendEmailNotification'
  @_hash['email_addresses'] = 'emailAddresses'
  @_hash
end

.nullablesObject

An array for nullable fields



79
80
81
# File 'lib/verizon/models/usage_trigger_add_request.rb', line 79

def self.nullables
  []
end

.optionalsObject

An array for optional fields



67
68
69
70
71
72
73
74
75
76
# File 'lib/verizon/models/usage_trigger_add_request.rb', line 67

def self.optionals
  %w[
    trigger_name
    allow_excess
    send_sms_notification
    sms_phone_numbers
    send_email_notification
    email_addresses
  ]
end