Class: Verizon::CauseCodeChoice5

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

Overview

CauseCodeChoice5 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(emergency_vehicle_approaching95 = nil) ⇒ CauseCodeChoice5

Returns a new instance of CauseCodeChoice5.



41
42
43
# File 'lib/verizon/models/cause_code_choice5.rb', line 41

def initialize(emergency_vehicle_approaching95 = nil)
  @emergency_vehicle_approaching95 = emergency_vehicle_approaching95
end

Instance Attribute Details

#emergency_vehicle_approaching95Integer

The value shall be set to:

  • 0 ‘unavailable` - in case further detailed information

on the emergency vehicle approaching event is unavailable,

  • 1 ‘emergencyVehicleApproaching` - in case an operating emergency

vehicle is approaching,

  • 2 ‘prioritizedVehicleApproaching` - in case a prioritized vehicle is

approaching,

  • 3-255 - reserved for future usage.

Returns:

  • (Integer)


21
22
23
# File 'lib/verizon/models/cause_code_choice5.rb', line 21

def emergency_vehicle_approaching95
  @emergency_vehicle_approaching95
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



46
47
48
49
50
51
52
53
54
55
# File 'lib/verizon/models/cause_code_choice5.rb', line 46

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  emergency_vehicle_approaching95 =
    hash.key?('emergencyVehicleApproaching95') ? hash['emergencyVehicleApproaching95'] : nil

  # Create object from extracted values.
  CauseCodeChoice5.new(emergency_vehicle_approaching95)
end

.namesObject

A mapping from model property names to API property names.



24
25
26
27
28
29
# File 'lib/verizon/models/cause_code_choice5.rb', line 24

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['emergency_vehicle_approaching95'] =
    'emergencyVehicleApproaching95'
  @_hash
end

.nullablesObject

An array for nullable fields



37
38
39
# File 'lib/verizon/models/cause_code_choice5.rb', line 37

def self.nullables
  []
end

.optionalsObject

An array for optional fields



32
33
34
# File 'lib/verizon/models/cause_code_choice5.rb', line 32

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/verizon/models/cause_code_choice5.rb', line 59

def self.validate(value)
  if value.instance_of? self
    return APIHelper.valid_type?(value.emergency_vehicle_approaching95,
                                 ->(val) { val.instance_of? Integer })
  end

  return false unless value.instance_of? Hash

  APIHelper.valid_type?(value['emergencyVehicleApproaching95'],
                        ->(val) { val.instance_of? Integer })
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



78
79
80
81
82
# File 'lib/verizon/models/cause_code_choice5.rb', line 78

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} emergency_vehicle_approaching95:"\
  " #{@emergency_vehicle_approaching95.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



72
73
74
75
# File 'lib/verizon/models/cause_code_choice5.rb', line 72

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} emergency_vehicle_approaching95: #{@emergency_vehicle_approaching95}>"
end