Class: Hook0::Generated::EventWithPayload
- Inherits:
-
Object
- Object
- Hook0::Generated::EventWithPayload
- Defined in:
- lib/hook0/generated/models.rb
Overview
The EventWithPayload the API declares.
Instance Attribute Summary collapse
-
#event_id ⇒ Object
readonly
Returns the value of attribute event_id.
-
#event_type_name ⇒ Object
readonly
Returns the value of attribute event_type_name.
-
#ip ⇒ Object
readonly
Returns the value of attribute ip.
-
#labels ⇒ Object
readonly
Returns the value of attribute labels.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#occurred_at ⇒ Object
readonly
Returns the value of attribute occurred_at.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#payload_content_type ⇒ Object
readonly
Returns the value of attribute payload_content_type.
-
#received_at ⇒ Object
readonly
Returns the value of attribute received_at.
Class Method Summary collapse
-
.from_json(value) ⇒ EventWithPayload
Read one out of what the API answered.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
(also: #eql?)
Whether that value carries the same members as this one.
-
#hash ⇒ Integer
A value two equal instances share, so that either may key a hash.
-
#initialize(event_id:, event_type_name:, ip:, labels:, occurred_at:, payload:, payload_content_type:, received_at:, metadata: nil) ⇒ EventWithPayload
constructor
A new instance of EventWithPayload.
-
#to_h ⇒ Hash{String => Object}
Write one back the way the API reads it.
Constructor Details
#initialize(event_id:, event_type_name:, ip:, labels:, occurred_at:, payload:, payload_content_type:, received_at:, metadata: nil) ⇒ EventWithPayload
Returns a new instance of EventWithPayload.
1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 |
# File 'lib/hook0/generated/models.rb', line 1051 def initialize( event_id:, event_type_name:, ip:, labels:, occurred_at:, payload:, payload_content_type:, received_at:, metadata: nil ) @event_id = event_id @event_type_name = event_type_name @ip = ip @labels = labels @occurred_at = occurred_at @payload = payload @payload_content_type = payload_content_type @received_at = received_at @metadata = freeze end |
Instance Attribute Details
#event_id ⇒ Object (readonly)
Returns the value of attribute event_id.
1032 1033 1034 |
# File 'lib/hook0/generated/models.rb', line 1032 def event_id @event_id end |
#event_type_name ⇒ Object (readonly)
Returns the value of attribute event_type_name.
1032 1033 1034 |
# File 'lib/hook0/generated/models.rb', line 1032 def event_type_name @event_type_name end |
#ip ⇒ Object (readonly)
Returns the value of attribute ip.
1032 1033 1034 |
# File 'lib/hook0/generated/models.rb', line 1032 def ip @ip end |
#labels ⇒ Object (readonly)
Returns the value of attribute labels.
1032 1033 1034 |
# File 'lib/hook0/generated/models.rb', line 1032 def labels @labels end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
1032 1033 1034 |
# File 'lib/hook0/generated/models.rb', line 1032 def @metadata end |
#occurred_at ⇒ Object (readonly)
Returns the value of attribute occurred_at.
1032 1033 1034 |
# File 'lib/hook0/generated/models.rb', line 1032 def occurred_at @occurred_at end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
1032 1033 1034 |
# File 'lib/hook0/generated/models.rb', line 1032 def payload @payload end |
#payload_content_type ⇒ Object (readonly)
Returns the value of attribute payload_content_type.
1032 1033 1034 |
# File 'lib/hook0/generated/models.rb', line 1032 def payload_content_type @payload_content_type end |
#received_at ⇒ Object (readonly)
Returns the value of attribute received_at.
1032 1033 1034 |
# File 'lib/hook0/generated/models.rb', line 1032 def received_at @received_at end |
Class Method Details
.from_json(value) ⇒ EventWithPayload
Read one out of what the API answered.
1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 |
# File 'lib/hook0/generated/models.rb', line 1078 def self.from_json(value) fields = Runtime.as_fields(value, "EventWithPayload") new( event_id: Runtime.read(fields, "event_id", Runtime::UUID), event_type_name: Runtime.read(fields, "event_type_name", Runtime::TEXT), ip: Runtime.read(fields, "ip", Runtime::TEXT), labels: Runtime.read(fields, "labels", Runtime::JSON_VALUE), occurred_at: Runtime.read(fields, "occurred_at", Runtime::DATE_TIME), payload: Runtime.read(fields, "payload", Runtime::TEXT), payload_content_type: Runtime.read(fields, "payload_content_type", Runtime::TEXT), received_at: Runtime.read(fields, "received_at", Runtime::DATE_TIME), metadata: Runtime.maybe(fields, "metadata", Runtime::JSON_VALUE) ) end |
Instance Method Details
#==(other) ⇒ Boolean Also known as: eql?
Whether that value carries the same members as this one.
1114 1115 1116 |
# File 'lib/hook0/generated/models.rb', line 1114 def ==(other) other.is_a?(EventWithPayload) && to_h == other.to_h end |
#hash ⇒ Integer
A value two equal instances share, so that either may key a hash.
1122 1123 1124 |
# File 'lib/hook0/generated/models.rb', line 1122 def hash to_h.hash end |
#to_h ⇒ Hash{String => Object}
Write one back the way the API reads it.
1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 |
# File 'lib/hook0/generated/models.rb', line 1096 def to_h out = {} out["event_id"] = @event_id out["event_type_name"] = @event_type_name out["ip"] = @ip out["labels"] = @labels out["occurred_at"] = Runtime.moment(@occurred_at) out["payload"] = @payload out["payload_content_type"] = @payload_content_type out["received_at"] = Runtime.moment(@received_at) out["metadata"] = @metadata unless @metadata.nil? out end |