Class: A2A::Types::TaskPushNotificationConfig

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/a2a/types/push_notification.rb

Overview

Represents a task-specific push notification configuration

Links a task to a push notification configuration for receiving updates about that specific task.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#==, #camelize, from_h, from_json, #hash, #to_h, #to_json, underscore, #valid?, #validate_array_type, #validate_inclusion, #validate_required, #validate_type

Constructor Details

#initialize(task_id:, push_notification_config:) ⇒ TaskPushNotificationConfig

Initialize a new task push notification config

Parameters:

  • task_id (String)

    The task identifier

  • push_notification_config (PushNotificationConfig, Hash)

    The notification config



95
96
97
98
99
100
101
102
103
104
# File 'lib/a2a/types/push_notification.rb', line 95

def initialize(task_id:, push_notification_config:)
  @task_id = task_id
  @push_notification_config = if push_notification_config.is_a?(PushNotificationConfig)
                                push_notification_config
                              else
                                PushNotificationConfig.from_h(push_notification_config)
                              end

  validate!
end

Instance Attribute Details

#push_notification_configObject (readonly)

Returns the value of attribute push_notification_config.



88
89
90
# File 'lib/a2a/types/push_notification.rb', line 88

def push_notification_config
  @push_notification_config
end

#task_idObject (readonly)

Returns the value of attribute task_id.



88
89
90
# File 'lib/a2a/types/push_notification.rb', line 88

def task_id
  @task_id
end

Instance Method Details

#auth_headersHash

Get authentication headers

Returns:

  • (Hash)

    Authentication headers



118
119
120
# File 'lib/a2a/types/push_notification.rb', line 118

def auth_headers
  @push_notification_config.auth_headers
end

#authenticated?Boolean

Check if authentication is configured

Returns:

  • (Boolean)

    True if authentication is present



126
127
128
# File 'lib/a2a/types/push_notification.rb', line 126

def authenticated?
  @push_notification_config.authenticated?
end

#validate!Object (private)



132
133
134
135
136
# File 'lib/a2a/types/push_notification.rb', line 132

def validate!
  validate_required(:task_id, :push_notification_config)
  validate_type(:task_id, String)
  validate_type(:push_notification_config, PushNotificationConfig)
end

#webhook_urlString

Get the webhook URL

Returns:

  • (String)

    The webhook URL



110
111
112
# File 'lib/a2a/types/push_notification.rb', line 110

def webhook_url
  @push_notification_config.url
end