Class: Telnyx::Resources::NotificationChannels

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/notification_channels.rb

Overview

Notification settings operations

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ NotificationChannels

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of NotificationChannels.

Parameters:



136
137
138
# File 'lib/telnyx/resources/notification_channels.rb', line 136

def initialize(client:)
  @client = client
end

Instance Method Details

#create(channel_destination: nil, channel_type_id: nil, notification_profile_id: nil, request_options: {}) ⇒ Telnyx::Models::NotificationChannelCreateResponse

Create a notification channel.

Parameters:

Returns:

See Also:



22
23
24
25
26
27
28
29
30
31
# File 'lib/telnyx/resources/notification_channels.rb', line 22

def create(params = {})
  parsed, options = Telnyx::NotificationChannelCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "notification_channels",
    body: parsed,
    model: Telnyx::Models::NotificationChannelCreateResponse,
    options: options
  )
end

#delete(id, request_options: {}) ⇒ Telnyx::Models::NotificationChannelDeleteResponse

Delete a notification channel.

Parameters:

Returns:

See Also:



124
125
126
127
128
129
130
131
# File 'lib/telnyx/resources/notification_channels.rb', line 124

def delete(id, params = {})
  @client.request(
    method: :delete,
    path: ["notification_channels/%1$s", id],
    model: Telnyx::Models::NotificationChannelDeleteResponse,
    options: params[:request_options]
  )
end

#list(filter: nil, page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::NotificationChannel>

Some parameter documentations has been truncated, see Models::NotificationChannelListParams for more details.

List notification channels.

filter[associated_

Parameters:

Returns:

See Also:



100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/telnyx/resources/notification_channels.rb', line 100

def list(params = {})
  parsed, options = Telnyx::NotificationChannelListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "notification_channels",
    query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"),
    page: Telnyx::Internal::DefaultFlatPagination,
    model: Telnyx::NotificationChannel,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ Telnyx::Models::NotificationChannelRetrieveResponse

Get a notification channel.

Parameters:

Returns:

See Also:



44
45
46
47
48
49
50
51
# File 'lib/telnyx/resources/notification_channels.rb', line 44

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["notification_channels/%1$s", id],
    model: Telnyx::Models::NotificationChannelRetrieveResponse,
    options: params[:request_options]
  )
end

#update(notification_channel_id, channel_destination: nil, channel_type_id: nil, notification_profile_id: nil, request_options: {}) ⇒ Telnyx::Models::NotificationChannelUpdateResponse

Update a notification channel.

Parameters:

  • notification_channel_id (String)

    The id of the resource.

  • channel_destination (String)

    The destination associated with the channel type.

  • channel_type_id (Symbol, Telnyx::Models::NotificationChannel::ChannelTypeID)

    A Channel Type ID

  • notification_profile_id (String)

    A UUID reference to the associated Notification Profile.

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



70
71
72
73
74
75
76
77
78
79
# File 'lib/telnyx/resources/notification_channels.rb', line 70

def update(notification_channel_id, params = {})
  parsed, options = Telnyx::NotificationChannelUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["notification_channels/%1$s", notification_channel_id],
    body: parsed,
    model: Telnyx::Models::NotificationChannelUpdateResponse,
    options: options
  )
end