Class: Mindee::Parsing::V2::JobWebhook
- Inherits:
-
Object
- Object
- Mindee::Parsing::V2::JobWebhook
- Defined in:
- lib/mindee/parsing/v2/job_webhook.rb
Overview
Information about a webhook created for a job response.
Instance Attribute Summary collapse
-
#created_at ⇒ DateTime?
readonly
Creation timestamp (or +nil+ when absent).
-
#error ⇒ ErrorResponse?
readonly
Error information when something failed.
-
#id ⇒ String
readonly
Identifier of the webhook.
-
#status ⇒ String
readonly
Webhook status.
Instance Method Summary collapse
-
#initialize(server_response) ⇒ JobWebhook
constructor
A new instance of JobWebhook.
-
#to_s ⇒ String
RST display.
Constructor Details
#initialize(server_response) ⇒ JobWebhook
Returns a new instance of JobWebhook.
22 23 24 25 26 27 |
# File 'lib/mindee/parsing/v2/job_webhook.rb', line 22 def initialize(server_response) @id = server_response['id'] @created_at = parse_date(server_response['created_at']) @status = server_response['status'] @error = ErrorResponse.new(server_response['error']) if server_response.key?('error') end |
Instance Attribute Details
#created_at ⇒ DateTime? (readonly)
Returns Creation timestamp (or +nil+ when absent).
15 16 17 |
# File 'lib/mindee/parsing/v2/job_webhook.rb', line 15 def created_at @created_at end |
#error ⇒ ErrorResponse? (readonly)
Returns Error information when something failed.
19 20 21 |
# File 'lib/mindee/parsing/v2/job_webhook.rb', line 19 def error @error end |
#id ⇒ String (readonly)
Returns Identifier of the webhook.
13 14 15 |
# File 'lib/mindee/parsing/v2/job_webhook.rb', line 13 def id @id end |
#status ⇒ String (readonly)
Returns Webhook status.
17 18 19 |
# File 'lib/mindee/parsing/v2/job_webhook.rb', line 17 def status @status end |
Instance Method Details
#to_s ⇒ String
RST display.
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/mindee/parsing/v2/job_webhook.rb', line 32 def to_s parts = [ 'JobResponseWebhook', '##################', ":ID: #{@id}", ":CreatedAt: #{@created_at}", ":Status: #{@status}", ] parts << @error.to_s if @error parts.join("\n") end |