Class: Cadenya::Types::WebhookDeliveryData

Inherits:
Object
  • Object
show all
Defined in:
lib/cadenya/types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(agent_id: nil, objective_id: nil, objective_event_id: nil, webhook_url: nil, webhook_id: nil, status: nil, attempt_count: nil, last_attempt_at: nil, http_status_code: nil, error_message: nil, latency_ms: nil, event_type: nil, response_headers: nil, response_content_length: nil) ⇒ WebhookDeliveryData

Returns a new instance of WebhookDeliveryData.



7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
# File 'lib/cadenya/types.rb', line 7220

def initialize(agent_id: nil, objective_id: nil, objective_event_id: nil, webhook_url: nil, webhook_id: nil, status: nil, attempt_count: nil, last_attempt_at: nil, http_status_code: nil, error_message: nil, latency_ms: nil, event_type: nil, response_headers: nil, response_content_length: nil)
  @agent_id = agent_id
  @objective_id = objective_id
  @objective_event_id = objective_event_id
  @webhook_url = webhook_url
  @webhook_id = webhook_id
  @status = status
  @attempt_count = attempt_count
  @last_attempt_at = last_attempt_at
  @http_status_code = http_status_code
  @error_message = error_message
  @latency_ms = latency_ms
  @event_type = event_type
  @response_headers = response_headers
  @response_content_length = response_content_length
end

Instance Attribute Details

#agent_idObject (readonly)

Returns the value of attribute agent_id.



7218
7219
7220
# File 'lib/cadenya/types.rb', line 7218

def agent_id
  @agent_id
end

#attempt_countObject (readonly)

Returns the value of attribute attempt_count.



7218
7219
7220
# File 'lib/cadenya/types.rb', line 7218

def attempt_count
  @attempt_count
end

#error_messageObject (readonly)

Returns the value of attribute error_message.



7218
7219
7220
# File 'lib/cadenya/types.rb', line 7218

def error_message
  @error_message
end

#event_typeObject (readonly)

Returns the value of attribute event_type.



7218
7219
7220
# File 'lib/cadenya/types.rb', line 7218

def event_type
  @event_type
end

#http_status_codeObject (readonly)

Returns the value of attribute http_status_code.



7218
7219
7220
# File 'lib/cadenya/types.rb', line 7218

def http_status_code
  @http_status_code
end

#last_attempt_atObject (readonly)

Returns the value of attribute last_attempt_at.



7218
7219
7220
# File 'lib/cadenya/types.rb', line 7218

def last_attempt_at
  @last_attempt_at
end

#latency_msObject (readonly)

Returns the value of attribute latency_ms.



7218
7219
7220
# File 'lib/cadenya/types.rb', line 7218

def latency_ms
  @latency_ms
end

#objective_event_idObject (readonly)

Returns the value of attribute objective_event_id.



7218
7219
7220
# File 'lib/cadenya/types.rb', line 7218

def objective_event_id
  @objective_event_id
end

#objective_idObject (readonly)

Returns the value of attribute objective_id.



7218
7219
7220
# File 'lib/cadenya/types.rb', line 7218

def objective_id
  @objective_id
end

#response_content_lengthObject (readonly)

Returns the value of attribute response_content_length.



7218
7219
7220
# File 'lib/cadenya/types.rb', line 7218

def response_content_length
  @response_content_length
end

#response_headersObject (readonly)

Returns the value of attribute response_headers.



7218
7219
7220
# File 'lib/cadenya/types.rb', line 7218

def response_headers
  @response_headers
end

#statusObject (readonly)

Returns the value of attribute status.



7218
7219
7220
# File 'lib/cadenya/types.rb', line 7218

def status
  @status
end

#webhook_idObject (readonly)

Returns the value of attribute webhook_id.



7218
7219
7220
# File 'lib/cadenya/types.rb', line 7218

def webhook_id
  @webhook_id
end

#webhook_urlObject (readonly)

Returns the value of attribute webhook_url.



7218
7219
7220
# File 'lib/cadenya/types.rb', line 7218

def webhook_url
  @webhook_url
end

Class Method Details

.from_json(data) ⇒ Object



7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
# File 'lib/cadenya/types.rb', line 7237

def self.from_json(data)
  new(
    agent_id: data["agentId"],
    objective_id: data["objectiveId"],
    objective_event_id: data["objectiveEventId"],
    webhook_url: data["webhookUrl"],
    webhook_id: data["webhookId"],
    status: data["status"],
    attempt_count: data["attemptCount"],
    last_attempt_at: data["lastAttemptAt"].nil? ? nil : Time.iso8601(data["lastAttemptAt"]),
    http_status_code: data["httpStatusCode"],
    error_message: data["errorMessage"],
    latency_ms: data["latencyMs"],
    event_type: data["eventType"],
    response_headers: data["responseHeaders"],
    response_content_length: data["responseContentLength"],
  )
end

Instance Method Details

#to_hObject



7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
# File 'lib/cadenya/types.rb', line 7256

def to_h
  {
    agent_id: Util.plain(@agent_id),
    objective_id: Util.plain(@objective_id),
    objective_event_id: Util.plain(@objective_event_id),
    webhook_url: Util.plain(@webhook_url),
    webhook_id: Util.plain(@webhook_id),
    status: Util.plain(@status),
    attempt_count: Util.plain(@attempt_count),
    last_attempt_at: Util.plain(@last_attempt_at),
    http_status_code: Util.plain(@http_status_code),
    error_message: Util.plain(@error_message),
    latency_ms: Util.plain(@latency_ms),
    event_type: Util.plain(@event_type),
    response_headers: Util.plain(@response_headers),
    response_content_length: Util.plain(@response_content_length),
  }.reject { |_k, v| v.nil? }
end