Class: Svix::MessagePrecheckOut

Inherits:
Object
  • Object
show all
Defined in:
lib/svix/models/message_precheck_out.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ MessagePrecheckOut

Returns a new instance of MessagePrecheckOut.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/svix/models/message_precheck_out.rb', line 13

def initialize(attributes = {})
  unless attributes.is_a?(Hash)
    fail(ArgumentError, "The input argument (attributes) must be a hash in `Svix::MessagePrecheckOut` 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::MessagePrecheckOut")
    end

    instance_variable_set("@#{k}", v)
    instance_variable_set("@__#{k}_is_defined", true)
  end
end

Instance Attribute Details

#activeObject

Whether there are any active endpoint that would get sent such a message.



8
9
10
# File 'lib/svix/models/message_precheck_out.rb', line 8

def active
  @active
end

Class Method Details

.deserialize(attributes = {}) ⇒ Object



28
29
30
31
32
33
# File 'lib/svix/models/message_precheck_out.rb', line 28

def self.deserialize(attributes = {})
  attributes = attributes.transform_keys(&:to_s)
  attrs = Hash.new
  attrs["active"] = attributes["active"]
  new(attrs)
end

Instance Method Details

#serializeObject



35
36
37
38
39
# File 'lib/svix/models/message_precheck_out.rb', line 35

def serialize
  out = Hash.new
  out["active"] = Svix::serialize_primitive(@active) if @active
  out
end

#to_jsonObject

Serializes the object to a json string

Returns:

  • String



43
44
45
# File 'lib/svix/models/message_precheck_out.rb', line 43

def to_json
  JSON.dump(serialize)
end