Class: Hook0::Generated::EventPost
- Inherits:
-
Object
- Object
- Hook0::Generated::EventPost
- Defined in:
- lib/hook0/generated/models.rb
Overview
The EventPost the API declares.
Instance Attribute Summary collapse
-
#application_id ⇒ Object
readonly
Returns the value of attribute application_id.
-
#event_id ⇒ Object
readonly
Returns the value of attribute event_id.
-
#event_type ⇒ Object
readonly
Returns the value of attribute event_type.
-
#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.
Class Method Summary collapse
-
.from_json(value) ⇒ EventPost
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(application_id:, event_type:, labels:, occurred_at:, payload:, payload_content_type:, event_id: nil, metadata: nil) ⇒ EventPost
constructor
A new instance of EventPost.
-
#to_h ⇒ Hash{String => Object}
Write one back the way the API reads it.
Constructor Details
#initialize(application_id:, event_type:, labels:, occurred_at:, payload:, payload_content_type:, event_id: nil, metadata: nil) ⇒ EventPost
Returns a new instance of EventPost.
834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 |
# File 'lib/hook0/generated/models.rb', line 834 def initialize( application_id:, event_type:, labels:, occurred_at:, payload:, payload_content_type:, event_id: nil, metadata: nil ) @application_id = application_id @event_type = event_type @labels = labels @occurred_at = occurred_at @payload = payload @payload_content_type = payload_content_type @event_id = event_id @metadata = freeze end |
Instance Attribute Details
#application_id ⇒ Object (readonly)
Returns the value of attribute application_id.
811 812 813 |
# File 'lib/hook0/generated/models.rb', line 811 def application_id @application_id end |
#event_id ⇒ Object (readonly)
Returns the value of attribute event_id.
811 812 813 |
# File 'lib/hook0/generated/models.rb', line 811 def event_id @event_id end |
#event_type ⇒ Object (readonly)
Returns the value of attribute event_type.
811 812 813 |
# File 'lib/hook0/generated/models.rb', line 811 def event_type @event_type end |
#labels ⇒ Object (readonly)
Returns the value of attribute labels.
811 812 813 |
# File 'lib/hook0/generated/models.rb', line 811 def labels @labels end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
811 812 813 |
# File 'lib/hook0/generated/models.rb', line 811 def @metadata end |
#occurred_at ⇒ Object (readonly)
Returns the value of attribute occurred_at.
811 812 813 |
# File 'lib/hook0/generated/models.rb', line 811 def occurred_at @occurred_at end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
811 812 813 |
# File 'lib/hook0/generated/models.rb', line 811 def payload @payload end |
#payload_content_type ⇒ Object (readonly)
Returns the value of attribute payload_content_type.
811 812 813 |
# File 'lib/hook0/generated/models.rb', line 811 def payload_content_type @payload_content_type end |
Class Method Details
.from_json(value) ⇒ EventPost
Read one out of what the API answered.
859 860 861 862 863 864 865 866 867 868 869 870 871 |
# File 'lib/hook0/generated/models.rb', line 859 def self.from_json(value) fields = Runtime.as_fields(value, "EventPost") new( application_id: Runtime.read(fields, "application_id", Runtime::UUID), event_type: Runtime.read(fields, "event_type", Runtime::TEXT), labels: Runtime.read(fields, "labels", Runtime.map(Runtime::TEXT)), 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), event_id: Runtime.maybe(fields, "event_id", Runtime::UUID), metadata: Runtime.maybe(fields, "metadata", Runtime.map(Runtime::TEXT)) ) end |
Instance Method Details
#==(other) ⇒ Boolean Also known as: eql?
Whether that value carries the same members as this one.
893 894 895 |
# File 'lib/hook0/generated/models.rb', line 893 def ==(other) other.is_a?(EventPost) && to_h == other.to_h end |
#hash ⇒ Integer
A value two equal instances share, so that either may key a hash.
901 902 903 |
# File 'lib/hook0/generated/models.rb', line 901 def hash to_h.hash end |
#to_h ⇒ Hash{String => Object}
Write one back the way the API reads it.
876 877 878 879 880 881 882 883 884 885 886 887 |
# File 'lib/hook0/generated/models.rb', line 876 def to_h out = {} out["application_id"] = @application_id out["event_type"] = @event_type out["labels"] = @labels out["occurred_at"] = Runtime.moment(@occurred_at) out["payload"] = @payload out["payload_content_type"] = @payload_content_type out["event_id"] = @event_id unless @event_id.nil? out["metadata"] = @metadata unless @metadata.nil? out end |