Class: Svix::EnvironmentOut
- Inherits:
-
Object
- Object
- Svix::EnvironmentOut
- Defined in:
- lib/svix/models/environment_out.rb
Instance Attribute Summary collapse
-
#connectors ⇒ Object
Returns the value of attribute connectors.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#event_types ⇒ Object
Returns the value of attribute event_types.
-
#settings ⇒ Object
Returns the value of attribute settings.
-
#version ⇒ Object
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ EnvironmentOut
constructor
A new instance of EnvironmentOut.
- #serialize ⇒ Object
-
#to_json ⇒ Object
Serializes the object to a json string.
Constructor Details
#initialize(attributes = {}) ⇒ EnvironmentOut
Returns a new instance of EnvironmentOut.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/svix/models/environment_out.rb', line 16 def initialize(attributes = {}) unless attributes.is_a?(Hash) fail(ArgumentError, "The input argument (attributes) must be a hash in `Svix::EnvironmentOut` 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::EnvironmentOut") end instance_variable_set("@#{k}", v) instance_variable_set("@__#{k}_is_defined", true) end end |
Instance Attribute Details
#connectors ⇒ Object
Returns the value of attribute connectors.
7 8 9 |
# File 'lib/svix/models/environment_out.rb', line 7 def connectors @connectors end |
#created_at ⇒ Object
Returns the value of attribute created_at.
8 9 10 |
# File 'lib/svix/models/environment_out.rb', line 8 def created_at @created_at end |
#event_types ⇒ Object
Returns the value of attribute event_types.
9 10 11 |
# File 'lib/svix/models/environment_out.rb', line 9 def event_types @event_types end |
#settings ⇒ Object
Returns the value of attribute settings.
10 11 12 |
# File 'lib/svix/models/environment_out.rb', line 10 def settings @settings end |
#version ⇒ Object
Returns the value of attribute version.
11 12 13 |
# File 'lib/svix/models/environment_out.rb', line 11 def version @version end |
Class Method Details
.deserialize(attributes = {}) ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/svix/models/environment_out.rb', line 31 def self.deserialize(attributes = {}) attributes = attributes.transform_keys(&:to_s) attrs = Hash.new attrs["connectors"] = attributes["connectors"].map { |v| Svix::ConnectorOut.deserialize(v) } attrs["created_at"] = DateTime.rfc3339(attributes["createdAt"]).to_time attrs["event_types"] = attributes["eventTypes"].map { |v| Svix::EventTypeOut.deserialize(v) } attrs["settings"] = attributes["settings"] attrs["version"] = attributes["version"] new(attrs) end |
Instance Method Details
#serialize ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/svix/models/environment_out.rb', line 42 def serialize out = Hash.new out["connectors"] = @connectors.map { |v| v.serialize } if @connectors out["createdAt"] = Svix::serialize_primitive(@created_at) if @created_at out["eventTypes"] = @event_types.map { |v| v.serialize } if @event_types out["settings"] = Svix::serialize_primitive(@settings) if @settings out["version"] = Svix::serialize_primitive(@version) if @version out end |
#to_json ⇒ Object
Serializes the object to a json string
54 55 56 |
# File 'lib/svix/models/environment_out.rb', line 54 def to_json JSON.dump(serialize) end |