Class: ThePlaidApi::HealthIncident
- Defined in:
- lib/the_plaid_api/models/health_incident.rb
Overview
A status health incident
Instance Attribute Summary collapse
-
#end_date ⇒ DateTime
The end date of the incident, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format, e.g.
-
#incident_updates ⇒ Array[IncidentUpdate]
Updates on the health incident.
-
#start_date ⇒ DateTime
The start date of the incident, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format, e.g.
-
#title ⇒ String
The title of the incident.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(start_date:, title:, incident_updates:, end_date: SKIP, additional_properties: nil) ⇒ HealthIncident
constructor
A new instance of HealthIncident.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_end_date ⇒ Object
- #to_custom_start_date ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(start_date:, title:, incident_updates:, end_date: SKIP, additional_properties: nil) ⇒ HealthIncident
Returns a new instance of HealthIncident.
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/the_plaid_api/models/health_incident.rb', line 57 def initialize(start_date:, title:, incident_updates:, end_date: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @start_date = start_date @end_date = end_date unless end_date == SKIP @title = title @incident_updates = incident_updates @additional_properties = additional_properties end |
Instance Attribute Details
#end_date ⇒ DateTime
The end date of the incident, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format, e.g. ‘“2020-10-30T15:26:48Z”`.
23 24 25 |
# File 'lib/the_plaid_api/models/health_incident.rb', line 23 def end_date @end_date end |
#incident_updates ⇒ Array[IncidentUpdate]
Updates on the health incident.
31 32 33 |
# File 'lib/the_plaid_api/models/health_incident.rb', line 31 def incident_updates @incident_updates end |
#start_date ⇒ DateTime
The start date of the incident, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format, e.g. ‘“2020-10-30T15:26:48Z”`.
17 18 19 |
# File 'lib/the_plaid_api/models/health_incident.rb', line 17 def start_date @start_date end |
#title ⇒ String
The title of the incident
27 28 29 |
# File 'lib/the_plaid_api/models/health_incident.rb', line 27 def title @title end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/the_plaid_api/models/health_incident.rb', line 70 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. start_date = if hash.key?('start_date') (DateTimeHelper.from_rfc3339(hash['start_date']) if hash['start_date']) end title = hash.key?('title') ? hash['title'] : nil # Parameter is an array, so we need to iterate through it incident_updates = nil unless hash['incident_updates'].nil? incident_updates = [] hash['incident_updates'].each do |structure| incident_updates << (IncidentUpdate.from_hash(structure) if structure) end end incident_updates = nil unless hash.key?('incident_updates') end_date = if hash.key?('end_date') (DateTimeHelper.from_rfc3339(hash['end_date']) if hash['end_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. HealthIncident.new(start_date: start_date, title: title, incident_updates: incident_updates, end_date: end_date, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
34 35 36 37 38 39 40 41 |
# File 'lib/the_plaid_api/models/health_incident.rb', line 34 def self.names @_hash = {} if @_hash.nil? @_hash['start_date'] = 'start_date' @_hash['end_date'] = 'end_date' @_hash['title'] = 'title' @_hash['incident_updates'] = 'incident_updates' @_hash end |
.nullables ⇒ Object
An array for nullable fields
51 52 53 54 55 |
# File 'lib/the_plaid_api/models/health_incident.rb', line 51 def self.nullables %w[ end_date ] end |
.optionals ⇒ Object
An array for optional fields
44 45 46 47 48 |
# File 'lib/the_plaid_api/models/health_incident.rb', line 44 def self.optionals %w[ end_date ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
125 126 127 128 129 130 |
# File 'lib/the_plaid_api/models/health_incident.rb', line 125 def inspect class_name = self.class.name.split('::').last "<#{class_name} start_date: #{@start_date.inspect}, end_date: #{@end_date.inspect}, title:"\ " #{@title.inspect}, incident_updates: #{@incident_updates.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_custom_end_date ⇒ Object
113 114 115 |
# File 'lib/the_plaid_api/models/health_incident.rb', line 113 def to_custom_end_date DateTimeHelper.to_rfc3339(end_date) end |
#to_custom_start_date ⇒ Object
109 110 111 |
# File 'lib/the_plaid_api/models/health_incident.rb', line 109 def to_custom_start_date DateTimeHelper.to_rfc3339(start_date) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
118 119 120 121 122 |
# File 'lib/the_plaid_api/models/health_incident.rb', line 118 def to_s class_name = self.class.name.split('::').last "<#{class_name} start_date: #{@start_date}, end_date: #{@end_date}, title: #{@title},"\ " incident_updates: #{@incident_updates}, additional_properties: #{@additional_properties}>" end |