Class: Telnyx::Resources::Comments

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/comments.rb,
sig/telnyx/resources/comments.rbs

Overview

Number orders

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Comments

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 Comments.

Parameters:



103
104
105
# File 'lib/telnyx/resources/comments.rb', line 103

def initialize(client:)
  @client = client
end

Instance Method Details

#create(body: nil, comment_record_id: nil, comment_record_type: nil, request_options: {}) ⇒ Telnyx::Models::CommentCreateResponse

Creates a comment associated with a supported number-order record. The response contains the created comment.

Parameters:

Returns:

See Also:



20
21
22
23
24
25
26
27
28
29
# File 'lib/telnyx/resources/comments.rb', line 20

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

#list(filter: nil, request_options: {}) ⇒ Telnyx::Models::CommentListResponse

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

Returns comments associated with number-order records. Results can be filtered by record type and record ID and include pagination metadata.

Parameters:

Returns:

See Also:



67
68
69
70
71
72
73
74
75
76
77
# File 'lib/telnyx/resources/comments.rb', line 67

def list(params = {})
  parsed, options = Telnyx::CommentListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "comments",
    query: query,
    model: Telnyx::Models::CommentListResponse,
    options: options
  )
end

#mark_as_read(id, request_options: {}) ⇒ Telnyx::Models::CommentMarkAsReadResponse

Marks the specified comment as read. The response contains the updated read state for the comment.

Parameters:

Returns:

See Also:



91
92
93
94
95
96
97
98
# File 'lib/telnyx/resources/comments.rb', line 91

def mark_as_read(id, params = {})
  @client.request(
    method: :patch,
    path: ["comments/%1$s/read", id],
    model: Telnyx::Models::CommentMarkAsReadResponse,
    options: params[:request_options]
  )
end

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

Returns the comment identified by id, including its associated record and comment metadata.

Parameters:

Returns:

See Also:



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

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