Class: Svix::ReplayIn

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ReplayIn

Returns a new instance of ReplayIn.



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

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

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

Instance Attribute Details

#sinceObject

Returns the value of attribute since.



7
8
9
# File 'lib/svix/models/replay_in.rb', line 7

def since
  @since
end

#untilObject

Returns the value of attribute until.



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

def until
  @until
end

Class Method Details

.deserialize(attributes = {}) ⇒ Object



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

def self.deserialize(attributes = {})
  attributes = attributes.transform_keys(&:to_s)
  attrs = Hash.new
  attrs["since"] = DateTime.rfc3339(attributes["since"]).to_time
  attrs["until"] = DateTime.rfc3339(attributes["until"]).to_time if attributes["until"]
  new(attrs)
end

Instance Method Details

#serializeObject



36
37
38
39
40
41
# File 'lib/svix/models/replay_in.rb', line 36

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

#to_jsonObject

Serializes the object to a json string

Returns:

  • String



45
46
47
# File 'lib/svix/models/replay_in.rb', line 45

def to_json
  JSON.dump(serialize)
end