Class: Verizon::DiagnosticsObservationResult

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

Overview

A success response containing the current status of the request.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(transaction_id = nil, status = nil, created_on = nil) ⇒ DiagnosticsObservationResult

Returns a new instance of DiagnosticsObservationResult.



44
45
46
47
48
# File 'lib/verizon/models/diagnostics_observation_result.rb', line 44

def initialize(transaction_id = nil, status = nil, created_on = nil)
  @transaction_id = transaction_id
  @status = status
  @created_on = created_on
end

Instance Attribute Details

#created_onDateTime

The date and time of when this request was created.

Returns:

  • (DateTime)


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

def created_on
  @created_on
end

#statusString

Status of the request.

Returns:

  • (String)


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

def status
  @status
end

#transaction_idString

Transaction identifier.

Returns:

  • (String)


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

def transaction_id
  @transaction_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/verizon/models/diagnostics_observation_result.rb', line 51

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  transaction_id = hash.key?('transactionID') ? hash['transactionID'] : nil
  status = hash.key?('status') ? hash['status'] : nil
  created_on = if hash.key?('createdOn')
                 (DateTimeHelper.from_rfc3339(hash['createdOn']) if hash['createdOn'])
               end

  # Create object from extracted values.
  DiagnosticsObservationResult.new(transaction_id,
                                   status,
                                   created_on)
end

.namesObject

A mapping from model property names to API property names.



26
27
28
29
30
31
32
# File 'lib/verizon/models/diagnostics_observation_result.rb', line 26

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['transaction_id'] = 'transactionID'
  @_hash['status'] = 'status'
  @_hash['created_on'] = 'createdOn'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



35
36
37
# File 'lib/verizon/models/diagnostics_observation_result.rb', line 35

def self.optionals
  []
end

Instance Method Details

#to_custom_created_onObject



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

def to_custom_created_on
  DateTimeHelper.to_rfc3339(created_on)
end