Class: FdxV660Api::NotificationPayloadEntity
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- FdxV660Api::NotificationPayloadEntity
- Defined in:
- lib/fdx_v660_api/models/notification_payload_entity.rb
Overview
The payload data of event for which notification is being sent
Instance Attribute Summary collapse
-
#attributes ⇒ Array[FiAttributeEntity]
Array of custom key-value pairs for a notification.
-
#custom_fields ⇒ FiAttributeEntity1
A single custom key-value pair for a notification.
-
#event ⇒ LifecycleEventEntity1
Reason and initiator of change event reported in this notification.
-
#id ⇒ String
ID for the origination entity related to the notification.
-
#id_type ⇒ NotificationPayloadIdType2
Type of entity causing origination of the notification with the given ID.
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(id: SKIP, id_type: SKIP, event: SKIP, custom_fields: SKIP, attributes: SKIP, additional_properties: nil) ⇒ NotificationPayloadEntity
constructor
A new instance of NotificationPayloadEntity.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#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(id: SKIP, id_type: SKIP, event: SKIP, custom_fields: SKIP, attributes: SKIP, additional_properties: nil) ⇒ NotificationPayloadEntity
Returns a new instance of NotificationPayloadEntity.
60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/fdx_v660_api/models/notification_payload_entity.rb', line 60 def initialize(id: SKIP, id_type: SKIP, event: SKIP, custom_fields: SKIP, attributes: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @id = id unless id == SKIP @id_type = id_type unless id_type == SKIP @event = event unless event == SKIP @custom_fields = custom_fields unless custom_fields == SKIP @attributes = attributes unless attributes == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#attributes ⇒ Array[FiAttributeEntity]
Array of custom key-value pairs for a notification
31 32 33 |
# File 'lib/fdx_v660_api/models/notification_payload_entity.rb', line 31 def attributes @attributes end |
#custom_fields ⇒ FiAttributeEntity1
A single custom key-value pair for a notification. Deprecated in release
v6.6 and replaced with attributes array
27 28 29 |
# File 'lib/fdx_v660_api/models/notification_payload_entity.rb', line 27 def custom_fields @custom_fields end |
#event ⇒ LifecycleEventEntity1
Reason and initiator of change event reported in this notification
22 23 24 |
# File 'lib/fdx_v660_api/models/notification_payload_entity.rb', line 22 def event @event end |
#id ⇒ String
ID for the origination entity related to the notification
14 15 16 |
# File 'lib/fdx_v660_api/models/notification_payload_entity.rb', line 14 def id @id end |
#id_type ⇒ NotificationPayloadIdType2
Type of entity causing origination of the notification with the given ID
18 19 20 |
# File 'lib/fdx_v660_api/models/notification_payload_entity.rb', line 18 def id_type @id_type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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/fdx_v660_api/models/notification_payload_entity.rb', line 74 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : SKIP id_type = hash.key?('idType') ? hash['idType'] : SKIP event = LifecycleEventEntity1.from_hash(hash['event']) if hash['event'] custom_fields = FiAttributeEntity1.from_hash(hash['customFields']) if hash['customFields'] # Parameter is an array, so we need to iterate through it attributes = nil unless hash['attributes'].nil? attributes = [] hash['attributes'].each do |structure| attributes << (FiAttributeEntity.from_hash(structure) if structure) end end attributes = SKIP unless hash.key?('attributes') # 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. NotificationPayloadEntity.new(id: id, id_type: id_type, event: event, custom_fields: custom_fields, attributes: attributes, 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 42 |
# File 'lib/fdx_v660_api/models/notification_payload_entity.rb', line 34 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['id_type'] = 'idType' @_hash['event'] = 'event' @_hash['custom_fields'] = 'customFields' @_hash['attributes'] = 'attributes' @_hash end |
.nullables ⇒ Object
An array for nullable fields
56 57 58 |
# File 'lib/fdx_v660_api/models/notification_payload_entity.rb', line 56 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
45 46 47 48 49 50 51 52 53 |
# File 'lib/fdx_v660_api/models/notification_payload_entity.rb', line 45 def self.optionals %w[ id id_type event custom_fields attributes ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
118 119 120 121 122 123 |
# File 'lib/fdx_v660_api/models/notification_payload_entity.rb', line 118 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, id_type: #{@id_type.inspect}, event: #{@event.inspect},"\ " custom_fields: #{@custom_fields.inspect}, attributes: #{@attributes.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
110 111 112 113 114 115 |
# File 'lib/fdx_v660_api/models/notification_payload_entity.rb', line 110 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, id_type: #{@id_type}, event: #{@event}, custom_fields:"\ " #{@custom_fields}, attributes: #{@attributes}, additional_properties:"\ " #{@additional_properties}>" end |