Class: Verizon::FrictionInformation

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

Overview

FrictionInformation 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(road_surface_description = nil) ⇒ FrictionInformation

Returns a new instance of FrictionInformation.



34
35
36
# File 'lib/verizon/models/friction_information.rb', line 34

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

Instance Attribute Details

#road_surface_descriptionObject

Indicates the composition of the surface of the roadway for use in estimation of friction.

Returns:

  • (Object)


15
16
17
# File 'lib/verizon/models/friction_information.rb', line 15

def road_surface_description
  @road_surface_description
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/verizon/models/friction_information.rb', line 39

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  road_surface_description = hash.key?('roadSurfaceDescription') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:DescriptionOfRoadSurface), hash['roadSurfaceDescription']
  ) : nil

  # Create object from extracted values.
  FrictionInformation.new(road_surface_description)
end

.namesObject

A mapping from model property names to API property names.



18
19
20
21
22
# File 'lib/verizon/models/friction_information.rb', line 18

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

.nullablesObject

An array for nullable fields



30
31
32
# File 'lib/verizon/models/friction_information.rb', line 30

def self.nullables
  []
end

.optionalsObject

An array for optional fields



25
26
27
# File 'lib/verizon/models/friction_information.rb', line 25

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



53
54
55
56
57
58
59
60
61
62
63
# File 'lib/verizon/models/friction_information.rb', line 53

def self.validate(value)
  if value.instance_of? self
    return UnionTypeLookUp.get(:DescriptionOfRoadSurface)
                          .validate(value.road_surface_description)
  end

  return false unless value.instance_of? Hash

  UnionTypeLookUp.get(:DescriptionOfRoadSurface)
                 .validate(value['roadSurfaceDescription'])
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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

#to_sObject

Provides a human-readable string representation of the object.



66
67
68
69
# File 'lib/verizon/models/friction_information.rb', line 66

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