Class: ThePlaidApi::IncidentUpdate

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/incident_update.rb

Overview

An update on the health incident

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(description: SKIP, status: SKIP, updated_date: SKIP, additional_properties: nil) ⇒ IncidentUpdate

Returns a new instance of IncidentUpdate.



50
51
52
53
54
55
56
57
58
59
# File 'lib/the_plaid_api/models/incident_update.rb', line 50

def initialize(description: SKIP, status: SKIP, updated_date: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @description = description unless description == SKIP
  @status = status unless status == SKIP
  @updated_date = updated_date unless updated_date == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#descriptionString

The content of the update.

Returns:

  • (String)


15
16
17
# File 'lib/the_plaid_api/models/incident_update.rb', line 15

def description
  @description
end

#statusStatus1

The status of the incident.

Returns:



19
20
21
# File 'lib/the_plaid_api/models/incident_update.rb', line 19

def status
  @status
end

#updated_dateDateTime

The date when the update was published, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format, e.g. ā€˜ā€œ2020-10-30T15:26:48Zā€`.

Returns:

  • (DateTime)


25
26
27
# File 'lib/the_plaid_api/models/incident_update.rb', line 25

def updated_date
  @updated_date
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/the_plaid_api/models/incident_update.rb', line 62

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  description = hash.key?('description') ? hash['description'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  updated_date = if hash.key?('updated_date')
                   (DateTimeHelper.from_rfc3339(hash['updated_date']) if hash['updated_date'])
                 else
                   SKIP
                 end

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  IncidentUpdate.new(description: description,
                     status: status,
                     updated_date: updated_date,
                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



28
29
30
31
32
33
34
# File 'lib/the_plaid_api/models/incident_update.rb', line 28

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

.nullablesObject

An array for nullable fields



46
47
48
# File 'lib/the_plaid_api/models/incident_update.rb', line 46

def self.nullables
  []
end

.optionalsObject

An array for optional fields



37
38
39
40
41
42
43
# File 'lib/the_plaid_api/models/incident_update.rb', line 37

def self.optionals
  %w[
    description
    status
    updated_date
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



100
101
102
103
104
# File 'lib/the_plaid_api/models/incident_update.rb', line 100

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} description: #{@description.inspect}, status: #{@status.inspect},"\
  " updated_date: #{@updated_date.inspect}, additional_properties: #{@additional_properties}>"
end

#to_custom_updated_dateObject



88
89
90
# File 'lib/the_plaid_api/models/incident_update.rb', line 88

def to_custom_updated_date
  DateTimeHelper.to_rfc3339(updated_date)
end

#to_sObject

Provides a human-readable string representation of the object.



93
94
95
96
97
# File 'lib/the_plaid_api/models/incident_update.rb', line 93

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} description: #{@description}, status: #{@status}, updated_date:"\
  " #{@updated_date}, additional_properties: #{@additional_properties}>"
end