Class: ThePlaidApi::FdxNotificationEntity

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

Overview

Provides the base fields of a notification. Clients will read the ‘type` property to determine the expected notification payload

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(notification_id:, type:, sent_on:, category:, notification_payload:, subtype: SKIP, severity: SKIP, priority: SKIP, publisher: SKIP, subscriber: SKIP, url: SKIP, additional_properties: nil) ⇒ FdxNotificationEntity

Returns a new instance of FdxNotificationEntity.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/the_plaid_api/models/fdx_notification_entity.rb', line 99

def initialize(notification_id:, type:, sent_on:, category:,
               notification_payload:, subtype: SKIP, severity: SKIP,
               priority: SKIP, publisher: SKIP, subscriber: SKIP, url: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @notification_id = notification_id
  @type = type
  @subtype = subtype unless subtype == SKIP
  @sent_on = sent_on
  @category = category
  @severity = severity unless severity == SKIP
  @priority = priority unless priority == SKIP
  @publisher = publisher unless publisher == SKIP
  @subscriber = subscriber unless subscriber == SKIP
  @notification_payload = notification_payload
  @url = url unless url == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#categoryNotificationCategory

Category of Notification



36
37
38
# File 'lib/the_plaid_api/models/fdx_notification_entity.rb', line 36

def category
  @category
end

#notification_idString

Id of notification

Returns:

  • (String)


16
17
18
# File 'lib/the_plaid_api/models/fdx_notification_entity.rb', line 16

def notification_id
  @notification_id
end

#notification_payloadNotificationPayloadEntity

Custom key-value pairs payload for a notification



58
59
60
# File 'lib/the_plaid_api/models/fdx_notification_entity.rb', line 58

def notification_payload
  @notification_payload
end

#priorityNotificationPriority

Priority of notification



44
45
46
# File 'lib/the_plaid_api/models/fdx_notification_entity.rb', line 44

def priority
  @priority
end

#publisherPartyEntity

FDX Participant - an entity or person that is a part of a FDX API transaction

Returns:



49
50
51
# File 'lib/the_plaid_api/models/fdx_notification_entity.rb', line 49

def publisher
  @publisher
end

#sent_onDateTime

ISO 8601 date-time in format ‘YYYY-MM-DDThh:mm:ss.nnn[Z|hh:mm]’ according to [IETF RFC3339](xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#ancho r14)

Returns:

  • (DateTime)


32
33
34
# File 'lib/the_plaid_api/models/fdx_notification_entity.rb', line 32

def sent_on
  @sent_on
end

#severityNotificationSeverity

Severity level of notification



40
41
42
# File 'lib/the_plaid_api/models/fdx_notification_entity.rb', line 40

def severity
  @severity
end

#subscriberPartyEntity

FDX Participant - an entity or person that is a part of a FDX API transaction

Returns:



54
55
56
# File 'lib/the_plaid_api/models/fdx_notification_entity.rb', line 54

def subscriber
  @subscriber
end

#subtypeString

An optional initiator-defined event subtype code or description if the event type needs to be further categorized or described.

Returns:

  • (String)


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

def subtype
  @subtype
end

#typeNotificationType

Type of Notification

Returns:



20
21
22
# File 'lib/the_plaid_api/models/fdx_notification_entity.rb', line 20

def type
  @type
end

#urlHateoasLink

REST application constraint (Hypermedia As The Engine Of Application State)

Returns:



63
64
65
# File 'lib/the_plaid_api/models/fdx_notification_entity.rb', line 63

def url
  @url
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/the_plaid_api/models/fdx_notification_entity.rb', line 121

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  notification_id =
    hash.key?('notificationId') ? hash['notificationId'] : nil
  type = hash.key?('type') ? hash['type'] : nil
  sent_on = if hash.key?('sentOn')
              (DateTimeHelper.from_rfc3339(hash['sentOn']) if hash['sentOn'])
            end
  category = hash.key?('category') ? hash['category'] : nil
  notification_payload = NotificationPayloadEntity.from_hash(hash['notificationPayload']) if
    hash['notificationPayload']
  subtype = hash.key?('subtype') ? hash['subtype'] : SKIP
  severity = hash.key?('severity') ? hash['severity'] : SKIP
  priority = hash.key?('priority') ? hash['priority'] : SKIP
  publisher = PartyEntity.from_hash(hash['publisher']) if hash['publisher']
  subscriber = PartyEntity.from_hash(hash['subscriber']) if hash['subscriber']
  url = HateoasLink.from_hash(hash['url']) if hash['url']

  # 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.
  FdxNotificationEntity.new(notification_id: notification_id,
                            type: type,
                            sent_on: sent_on,
                            category: category,
                            notification_payload: notification_payload,
                            subtype: subtype,
                            severity: severity,
                            priority: priority,
                            publisher: publisher,
                            subscriber: subscriber,
                            url: url,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/the_plaid_api/models/fdx_notification_entity.rb', line 66

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['notification_id'] = 'notificationId'
  @_hash['type'] = 'type'
  @_hash['subtype'] = 'subtype'
  @_hash['sent_on'] = 'sentOn'
  @_hash['category'] = 'category'
  @_hash['severity'] = 'severity'
  @_hash['priority'] = 'priority'
  @_hash['publisher'] = 'publisher'
  @_hash['subscriber'] = 'subscriber'
  @_hash['notification_payload'] = 'notificationPayload'
  @_hash['url'] = 'url'
  @_hash
end

.nullablesObject

An array for nullable fields



95
96
97
# File 'lib/the_plaid_api/models/fdx_notification_entity.rb', line 95

def self.nullables
  []
end

.optionalsObject

An array for optional fields



83
84
85
86
87
88
89
90
91
92
# File 'lib/the_plaid_api/models/fdx_notification_entity.rb', line 83

def self.optionals
  %w[
    subtype
    severity
    priority
    publisher
    subscriber
    url
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



177
178
179
180
181
182
183
184
185
# File 'lib/the_plaid_api/models/fdx_notification_entity.rb', line 177

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} notification_id: #{@notification_id.inspect}, type: #{@type.inspect},"\
  " subtype: #{@subtype.inspect}, sent_on: #{@sent_on.inspect}, category:"\
  " #{@category.inspect}, severity: #{@severity.inspect}, priority: #{@priority.inspect},"\
  " publisher: #{@publisher.inspect}, subscriber: #{@subscriber.inspect},"\
  " notification_payload: #{@notification_payload.inspect}, url: #{@url.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_custom_sent_onObject



163
164
165
# File 'lib/the_plaid_api/models/fdx_notification_entity.rb', line 163

def to_custom_sent_on
  DateTimeHelper.to_rfc3339(sent_on)
end

#to_sObject

Provides a human-readable string representation of the object.



168
169
170
171
172
173
174
# File 'lib/the_plaid_api/models/fdx_notification_entity.rb', line 168

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} notification_id: #{@notification_id}, type: #{@type}, subtype: #{@subtype},"\
  " sent_on: #{@sent_on}, category: #{@category}, severity: #{@severity}, priority:"\
  " #{@priority}, publisher: #{@publisher}, subscriber: #{@subscriber}, notification_payload:"\
  " #{@notification_payload}, url: #{@url}, additional_properties: #{@additional_properties}>"
end