Class: Plivo::Resources::RecordingInterface
Constant Summary
Constants included
from Utils
Utils::TYPE_WHITELIST
Instance Method Summary
collapse
Methods included from Utils
GetSortedQueryParamString?, compute_signatureV3?, expected_type?, expected_value?, generate_url?, getMapFromQueryString?, is_one_among_string_url?, multi_valid_param?, raise_invalid_request, valid_account?, valid_date_format?, valid_mainaccount?, valid_multiple_destination_integers?, valid_multiple_destination_nos?, valid_param?, valid_range?, valid_signature?, valid_signatureV3?, valid_subaccount?, valid_url?
Constructor Details
#initialize(client, resource_list_json = nil) ⇒ RecordingInterface
Returns a new instance of RecordingInterface.
40
41
42
43
44
45
46
|
# File 'lib/plivo/resources/recordings.rb', line 40
def initialize(client, resource_list_json = nil)
@_name = 'Recording'
@_resource_type = Recording
@_identifier_string = 'recording_id'
super
@_is_voice_request = true
end
|
Instance Method Details
#delete(recording_id) ⇒ Object
122
123
124
125
126
|
# File 'lib/plivo/resources/recordings.rb', line 122
def delete(recording_id)
valid_param?(:recording_id, recording_id, [String, Symbol], true)
raise_invalid_request('Invalid recording_id passed') if recording_id.empty?
Recording.new(@_client, resource_id: recording_id).delete
end
|
#each ⇒ Object
111
112
113
114
115
116
117
118
119
|
# File 'lib/plivo/resources/recordings.rb', line 111
def each
offset = 0
loop do
recording_list = list(offset: offset)
recording_list[:objects].each { |recording| yield recording }
offset += 20
return unless recording_list.length == 20
end
end
|
#get(recording_id) ⇒ Object
105
106
107
108
109
|
# File 'lib/plivo/resources/recordings.rb', line 105
def get(recording_id)
valid_param?(:recording_id, recording_id, [String, Symbol], true)
raise_invalid_request('Invalid recording_id passed') if recording_id.empty?
perform_get(recording_id)
end
|
#list(options = nil) ⇒ Object
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
# File 'lib/plivo/resources/recordings.rb', line 65
def list(options = nil)
return perform_list if options.nil?
valid_param?(:options, options, Hash, true)
params = {}
params_expected = %i[
call_uuid add_time__gt add_time__gte
add_time__lt add_time__lte
from_number to_number conference_uuid
conference_name mpc_name mpc_uuid
]
params_expected.each do |param|
if options.key?(param) && valid_param?(param, options[param], [String, Symbol], true)
params[param] = options[param]
end
end
if options.key?(:subaccount) &&
valid_subaccount?(options[:subaccount], true)
params[:subaccount] = options[:subaccount]
end
%i[offset limit].each do |param|
if options.key?(param) && valid_param?(param, options[param], [Integer, Integer], true)
params[param] = options[param]
end
end
if options.key?(:limit) && (options[:limit] > 20 || options[:limit] <= 0)
raise_invalid_request('The maximum number of results that can be fetched'\
" is 20. limit can't be more than 20 or less than 1")
end
raise_invalid_request("Offset can't be negative") if options.key?(:offset) && options[:offset] < 0
perform_list(params)
end
|