Class: Svix::IngestSourceOut
- Inherits:
-
Object
- Object
- Svix::IngestSourceOut
- Defined in:
- lib/svix/models/ingest_source_out.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#id ⇒ Object
The Source’s ID.
-
#ingest_url ⇒ Object
Returns the value of attribute ingest_url.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#name ⇒ Object
Returns the value of attribute name.
-
#uid ⇒ Object
The Source’s UID.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ IngestSourceOut
constructor
A new instance of IngestSourceOut.
- #serialize ⇒ Object
-
#to_json ⇒ Object
Serializes the object to a json string.
Constructor Details
#initialize(attributes = {}) ⇒ IngestSourceOut
Returns a new instance of IngestSourceOut.
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/svix/models/ingest_source_out.rb', line 230 def initialize(attributes = {}) unless attributes.is_a?(Hash) fail( ArgumentError, "The input argument (attributes) must be a hash in `Svix::IngestSourceOut` 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::IngestSourceOut") 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
#config ⇒ Object
Returns the value of attribute config.
179 180 181 |
# File 'lib/svix/models/ingest_source_out.rb', line 179 def config @config end |
#created_at ⇒ Object
Returns the value of attribute created_at.
170 171 172 |
# File 'lib/svix/models/ingest_source_out.rb', line 170 def created_at @created_at end |
#id ⇒ Object
The Source’s ID.
172 173 174 |
# File 'lib/svix/models/ingest_source_out.rb', line 172 def id @id end |
#ingest_url ⇒ Object
Returns the value of attribute ingest_url.
173 174 175 |
# File 'lib/svix/models/ingest_source_out.rb', line 173 def ingest_url @ingest_url end |
#metadata ⇒ Object
Returns the value of attribute metadata.
174 175 176 |
# File 'lib/svix/models/ingest_source_out.rb', line 174 def @metadata end |
#name ⇒ Object
Returns the value of attribute name.
175 176 177 |
# File 'lib/svix/models/ingest_source_out.rb', line 175 def name @name end |
#uid ⇒ Object
The Source’s UID.
177 178 179 |
# File 'lib/svix/models/ingest_source_out.rb', line 177 def uid @uid end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
178 179 180 |
# File 'lib/svix/models/ingest_source_out.rb', line 178 def updated_at @updated_at end |
Class Method Details
.deserialize(attributes = {}) ⇒ Object
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
# File 'lib/svix/models/ingest_source_out.rb', line 260 def self.deserialize(attributes = {}) attributes = attributes.transform_keys(&:to_s) attrs = Hash.new attrs["created_at"] = DateTime.rfc3339(attributes["createdAt"]).to_time attrs["id"] = attributes["id"] attrs["ingest_url"] = attributes["ingestUrl"] attrs["metadata"] = attributes["metadata"] attrs["name"] = attributes["name"] 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
282 283 284 285 286 287 288 289 290 291 292 293 294 |
# File 'lib/svix/models/ingest_source_out.rb', line 282 def serialize out = Hash.new out["createdAt"] = Svix::serialize_primitive(@created_at) if @created_at out["id"] = Svix::serialize_primitive(@id) if @id out["ingestUrl"] = Svix::serialize_primitive(@ingest_url) if @ingest_url out["metadata"] = Svix::serialize_primitive(@metadata) if @metadata out["name"] = Svix::serialize_primitive(@name) if @name 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
298 299 300 |
# File 'lib/svix/models/ingest_source_out.rb', line 298 def to_json JSON.dump(serialize) end |