Class: Svix::StreamSinkOut
- Inherits:
-
Object
- Object
- Svix::StreamSinkOut
- Defined in:
- lib/svix/models/stream_sink_out.rb
Instance Attribute Summary collapse
-
#batch_size ⇒ Object
Returns the value of attribute batch_size.
-
#config ⇒ Object
Returns the value of attribute config.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#current_iterator ⇒ Object
Returns the value of attribute current_iterator.
-
#event_types ⇒ Object
Returns the value of attribute event_types.
-
#failure_reason ⇒ Object
Returns the value of attribute failure_reason.
-
#id ⇒ Object
The sink’s ID.
-
#max_wait_secs ⇒ Object
Returns the value of attribute max_wait_secs.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#next_retry_at ⇒ Object
Returns the value of attribute next_retry_at.
-
#status ⇒ Object
Returns the value of attribute status.
-
#uid ⇒ Object
The sink’s UID.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ StreamSinkOut
constructor
A new instance of StreamSinkOut.
- #serialize ⇒ Object
-
#to_json ⇒ Object
Serializes the object to a json string.
Constructor Details
#initialize(attributes = {}) ⇒ StreamSinkOut
Returns a new instance of StreamSinkOut.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/svix/models/stream_sink_out.rb', line 91 def initialize(attributes = {}) unless attributes.is_a?(Hash) fail( ArgumentError, "The input argument (attributes) must be a hash in `Svix::StreamSinkOut` new method" ) end attributes.each do |k, v| unless ALL_FIELD.include?(k.to_s) fail(ArgumentError, "The field #{k} is not part of Svix::StreamSinkOut") end if k == "config" unless TYPE_TO_NAME.key?(v.class) fail(ArgumentError, "The field #{k} can't be a `#{v.class}` expected one of #{TYPE_TO_NAME.keys}") end instance_variable_set("@__enum_discriminator", TYPE_TO_NAME[v.class]) end instance_variable_set("@#{k}", v) instance_variable_set("@__#{k}_is_defined", true) end if @__enum_discriminator.nil? fail(ArgumentError, "Required config field was not set") end end |
Instance Attribute Details
#batch_size ⇒ Object
Returns the value of attribute batch_size.
47 48 49 |
# File 'lib/svix/models/stream_sink_out.rb', line 47 def batch_size @batch_size end |
#config ⇒ Object
Returns the value of attribute config.
61 62 63 |
# File 'lib/svix/models/stream_sink_out.rb', line 61 def config @config end |
#created_at ⇒ Object
Returns the value of attribute created_at.
48 49 50 |
# File 'lib/svix/models/stream_sink_out.rb', line 48 def created_at @created_at end |
#current_iterator ⇒ Object
Returns the value of attribute current_iterator.
49 50 51 |
# File 'lib/svix/models/stream_sink_out.rb', line 49 def current_iterator @current_iterator end |
#event_types ⇒ Object
Returns the value of attribute event_types.
50 51 52 |
# File 'lib/svix/models/stream_sink_out.rb', line 50 def event_types @event_types end |
#failure_reason ⇒ Object
Returns the value of attribute failure_reason.
51 52 53 |
# File 'lib/svix/models/stream_sink_out.rb', line 51 def failure_reason @failure_reason end |
#id ⇒ Object
The sink’s ID.
53 54 55 |
# File 'lib/svix/models/stream_sink_out.rb', line 53 def id @id end |
#max_wait_secs ⇒ Object
Returns the value of attribute max_wait_secs.
54 55 56 |
# File 'lib/svix/models/stream_sink_out.rb', line 54 def max_wait_secs @max_wait_secs end |
#metadata ⇒ Object
Returns the value of attribute metadata.
55 56 57 |
# File 'lib/svix/models/stream_sink_out.rb', line 55 def end |
#next_retry_at ⇒ Object
Returns the value of attribute next_retry_at.
56 57 58 |
# File 'lib/svix/models/stream_sink_out.rb', line 56 def next_retry_at @next_retry_at end |
#status ⇒ Object
Returns the value of attribute status.
57 58 59 |
# File 'lib/svix/models/stream_sink_out.rb', line 57 def status @status end |
#uid ⇒ Object
The sink’s UID.
59 60 61 |
# File 'lib/svix/models/stream_sink_out.rb', line 59 def uid @uid end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
60 61 62 |
# File 'lib/svix/models/stream_sink_out.rb', line 60 def updated_at @updated_at end |
Class Method Details
.deserialize(attributes = {}) ⇒ Object
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 |
# File 'lib/svix/models/stream_sink_out.rb', line 121 def self.deserialize(attributes = {}) attributes = attributes.transform_keys(&:to_s) attrs = Hash.new attrs["batch_size"] = attributes["batchSize"] attrs["created_at"] = DateTime.rfc3339(attributes["createdAt"]).to_time attrs["current_iterator"] = attributes["currentIterator"] attrs["event_types"] = attributes["eventTypes"] attrs["failure_reason"] = attributes["failureReason"] attrs["id"] = attributes["id"] attrs["max_wait_secs"] = attributes["maxWaitSecs"] attrs["metadata"] = attributes["metadata"] attrs["next_retry_at"] = DateTime.rfc3339(attributes["nextRetryAt"]).to_time if attributes["nextRetryAt"] attrs["status"] = Svix::SinkStatus.deserialize(attributes["status"]) attrs["uid"] = attributes["uid"] attrs["updated_at"] = DateTime.rfc3339(attributes["updatedAt"]).to_time unless NAME_TO_TYPE.key?(attributes["type"]) fail(ArgumentError, "Invalid type `#{attributes["type"]}` expected on of #{NAME_TO_TYPE.keys}") end unless attributes.key?("config") fail(ArgumentError, "Missing required field config") end attrs["config"] = NAME_TO_TYPE[attributes["type"]].deserialize(attributes["config"]) new(attrs) end |
Instance Method Details
#serialize ⇒ Object
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/svix/models/stream_sink_out.rb', line 148 def serialize out = Hash.new out["batchSize"] = Svix::serialize_primitive(@batch_size) if @batch_size out["createdAt"] = Svix::serialize_primitive(@created_at) if @created_at out["currentIterator"] = Svix::serialize_primitive(@current_iterator) if @current_iterator out["eventTypes"] = Svix::serialize_primitive(@event_types) if @event_types out["failureReason"] = Svix::serialize_primitive(@failure_reason) if @failure_reason out["id"] = Svix::serialize_primitive(@id) if @id out["maxWaitSecs"] = Svix::serialize_primitive(@max_wait_secs) if @max_wait_secs out["metadata"] = Svix::serialize_primitive() if out["nextRetryAt"] = Svix::serialize_primitive(@next_retry_at) if @next_retry_at out["status"] = Svix::serialize_schema_ref(@status) if @status out["uid"] = Svix::serialize_primitive(@uid) if @uid out["updatedAt"] = Svix::serialize_primitive(@updated_at) if @updated_at out["type"] = @__enum_discriminator out["config"] = @config.serialize out end |
#to_json ⇒ Object
Serializes the object to a json string
169 170 171 |
# File 'lib/svix/models/stream_sink_out.rb', line 169 def to_json JSON.dump(serialize) end |