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.
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 162 163 164 |
# File 'lib/svix/models/stream_sink_out.rb', line 136 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.
83 84 85 |
# File 'lib/svix/models/stream_sink_out.rb', line 83 def batch_size @batch_size end |
#config ⇒ Object
Returns the value of attribute config.
97 98 99 |
# File 'lib/svix/models/stream_sink_out.rb', line 97 def config @config end |
#created_at ⇒ Object
Returns the value of attribute created_at.
84 85 86 |
# File 'lib/svix/models/stream_sink_out.rb', line 84 def created_at @created_at end |
#current_iterator ⇒ Object
Returns the value of attribute current_iterator.
85 86 87 |
# File 'lib/svix/models/stream_sink_out.rb', line 85 def current_iterator @current_iterator end |
#event_types ⇒ Object
Returns the value of attribute event_types.
86 87 88 |
# File 'lib/svix/models/stream_sink_out.rb', line 86 def event_types @event_types end |
#failure_reason ⇒ Object
Returns the value of attribute failure_reason.
87 88 89 |
# File 'lib/svix/models/stream_sink_out.rb', line 87 def failure_reason @failure_reason end |
#id ⇒ Object
The sink’s ID.
89 90 91 |
# File 'lib/svix/models/stream_sink_out.rb', line 89 def id @id end |
#max_wait_secs ⇒ Object
Returns the value of attribute max_wait_secs.
90 91 92 |
# File 'lib/svix/models/stream_sink_out.rb', line 90 def max_wait_secs @max_wait_secs end |
#metadata ⇒ Object
Returns the value of attribute metadata.
91 92 93 |
# File 'lib/svix/models/stream_sink_out.rb', line 91 def @metadata end |
#next_retry_at ⇒ Object
Returns the value of attribute next_retry_at.
92 93 94 |
# File 'lib/svix/models/stream_sink_out.rb', line 92 def next_retry_at @next_retry_at end |
#status ⇒ Object
Returns the value of attribute status.
93 94 95 |
# File 'lib/svix/models/stream_sink_out.rb', line 93 def status @status end |
#uid ⇒ Object
The sink’s UID.
95 96 97 |
# File 'lib/svix/models/stream_sink_out.rb', line 95 def uid @uid end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
96 97 98 |
# File 'lib/svix/models/stream_sink_out.rb', line 96 def updated_at @updated_at end |
Class Method Details
.deserialize(attributes = {}) ⇒ Object
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/svix/models/stream_sink_out.rb', line 166 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
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
# File 'lib/svix/models/stream_sink_out.rb', line 193 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(@metadata) if @metadata 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
214 215 216 |
# File 'lib/svix/models/stream_sink_out.rb', line 214 def to_json JSON.dump(serialize) end |