Class: Verizon::CauseCodeChoice2

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

Overview

CauseCodeChoice2 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(roadworks3 = nil) ⇒ CauseCodeChoice2

Returns a new instance of CauseCodeChoice2.



52
53
54
# File 'lib/verizon/models/cause_code_choice2.rb', line 52

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

Instance Attribute Details

#roadworks3Integer

The value shall be set to:

  • 0 ‘unavailable` - in case further detailed information

on roadworks is unavailable,

  • 1 ‘majorRoadworks` - in case a major roadworks is ongoing,

  • 2 ‘roadMarkingWork` - in case a road marking work is

ongoing,

  • 3 ‘slowMovingRoadMaintenance` - in case slow moving road maintenance

work is ongoing,

  • 4 ‘shortTermStationaryRoadworks`- in case a short term stationary

roadwork is ongoing,

  • 5 ‘streetCleaning` - in case a vehicle street cleaning work

is ongoing,

  • 6 ‘winterService` - in case winter service work is

ongoing,

  • 7 ‘setupPhase` - in case the work zone is being setup,

  • 8 ‘remodellingPhase` - in case the work zone is being

changed,

  • 9 ‘dismantlingPhase` - in case the work zone is being

dismantled after finished work.

  • 10-255 - are reserved for future usage.

Returns:

  • (Integer)


33
34
35
# File 'lib/verizon/models/cause_code_choice2.rb', line 33

def roadworks3
  @roadworks3
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



57
58
59
60
61
62
63
64
65
# File 'lib/verizon/models/cause_code_choice2.rb', line 57

def self.from_hash(hash)
  return nil unless hash

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

  # Create object from extracted values.
  CauseCodeChoice2.new(roadworks3)
end

.namesObject

A mapping from model property names to API property names.



36
37
38
39
40
# File 'lib/verizon/models/cause_code_choice2.rb', line 36

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

.nullablesObject

An array for nullable fields



48
49
50
# File 'lib/verizon/models/cause_code_choice2.rb', line 48

def self.nullables
  []
end

.optionalsObject

An array for optional fields



43
44
45
# File 'lib/verizon/models/cause_code_choice2.rb', line 43

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



69
70
71
72
73
74
75
76
77
78
79
# File 'lib/verizon/models/cause_code_choice2.rb', line 69

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

  return false unless value.instance_of? Hash

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



88
89
90
91
# File 'lib/verizon/models/cause_code_choice2.rb', line 88

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

#to_sObject

Provides a human-readable string representation of the object.



82
83
84
85
# File 'lib/verizon/models/cause_code_choice2.rb', line 82

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