Class: Verizon::CauseCodeChoice

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

Overview

CauseCodeChoice 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(traffic_condition1 = nil) ⇒ CauseCodeChoice

Returns a new instance of CauseCodeChoice.



55
56
57
# File 'lib/verizon/models/cause_code_choice.rb', line 55

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

Instance Attribute Details

#traffic_condition1Integer

The value shall be set to:

  • 0 ‘unavailable` - in case further detailed information

on the traffic condition is unavailable,

  • 1 ‘increasedVolumeOfTraffic` - in case the type of traffic condition

is increased traffic volume,

  • 2 ‘trafficJamSlowlyIncreasing` - in case the type of traffic condition

is a traffic jam which volume is increasing slowly,

  • 3 ‘trafficJamIncreasing` - in case the type of traffic condition

is a traffic jam which volume is increasing,

  • 4 ‘trafficJamStronglyIncreasing` - in case the type of traffic condition

is a traffic jam which volume is strongly increasing,

  • 5 ‘trafficJam` ` - in case the type of traffic condition

is a traffic jam and no further detailed information about its volume is available,

  • 6 ‘trafficJamSlightlyDecreasing` - in case the type of traffic condition

is a traffic jam which volume is decreasing slowly,

  • 7 ‘trafficJamDecreasing` - in case the type of traffic condition

is a traffic jam which volume is decreasing,

  • 8 ‘trafficJamStronglyDecreasing` - in case the type of traffic condition

is a traffic jam which volume is decreasing rapidly,

  • 9 ‘trafficJamStable` - in case the traffic condition is a

traffic jam with stable volume,

  • 10-255: reserved for future usage.

Returns:

  • (Integer)


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

def traffic_condition1
  @traffic_condition1
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

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

  # Create object from extracted values.
  CauseCodeChoice.new(traffic_condition1)
end

.namesObject

A mapping from model property names to API property names.



39
40
41
42
43
# File 'lib/verizon/models/cause_code_choice.rb', line 39

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

.nullablesObject

An array for nullable fields



51
52
53
# File 'lib/verizon/models/cause_code_choice.rb', line 51

def self.nullables
  []
end

.optionalsObject

An array for optional fields



46
47
48
# File 'lib/verizon/models/cause_code_choice.rb', line 46

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (CauseCodeChoice | Hash)

    value against the validation is performed.



73
74
75
76
77
78
79
80
81
82
83
# File 'lib/verizon/models/cause_code_choice.rb', line 73

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

  return false unless value.instance_of? Hash

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



92
93
94
95
# File 'lib/verizon/models/cause_code_choice.rb', line 92

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

#to_sObject

Provides a human-readable string representation of the object.



86
87
88
89
# File 'lib/verizon/models/cause_code_choice.rb', line 86

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