Class: Verizon::CauseCodeChoice4

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

Overview

CauseCodeChoice4 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(wrong_way_driving14 = nil) ⇒ CauseCodeChoice4

Returns a new instance of CauseCodeChoice4.



40
41
42
# File 'lib/verizon/models/cause_code_choice4.rb', line 40

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

Instance Attribute Details

#wrong_way_driving14Integer

The value shall be set to:

  • 0 ‘unavailable` - in case further detailed information on wrong way

driving event is unavailable,

  • 1 ‘wrongLane` - in case vehicle is driving on a lane for which it

has no authorization to use,

  • 2 ‘wrongDirection` - in case vehicle is driving in a direction that it

is not allowed,

  • 3-255 - reserved for future usage.

Returns:

  • (Integer)


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

def wrong_way_driving14
  @wrong_way_driving14
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

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

  # Create object from extracted values.
  CauseCodeChoice4.new(wrong_way_driving14)
end

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



36
37
38
# File 'lib/verizon/models/cause_code_choice4.rb', line 36

def self.nullables
  []
end

.optionalsObject

An array for optional fields



31
32
33
# File 'lib/verizon/models/cause_code_choice4.rb', line 31

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



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

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

  return false unless value.instance_of? Hash

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



77
78
79
80
# File 'lib/verizon/models/cause_code_choice4.rb', line 77

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

#to_sObject

Provides a human-readable string representation of the object.



71
72
73
74
# File 'lib/verizon/models/cause_code_choice4.rb', line 71

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