Class: Verizon::RequestTrigger
- Defined in:
- lib/verizon/models/request_trigger.rb
Overview
RequestTrigger Model.
Instance Attribute Summary collapse
-
#account_name ⇒ String
TODO: Write general description for this method.
-
#organization_name ⇒ String
TODO: Write general description for this method.
-
#promo_alerts ⇒ Array[PromoAlert1]
TODO: Write general description for this method.
-
#trigger_category ⇒ String
TODO: Write general description for this method.
-
#trigger_id ⇒ String
TODO: Write general description for this method.
-
#trigger_name ⇒ String
TODO: Write general description for this method.
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.
Instance Method Summary collapse
-
#initialize(trigger_id = SKIP, trigger_name = SKIP, account_name = SKIP, organization_name = SKIP, trigger_category = SKIP, promo_alerts = SKIP) ⇒ RequestTrigger
constructor
A new instance of RequestTrigger.
Methods inherited from BaseModel
Constructor Details
#initialize(trigger_id = SKIP, trigger_name = SKIP, account_name = SKIP, organization_name = SKIP, trigger_category = SKIP, promo_alerts = SKIP) ⇒ RequestTrigger
Returns a new instance of RequestTrigger.
65 66 67 68 69 70 71 72 73 74 |
# File 'lib/verizon/models/request_trigger.rb', line 65 def initialize(trigger_id = SKIP, trigger_name = SKIP, account_name = SKIP, organization_name = SKIP, trigger_category = SKIP, promo_alerts = SKIP) @trigger_id = trigger_id unless trigger_id == SKIP @trigger_name = trigger_name unless trigger_name == SKIP @account_name = account_name unless account_name == SKIP @organization_name = organization_name unless organization_name == SKIP @trigger_category = trigger_category unless trigger_category == SKIP @promo_alerts = promo_alerts unless promo_alerts == SKIP end |
Instance Attribute Details
#account_name ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/verizon/models/request_trigger.rb', line 22 def account_name @account_name end |
#organization_name ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/verizon/models/request_trigger.rb', line 26 def organization_name @organization_name end |
#promo_alerts ⇒ Array[PromoAlert1]
TODO: Write general description for this method
34 35 36 |
# File 'lib/verizon/models/request_trigger.rb', line 34 def promo_alerts @promo_alerts end |
#trigger_category ⇒ String
TODO: Write general description for this method
30 31 32 |
# File 'lib/verizon/models/request_trigger.rb', line 30 def trigger_category @trigger_category end |
#trigger_id ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/verizon/models/request_trigger.rb', line 14 def trigger_id @trigger_id end |
#trigger_name ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/verizon/models/request_trigger.rb', line 18 def trigger_name @trigger_name end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/verizon/models/request_trigger.rb', line 77 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. trigger_id = hash.key?('triggerId') ? hash['triggerId'] : SKIP trigger_name = hash.key?('triggerName') ? hash['triggerName'] : SKIP account_name = hash.key?('accountName') ? hash['accountName'] : SKIP organization_name = hash.key?('organizationName') ? hash['organizationName'] : SKIP trigger_category = hash.key?('triggerCategory') ? hash['triggerCategory'] : SKIP # Parameter is an array, so we need to iterate through it promo_alerts = nil unless hash['promoAlerts'].nil? promo_alerts = [] hash['promoAlerts'].each do |structure| promo_alerts << (PromoAlert1.from_hash(structure) if structure) end end promo_alerts = SKIP unless hash.key?('promoAlerts') # Create object from extracted values. RequestTrigger.new(trigger_id, trigger_name, account_name, organization_name, trigger_category, promo_alerts) end |
.names ⇒ Object
A mapping from model property names to API property names.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/verizon/models/request_trigger.rb', line 37 def self.names @_hash = {} if @_hash.nil? @_hash['trigger_id'] = 'triggerId' @_hash['trigger_name'] = 'triggerName' @_hash['account_name'] = 'accountName' @_hash['organization_name'] = 'organizationName' @_hash['trigger_category'] = 'triggerCategory' @_hash['promo_alerts'] = 'promoAlerts' @_hash end |
.nullables ⇒ Object
An array for nullable fields
61 62 63 |
# File 'lib/verizon/models/request_trigger.rb', line 61 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/verizon/models/request_trigger.rb', line 49 def self.optionals %w[ trigger_id trigger_name account_name organization_name trigger_category promo_alerts ] end |