Method: Verizon::UsageTriggerUpdateRequest.from_hash

Defined in:
lib/verizon/models/usage_trigger_update_request.rb

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/verizon/models/usage_trigger_update_request.rb', line 73

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

   = hash.key?('accountName') ? hash['accountName'] : nil
  trigger_name = hash.key?('triggerName') ? hash['triggerName'] : SKIP
  threshold_value =
    hash.key?('thresholdValue') ? hash['thresholdValue'] : SKIP
  sms_phone_numbers =
    hash.key?('smsPhoneNumbers') ? hash['smsPhoneNumbers'] : SKIP
  email_addresses =
    hash.key?('emailAddresses') ? hash['emailAddresses'] : SKIP

  # Create object from extracted values.

  UsageTriggerUpdateRequest.new(,
                                trigger_name,
                                threshold_value,
                                sms_phone_numbers,
                                email_addresses)
end