Class: Svix::EndpointDisabledEventData

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

Overview

Sent when an endpoint has been automatically disabled after continuous failures, or manually via an API call.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ EndpointDisabledEventData

Returns a new instance of EndpointDisabledEventData.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/svix/models/endpoint_disabled_event_data.rb', line 22

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

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

Instance Attribute Details

#app_idObject

The Application’s ID.



9
10
11
# File 'lib/svix/models/endpoint_disabled_event_data.rb', line 9

def app_id
  @app_id
end

#app_uidObject

The Application’s UID.



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

def app_uid
  @app_uid
end

#endpoint_idObject

The Endpoint’s ID.



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

def endpoint_id
  @endpoint_id
end

#endpoint_uidObject

The Endpoint’s UID.



15
16
17
# File 'lib/svix/models/endpoint_disabled_event_data.rb', line 15

def endpoint_uid
  @endpoint_uid
end

#fail_sinceObject

Returns the value of attribute fail_since.



16
17
18
# File 'lib/svix/models/endpoint_disabled_event_data.rb', line 16

def fail_since
  @fail_since
end

#triggerObject

Returns the value of attribute trigger.



17
18
19
# File 'lib/svix/models/endpoint_disabled_event_data.rb', line 17

def trigger
  @trigger
end

Class Method Details

.deserialize(attributes = {}) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/svix/models/endpoint_disabled_event_data.rb', line 40

def self.deserialize(attributes = {})
  attributes = attributes.transform_keys(&:to_s)
  attrs = Hash.new
  attrs["app_id"] = attributes["appId"]
  attrs["app_uid"] = attributes["appUid"]
  attrs["endpoint_id"] = attributes["endpointId"]
  attrs["endpoint_uid"] = attributes["endpointUid"]
  attrs["fail_since"] = DateTime.rfc3339(attributes["failSince"]).to_time if attributes["failSince"]
  attrs["trigger"] = Svix::EndpointDisabledTrigger.deserialize(attributes["trigger"]) if attributes["trigger"]
  new(attrs)
end

Instance Method Details

#serializeObject



52
53
54
55
56
57
58
59
60
61
# File 'lib/svix/models/endpoint_disabled_event_data.rb', line 52

def serialize
  out = Hash.new
  out["appId"] = Svix::serialize_primitive(@app_id) if @app_id
  out["appUid"] = Svix::serialize_primitive(@app_uid) if @app_uid
  out["endpointId"] = Svix::serialize_primitive(@endpoint_id) if @endpoint_id
  out["endpointUid"] = Svix::serialize_primitive(@endpoint_uid) if @endpoint_uid
  out["failSince"] = Svix::serialize_primitive(@fail_since) if @fail_since
  out["trigger"] = Svix::serialize_schema_ref(@trigger) if @trigger
  out
end

#to_jsonObject

Serializes the object to a json string

Returns:

  • String



65
66
67
# File 'lib/svix/models/endpoint_disabled_event_data.rb', line 65

def to_json
  JSON.dump(serialize)
end