Class: SurgeAPI::Resources::Recordings

Inherits:
Object
  • Object
show all
Defined in:
lib/surge_api/resources/recordings.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Recordings

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

Parameters:



102
103
104
# File 'lib/surge_api/resources/recordings.rb', line 102

def initialize(client:)
  @client = client
end

Instance Method Details

#delete(id, request_options: {}) ⇒ SurgeAPI::Models::RecordingDeleteResponse

Deletes a recording. The recording file will be removed from storage asynchronously.

Parameters:

Returns:

See Also:



69
70
71
72
73
74
75
76
# File 'lib/surge_api/resources/recordings.rb', line 69

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

#get_file(recording_id, request_options: {}) ⇒ SurgeAPI::Models::RecordingGetFileResponse

Redirects to a signed URL where the recording audio file can be downloaded. URL is short-lived, so redirect should be followed immediately.

Parameters:

  • recording_id (String)

    The ID of the recording.

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

Returns:

See Also:



90
91
92
93
94
95
96
97
# File 'lib/surge_api/resources/recordings.rb', line 90

def get_file(recording_id, params = {})
  @client.request(
    method: :get,
    path: ["recordings/%1$s/file", recording_id],
    model: SurgeAPI::Models::RecordingGetFileResponse,
    options: params[:request_options]
  )
end

#list(account_id, after: nil, before: nil, request_options: {}) ⇒ SurgeAPI::Internal::Cursor<SurgeAPI::Models::RecordingListResponse>

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

List all recordings for an account with cursor-based pagination.

Parameters:

  • account_id (String)

    The account ID to list recordings for.

  • after (String)

    Cursor for forward pagination. Use the next_cursor from a previous response.

  • before (String)

    Cursor for backward pagination. Use the previous_cursor from a previous response

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

Returns:

See Also:



44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/surge_api/resources/recordings.rb', line 44

def list(, params = {})
  parsed, options = SurgeAPI::RecordingListParams.dump_request(params)
  query = SurgeAPI::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["accounts/%1$s/recordings", ],
    query: query,
    page: SurgeAPI::Internal::Cursor,
    model: SurgeAPI::Models::RecordingListResponse,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ SurgeAPI::Models::RecordingRetrieveResponse

Retrieves a Recording object.

Parameters:

  • id (String)

    The ID of the recording to retrieve.

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

Returns:

See Also:



17
18
19
20
21
22
23
24
# File 'lib/surge_api/resources/recordings.rb', line 17

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