Class: Svix::SinkInCommon

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

Direct Known Subclasses

AutoConfigSinkTypeConfig::Poller

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ SinkInCommon

Returns a new instance of SinkInCommon.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/svix/models/sink_in_common.rb', line 28

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

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

Instance Attribute Details

#channelsObject

List of message channels this sink listens to (omit for all).



22
23
24
# File 'lib/svix/models/sink_in_common.rb', line 22

def channels
  @channels
end

#descriptionObject

Returns the value of attribute description.



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

def description
  @description
end

#disabledObject

Returns the value of attribute disabled.



19
20
21
# File 'lib/svix/models/sink_in_common.rb', line 19

def disabled
  @disabled
end

#event_typesObject

Returns the value of attribute event_types.



20
21
22
# File 'lib/svix/models/sink_in_common.rb', line 20

def event_types
  @event_types
end

#metadataObject

Returns the value of attribute metadata.



23
24
25
# File 'lib/svix/models/sink_in_common.rb', line 23

def 
  @metadata
end

#secretObject

The endpoint's verification secret.

Format: base64 encoded random bytes optionally prefixed with whsec_. It is recommended to not set this and let the server generate the secret.



18
19
20
# File 'lib/svix/models/sink_in_common.rb', line 18

def secret
  @secret
end

#throttle_rateObject

Maximum messages per second to send to this endpoint.

Outgoing messages will be throttled to this rate.



11
12
13
# File 'lib/svix/models/sink_in_common.rb', line 11

def throttle_rate
  @throttle_rate
end

#uidObject

Optional unique identifier for the sink.



13
14
15
# File 'lib/svix/models/sink_in_common.rb', line 13

def uid
  @uid
end

Class Method Details

.deserialize(attributes = {}) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/svix/models/sink_in_common.rb', line 43

def self.deserialize(attributes = {})
  attributes = attributes.transform_keys(&:to_s)
  attrs = Hash.new
  attrs["description"] = attributes["description"]
  attrs["throttle_rate"] = attributes["throttleRate"]
  attrs["uid"] = attributes["uid"]
  attrs["secret"] = attributes["secret"]
  attrs["disabled"] = attributes["disabled"]
  attrs["event_types"] = attributes["eventTypes"]
  attrs["channels"] = attributes["channels"]
  attrs["metadata"] = attributes["metadata"]
  new(attrs)
end

Instance Method Details

#serializeObject



57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/svix/models/sink_in_common.rb', line 57

def serialize
  out = Hash.new
  out["description"] = Svix::serialize_primitive(@description) if @description
  out["throttleRate"] = Svix::serialize_primitive(@throttle_rate) if @throttle_rate
  out["uid"] = Svix::serialize_primitive(@uid) if @uid
  out["secret"] = Svix::serialize_primitive(@secret) if @secret
  out["disabled"] = Svix::serialize_primitive(@disabled) if @disabled
  out["eventTypes"] = Svix::serialize_primitive(@event_types) if @event_types
  out["channels"] = Svix::serialize_primitive(@channels) if @channels
  out["metadata"] = Svix::serialize_primitive(@metadata) if @metadata
  out
end

#to_jsonObject

Serializes the object to a json string

Returns:

  • String



72
73
74
# File 'lib/svix/models/sink_in_common.rb', line 72

def to_json
  JSON.dump(serialize)
end