Class: Svix::AutoConfigSinkType
- Inherits:
-
Object
- Object
- Svix::AutoConfigSinkType
- Defined in:
- lib/svix/models/auto_config_sink_type.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ AutoConfigSinkType
constructor
A new instance of AutoConfigSinkType.
- #serialize ⇒ Object
-
#to_json ⇒ Object
Serializes the object to a json string.
Constructor Details
#initialize(attributes = {}) ⇒ AutoConfigSinkType
Returns a new instance of AutoConfigSinkType.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/svix/models/auto_config_sink_type.rb', line 30 def initialize(attributes = {}) unless attributes.is_a?(Hash) fail( ArgumentError, "The input argument (attributes) must be a hash in `Svix::AutoConfigSinkType` 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::AutoConfigSinkType") 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.
18 19 20 |
# File 'lib/svix/models/auto_config_sink_type.rb', line 18 def config @config end |
Class Method Details
.deserialize(attributes = {}) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/svix/models/auto_config_sink_type.rb', line 60 def self.deserialize(attributes = {}) attributes = attributes.transform_keys(&:to_s) attrs = Hash.new 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
75 76 77 78 79 80 |
# File 'lib/svix/models/auto_config_sink_type.rb', line 75 def serialize out = Hash.new out["type"] = @__enum_discriminator out["config"] = @config.serialize out end |
#to_json ⇒ Object
Serializes the object to a json string
84 85 86 |
# File 'lib/svix/models/auto_config_sink_type.rb', line 84 def to_json JSON.dump(serialize) end |