Class: Svix::EventStreamOut
- Inherits:
-
Object
- Object
- Svix::EventStreamOut
- Defined in:
- lib/svix/models/event_stream_out.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#done ⇒ Object
Returns the value of attribute done.
-
#iterator ⇒ Object
Returns the value of attribute iterator.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ EventStreamOut
constructor
A new instance of EventStreamOut.
- #serialize ⇒ Object
-
#to_json ⇒ Object
Serializes the object to a json string.
Constructor Details
#initialize(attributes = {}) ⇒ EventStreamOut
Returns a new instance of EventStreamOut.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/svix/models/event_stream_out.rb', line 14 def initialize(attributes = {}) unless attributes.is_a?(Hash) fail(ArgumentError, "The input argument (attributes) must be a hash in `Svix::EventStreamOut` 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::EventStreamOut") end instance_variable_set("@#{k}", v) instance_variable_set("@__#{k}_is_defined", true) end end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
7 8 9 |
# File 'lib/svix/models/event_stream_out.rb', line 7 def data @data end |
#done ⇒ Object
Returns the value of attribute done.
8 9 10 |
# File 'lib/svix/models/event_stream_out.rb', line 8 def done @done end |
#iterator ⇒ Object
Returns the value of attribute iterator.
9 10 11 |
# File 'lib/svix/models/event_stream_out.rb', line 9 def iterator @iterator end |
Class Method Details
.deserialize(attributes = {}) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/svix/models/event_stream_out.rb', line 29 def self.deserialize(attributes = {}) attributes = attributes.transform_keys(&:to_s) attrs = Hash.new attrs["data"] = attributes["data"].map { |v| Svix::EventOut.deserialize(v) } attrs["done"] = attributes["done"] attrs["iterator"] = attributes["iterator"] new(attrs) end |
Instance Method Details
#serialize ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/svix/models/event_stream_out.rb', line 38 def serialize out = Hash.new out["data"] = @data.map { |v| v.serialize } if @data out["done"] = Svix::serialize_primitive(@done) if @done out["iterator"] = Svix::serialize_primitive(@iterator) if @iterator out end |
#to_json ⇒ Object
Serializes the object to a json string
48 49 50 |
# File 'lib/svix/models/event_stream_out.rb', line 48 def to_json JSON.dump(serialize) end |