Class: Verizon::RequestTrigger

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

Overview

RequestTrigger Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

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,  = 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 =  unless  == 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_nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def 
  @account_name
end

#organization_nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def organization_name
  @organization_name
end

#promo_alertsArray[PromoAlert1]

TODO: Write general description for this method

Returns:



34
35
36
# File 'lib/verizon/models/request_trigger.rb', line 34

def promo_alerts
  @promo_alerts
end

#trigger_categoryString

TODO: Write general description for this method

Returns:

  • (String)


30
31
32
# File 'lib/verizon/models/request_trigger.rb', line 30

def trigger_category
  @trigger_category
end

#trigger_idString

TODO: Write general description for this method

Returns:

  • (String)


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

def trigger_id
  @trigger_id
end

#trigger_nameString

TODO: Write general description for this method

Returns:

  • (String)


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
   = 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,
                     ,
                     organization_name,
                     trigger_category,
                     promo_alerts)
end

.namesObject

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

.nullablesObject

An array for nullable fields



61
62
63
# File 'lib/verizon/models/request_trigger.rb', line 61

def self.nullables
  []
end

.optionalsObject

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