Class: Svix::RotatePollerTokenIn

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ RotatePollerTokenIn

Returns a new instance of RotatePollerTokenIn.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/svix/models/rotate_poller_token_in.rb', line 19

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

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

Instance Attribute Details

#expiryObject

How long the token will be valid for, in seconds. Can be up to 31,536,000 seconds (1 year).



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

def expiry
  @expiry
end

#old_token_expiryObject

Updates the previous token’s expiration, in seconds.

If set to 0, the old token will immediately be revoked. Must be between 0 and 86,400 seconds (1 day).

Defaults to 300 seconds (5 minutes).



14
15
16
# File 'lib/svix/models/rotate_poller_token_in.rb', line 14

def old_token_expiry
  @old_token_expiry
end

Class Method Details

.deserialize(attributes = {}) ⇒ Object



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

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

Instance Method Details

#serializeObject



42
43
44
45
46
47
# File 'lib/svix/models/rotate_poller_token_in.rb', line 42

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

#to_jsonObject

Serializes the object to a json string

Returns:

  • String



51
52
53
# File 'lib/svix/models/rotate_poller_token_in.rb', line 51

def to_json
  JSON.dump(serialize)
end