Class: Synthra::WebhookSimulator::WebhookResult

Inherits:
Object
  • Object
show all
Defined in:
lib/synthra/webhook_simulator.rb

Overview

Webhook delivery result

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(success:, status:, body: nil, error: nil, payload: nil, message: nil) ⇒ WebhookResult

Returns a new instance of WebhookResult.



240
241
242
243
244
245
246
247
# File 'lib/synthra/webhook_simulator.rb', line 240

def initialize(success:, status:, body: nil, error: nil, payload: nil, message: nil)
  @success = success
  @status = status
  @body = body
  @error = error
  @payload = payload
  @message = message
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



238
239
240
# File 'lib/synthra/webhook_simulator.rb', line 238

def body
  @body
end

#errorObject (readonly)

Returns the value of attribute error.



238
239
240
# File 'lib/synthra/webhook_simulator.rb', line 238

def error
  @error
end

#payloadObject (readonly)

Returns the value of attribute payload.



238
239
240
# File 'lib/synthra/webhook_simulator.rb', line 238

def payload
  @payload
end

#statusObject (readonly)

Returns the value of attribute status.



238
239
240
# File 'lib/synthra/webhook_simulator.rb', line 238

def status
  @status
end

#successObject (readonly)

Returns the value of attribute success.



238
239
240
# File 'lib/synthra/webhook_simulator.rb', line 238

def success
  @success
end

Instance Method Details

#failed?Boolean

Returns:

  • (Boolean)


253
254
255
# File 'lib/synthra/webhook_simulator.rb', line 253

def failed?
  !@success
end

#success?Boolean

Returns:

  • (Boolean)


249
250
251
# File 'lib/synthra/webhook_simulator.rb', line 249

def success?
  @success
end

#to_hObject



257
258
259
260
261
262
263
264
# File 'lib/synthra/webhook_simulator.rb', line 257

def to_h
  {
    success: @success,
    status: @status,
    body: @body,
    error: @error
  }
end