Class: Verizon::DtoSensorBoardingEvent

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

Overview

DtoSensorBoardingEvent 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(createdon: SKIP, errmsg: SKIP, fields: SKIP, state: SKIP, transactionid: SKIP) ⇒ DtoSensorBoardingEvent

Returns a new instance of DtoSensorBoardingEvent.



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

def initialize(createdon: SKIP, errmsg: SKIP, fields: SKIP, state: SKIP,
               transactionid: SKIP)
  @createdon = createdon unless createdon == SKIP
  @errmsg = errmsg unless errmsg == SKIP
  @fields = fields unless fields == SKIP
  @state = state unless state == SKIP
  @transactionid = transactionid unless transactionid == SKIP
end

Instance Attribute Details

#createdonDateTime

Timestamp of the record

Returns:

  • (DateTime)


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

def createdon
  @createdon
end

#errmsgString

Error message

Returns:

  • (String)


19
20
21
# File 'lib/verizon/models/dto_sensor_boarding_event.rb', line 19

def errmsg
  @errmsg
end

#fieldsDtoFields

Fields to return needed by search

Returns:



23
24
25
# File 'lib/verizon/models/dto_sensor_boarding_event.rb', line 23

def fields
  @fields
end

#stateString

The current status of the device or transaction and will be ‘success` or `failed`

Returns:

  • (String)


28
29
30
# File 'lib/verizon/models/dto_sensor_boarding_event.rb', line 28

def state
  @state
end

#transactionidString

The system-generated UUID of the transaction

Returns:

  • (String)


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

def transactionid
  @transactionid
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/verizon/models/dto_sensor_boarding_event.rb', line 71

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  createdon = if hash.key?('createdon')
                (DateTimeHelper.from_rfc3339(hash['createdon']) if hash['createdon'])
              else
                SKIP
              end
  errmsg = hash.key?('errmsg') ? hash['errmsg'] : SKIP
  fields = DtoFields.from_hash(hash['fields']) if hash['fields']
  state = hash.key?('state') ? hash['state'] : SKIP
  transactionid = hash.key?('transactionid') ? hash['transactionid'] : SKIP

  # Create object from extracted values.
  DtoSensorBoardingEvent.new(createdon: createdon,
                             errmsg: errmsg,
                             fields: fields,
                             state: state,
                             transactionid: transactionid)
end

.namesObject

A mapping from model property names to API property names.



35
36
37
38
39
40
41
42
43
# File 'lib/verizon/models/dto_sensor_boarding_event.rb', line 35

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['createdon'] = 'createdon'
  @_hash['errmsg'] = 'errmsg'
  @_hash['fields'] = 'fields'
  @_hash['state'] = 'state'
  @_hash['transactionid'] = 'transactionid'
  @_hash
end

.nullablesObject

An array for nullable fields



57
58
59
# File 'lib/verizon/models/dto_sensor_boarding_event.rb', line 57

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    createdon
    errmsg
    fields
    state
    transactionid
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



105
106
107
108
109
# File 'lib/verizon/models/dto_sensor_boarding_event.rb', line 105

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} createdon: #{@createdon.inspect}, errmsg: #{@errmsg.inspect}, fields:"\
  " #{@fields.inspect}, state: #{@state.inspect}, transactionid: #{@transactionid.inspect}>"
end

#to_custom_createdonObject



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

def to_custom_createdon
  DateTimeHelper.to_rfc3339(createdon)
end

#to_sObject

Provides a human-readable string representation of the object.



98
99
100
101
102
# File 'lib/verizon/models/dto_sensor_boarding_event.rb', line 98

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} createdon: #{@createdon}, errmsg: #{@errmsg}, fields: #{@fields}, state:"\
  " #{@state}, transactionid: #{@transactionid}>"
end