Class: Verizon::PricePlanTrigger2

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

Overview

PricePlanTrigger2 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(account_share = SKIP, condition = SKIP, change_plan = SKIP, change_plan_details = SKIP, pay_as_you_go = SKIP, action = SKIP, stand_alone = SKIP) ⇒ PricePlanTrigger2

Returns a new instance of PricePlanTrigger2.



71
72
73
74
75
76
77
78
79
80
81
# File 'lib/verizon/models/price_plan_trigger2.rb', line 71

def initialize( = SKIP, condition = SKIP, change_plan = SKIP,
               change_plan_details = SKIP, pay_as_you_go = SKIP,
               action = SKIP, stand_alone = SKIP)
  @account_share =  unless  == SKIP
  @condition = condition unless condition == SKIP
  @change_plan = change_plan unless change_plan == SKIP
  @change_plan_details = change_plan_details unless change_plan_details == SKIP
  @pay_as_you_go = pay_as_you_go unless pay_as_you_go == SKIP
  @action = action unless action == SKIP
  @stand_alone = stand_alone unless stand_alone == SKIP
end

Instance Attribute Details

#account_shareAccountShareFilterCriteria

TODO: Write general description for this method



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

def 
  @account_share
end

#actionActionobject

The service plan code to switch to

Returns:



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

def action
  @action
end

#change_planTrueClass | FalseClass

a flag to set if the trigger changes service plans, true, or not, false

Returns:

  • (TrueClass | FalseClass)


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

def change_plan
  @change_plan
end

#change_plan_detailsChangePlanDetails

The service plan code to switch to

Returns:



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

def change_plan_details
  @change_plan_details
end

#conditionRateplantype2Condition

TODO: Write general description for this method



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

def condition
  @condition
end

#pay_as_you_goPayAsYouGoFilterCriteria

The service plan code to switch to



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

def pay_as_you_go
  @pay_as_you_go
end

#stand_aloneFiltercriteriaObjectCall

The service plan code to switch to



38
39
40
# File 'lib/verizon/models/price_plan_trigger2.rb', line 38

def stand_alone
  @stand_alone
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/verizon/models/price_plan_trigger2.rb', line 84

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = AccountShareFilterCriteria.from_hash(hash['accountShare']) if
    hash['accountShare']
  condition = hash.key?('condition') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:PricePlanTrigger2Condition), hash['condition']
  ) : SKIP
  change_plan = hash.key?('changePlan') ? hash['changePlan'] : SKIP
  change_plan_details = ChangePlanDetails.from_hash(hash['changePlanDetails']) if
    hash['changePlanDetails']
  pay_as_you_go = PayAsYouGoFilterCriteria.from_hash(hash['payAsYouGo']) if hash['payAsYouGo']
  action = Actionobject.from_hash(hash['action']) if hash['action']
  stand_alone = FiltercriteriaObjectCall.from_hash(hash['standAlone']) if hash['standAlone']

  # Create object from extracted values.
  PricePlanTrigger2.new(,
                        condition,
                        change_plan,
                        change_plan_details,
                        pay_as_you_go,
                        action,
                        stand_alone)
end

.namesObject

A mapping from model property names to API property names.



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/verizon/models/price_plan_trigger2.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_share'] = 'accountShare'
  @_hash['condition'] = 'condition'
  @_hash['change_plan'] = 'changePlan'
  @_hash['change_plan_details'] = 'changePlanDetails'
  @_hash['pay_as_you_go'] = 'payAsYouGo'
  @_hash['action'] = 'action'
  @_hash['stand_alone'] = 'standAlone'
  @_hash
end

.nullablesObject

An array for nullable fields



67
68
69
# File 'lib/verizon/models/price_plan_trigger2.rb', line 67

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    account_share
    condition
    change_plan
    change_plan_details
    pay_as_you_go
    action
    stand_alone
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



112
113
114
115
116
117
118
# File 'lib/verizon/models/price_plan_trigger2.rb', line 112

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.



129
130
131
132
133
134
135
# File 'lib/verizon/models/price_plan_trigger2.rb', line 129

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account_share: #{@account_share.inspect}, condition: #{@condition.inspect},"\
  " change_plan: #{@change_plan.inspect}, change_plan_details:"\
  " #{@change_plan_details.inspect}, pay_as_you_go: #{@pay_as_you_go.inspect}, action:"\
  " #{@action.inspect}, stand_alone: #{@stand_alone.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



121
122
123
124
125
126
# File 'lib/verizon/models/price_plan_trigger2.rb', line 121

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account_share: #{@account_share}, condition: #{@condition}, change_plan:"\
  " #{@change_plan}, change_plan_details: #{@change_plan_details}, pay_as_you_go:"\
  " #{@pay_as_you_go}, action: #{@action}, stand_alone: #{@stand_alone}>"
end