Class: Verizon::Actionobject
- Defined in:
- lib/verizon/models/actionobject.rb
Overview
Actionobject Model.
Instance Attribute Summary collapse
-
#change_plan ⇒ TrueClass | FalseClass
a flag to set if the trigger changes service plans, true, or not, false.
-
#change_plan_details ⇒ ChangePlanDetails
The service plan code to switch to.
-
#suspend ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#suspend_details ⇒ Suspenddetailsobject
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(suspend: SKIP, suspend_details: SKIP, change_plan: SKIP, change_plan_details: SKIP, additional_properties: nil) ⇒ Actionobject
constructor
A new instance of Actionobject.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(suspend: SKIP, suspend_details: SKIP, change_plan: SKIP, change_plan_details: SKIP, additional_properties: nil) ⇒ Actionobject
Returns a new instance of Actionobject.
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/verizon/models/actionobject.rb', line 53 def initialize(suspend: SKIP, suspend_details: SKIP, change_plan: SKIP, change_plan_details: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @suspend = suspend unless suspend == SKIP @suspend_details = suspend_details unless suspend_details == SKIP @change_plan = change_plan unless change_plan == SKIP @change_plan_details = change_plan_details unless change_plan_details == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#change_plan ⇒ TrueClass | FalseClass
a flag to set if the trigger changes service plans, true, or not, false
22 23 24 |
# File 'lib/verizon/models/actionobject.rb', line 22 def change_plan @change_plan end |
#change_plan_details ⇒ ChangePlanDetails
The service plan code to switch to
26 27 28 |
# File 'lib/verizon/models/actionobject.rb', line 26 def change_plan_details @change_plan_details end |
#suspend ⇒ TrueClass | FalseClass
TODO: Write general description for this method
14 15 16 |
# File 'lib/verizon/models/actionobject.rb', line 14 def suspend @suspend end |
#suspend_details ⇒ Suspenddetailsobject
TODO: Write general description for this method
18 19 20 |
# File 'lib/verizon/models/actionobject.rb', line 18 def suspend_details @suspend_details end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/verizon/models/actionobject.rb', line 66 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. suspend = hash.key?('suspend') ? hash['suspend'] : SKIP suspend_details = Suspenddetailsobject.from_hash(hash['suspendDetails']) if hash['suspendDetails'] change_plan = hash.key?('changePlan') ? hash['changePlan'] : SKIP change_plan_details = ChangePlanDetails.from_hash(hash['changePlanDetails']) if hash['changePlanDetails'] # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. Actionobject.new(suspend: suspend, suspend_details: suspend_details, change_plan: change_plan, change_plan_details: change_plan_details, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
29 30 31 32 33 34 35 36 |
# File 'lib/verizon/models/actionobject.rb', line 29 def self.names @_hash = {} if @_hash.nil? @_hash['suspend'] = 'suspend' @_hash['suspend_details'] = 'suspendDetails' @_hash['change_plan'] = 'changePlan' @_hash['change_plan_details'] = 'changePlanDetails' @_hash end |
.nullables ⇒ Object
An array for nullable fields
49 50 51 |
# File 'lib/verizon/models/actionobject.rb', line 49 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
39 40 41 42 43 44 45 46 |
# File 'lib/verizon/models/actionobject.rb', line 39 def self.optionals %w[ suspend suspend_details change_plan change_plan_details ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
94 95 96 97 98 99 100 |
# File 'lib/verizon/models/actionobject.rb', line 94 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
111 112 113 114 115 116 |
# File 'lib/verizon/models/actionobject.rb', line 111 def inspect class_name = self.class.name.split('::').last "<#{class_name} suspend: #{@suspend.inspect}, suspend_details: #{@suspend_details.inspect},"\ " change_plan: #{@change_plan.inspect}, change_plan_details:"\ " #{@change_plan_details.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
103 104 105 106 107 108 |
# File 'lib/verizon/models/actionobject.rb', line 103 def to_s class_name = self.class.name.split('::').last "<#{class_name} suspend: #{@suspend}, suspend_details: #{@suspend_details}, change_plan:"\ " #{@change_plan}, change_plan_details: #{@change_plan_details}, additional_properties:"\ " #{@additional_properties}>" end |