Class: Mindee::V2::Parsing::JobWebhook
- Inherits:
-
Object
- Object
- Mindee::V2::Parsing::JobWebhook
- Defined in:
- lib/mindee/v2/parsing/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.
21 22 23 24 25 26 |
# File 'lib/mindee/v2/parsing/job_webhook.rb', line 21 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']) unless server_response['error'].nil? end |
Instance Attribute Details
#created_at ⇒ DateTime? (readonly)
Returns Creation timestamp (or +nil+ when absent).
14 15 16 |
# File 'lib/mindee/v2/parsing/job_webhook.rb', line 14 def created_at @created_at end |
#error ⇒ ErrorResponse? (readonly)
Returns Error information when something failed.
18 19 20 |
# File 'lib/mindee/v2/parsing/job_webhook.rb', line 18 def error @error end |
#id ⇒ String (readonly)
Returns Identifier of the webhook.
12 13 14 |
# File 'lib/mindee/v2/parsing/job_webhook.rb', line 12 def id @id end |
#status ⇒ String (readonly)
Returns Webhook status.
16 17 18 |
# File 'lib/mindee/v2/parsing/job_webhook.rb', line 16 def status @status end |
Instance Method Details
#to_s ⇒ String
RST display.
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/mindee/v2/parsing/job_webhook.rb', line 31 def to_s parts = [ 'JobResponseWebhook', '##################', ":ID: #{@id}", ":CreatedAt: #{@created_at}", ":Status: #{@status}", ] parts << @error.to_s if @error parts.join("\n") end |