Class: Plivo::RestAPI
- Inherits:
-
Object
- Object
- Plivo::RestAPI
- Defined in:
- lib/plivo.rb
Instance Attribute Summary collapse
-
#api ⇒ Object
Returns the value of attribute api.
-
#auth_id ⇒ Object
Returns the value of attribute auth_id.
-
#auth_token ⇒ Object
Returns the value of attribute auth_token.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#rest ⇒ Object
Returns the value of attribute rest.
-
#url ⇒ Object
Returns the value of attribute url.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #create_application(params = {}) ⇒ Object
- #create_endpoint(params = {}) ⇒ Object
- #create_incoming_carrier(params = {}) ⇒ Object
- #create_outgoing_carrier(params = {}) ⇒ Object
- #create_outgoing_carrier_routing(params = {}) ⇒ Object
- #create_subaccount(params = {}) ⇒ Object
- #deaf_member(params = {}) ⇒ Object
- #delete_application(params = {}) ⇒ Object
- #delete_endpoint(params = {}) ⇒ Object
- #delete_incoming_carrier(params = {}) ⇒ Object
- #delete_outgoing_carrier(params = {}) ⇒ Object
- #delete_outgoing_carrier_routing(params = {}) ⇒ Object
- #delete_recording(params = {}) ⇒ Object
- #delete_subaccount(params = {}) ⇒ Object
-
#get_account(params = {}) ⇒ Object
Accounts ##.
- #get_application(params = {}) ⇒ Object
-
#get_applications(params = {}) ⇒ Object
Applications ##.
- #get_cdr(params = {}) ⇒ Object
-
#get_cdrs(params = {}) ⇒ Object
Calls ##.
- #get_endpoint(params = {}) ⇒ Object
-
#get_endpoints(params = {}) ⇒ Object
Endpoints ##.
- #get_incoming_carrier(params = {}) ⇒ Object
-
#get_incoming_carriers(params = {}) ⇒ Object
Incoming Carriers ##.
- #get_live_call(params = {}) ⇒ Object
- #get_live_calls(params = {}) ⇒ Object
- #get_live_conference(params = {}) ⇒ Object
-
#get_live_conferences(params = {}) ⇒ Object
Conferences ##.
- #get_message(params = {}) ⇒ Object
- #get_messages(params = {}) ⇒ Object
- #get_number(params = {}) ⇒ Object
- #get_number_group(params = {}) ⇒ Object
- #get_number_group_details(params = {}) ⇒ Object
-
#get_numbers(params = {}) ⇒ Object
Numbers ##.
- #get_outgoing_carrier(params = {}) ⇒ Object
- #get_outgoing_carrier_routing(params = {}) ⇒ Object
-
#get_outgoing_carrier_routings(params = {}) ⇒ Object
Outgoing Carrier Routings ##.
-
#get_outgoing_carriers(params = {}) ⇒ Object
Outgoing Carriers ##.
- #get_recording(params = {}) ⇒ Object
-
#get_recordings(params = {}) ⇒ Object
Recordings ##.
- #get_subaccount(params = {}) ⇒ Object
- #get_subaccounts(params = {}) ⇒ Object
- #hangup_all_calls(params = {}) ⇒ Object
- #hangup_all_conferences(params = {}) ⇒ Object
- #hangup_call(params = {}) ⇒ Object
- #hangup_conference(params = {}) ⇒ Object
- #hangup_member(params = {}) ⇒ Object
-
#hangup_request(params = {}) ⇒ Object
Calls requests ##.
- #hash_to_params(myhash) ⇒ Object
-
#initialize(auth_id, auth_token, url = "https://api.plivo.com", version = "v1") ⇒ RestAPI
constructor
A new instance of RestAPI.
- #kick_member(params = {}) ⇒ Object
- #link_application_number(params = {}) ⇒ Object
- #make_call(params = {}) ⇒ Object
- #modify_account(params = {}) ⇒ Object
- #modify_application(params = {}) ⇒ Object
- #modify_endpoint(params = {}) ⇒ Object
- #modify_incoming_carrier(params = {}) ⇒ Object
- #modify_outgoing_carrier(params = {}) ⇒ Object
- #modify_outgoing_carrier_routing(params = {}) ⇒ Object
- #modify_subaccount(params = {}) ⇒ Object
- #mute_member(params = {}) ⇒ Object
- #play(params = {}) ⇒ Object
- #play_member(params = {}) ⇒ Object
-
#pricing(params = {}) ⇒ Object
Pricing ##.
- #record(params = {}) ⇒ Object
- #record_conference(params = {}) ⇒ Object
- #rent_from_number_group(params = {}) ⇒ Object
- #rent_number(params = {}) ⇒ Object
- #request(method, path, params = nil) ⇒ Object
- #search_numbers(params = {}) ⇒ Object
- #send_digits(params = {}) ⇒ Object
-
#send_message(params = {}) ⇒ Object
Message ##.
- #speak(params = {}) ⇒ Object
- #speak_member(params = {}) ⇒ Object
- #stop_play(params = {}) ⇒ Object
- #stop_play_member(params = {}) ⇒ Object
- #stop_record(params = {}) ⇒ Object
- #stop_record_conference(params = {}) ⇒ Object
- #stop_speak(params = {}) ⇒ Object
- #transfer_call(params = {}) ⇒ Object
- #undeaf_member(params = {}) ⇒ Object
- #unlink_application_number(params = {}) ⇒ Object
- #unmute_member(params = {}) ⇒ Object
- #unrent_number(params = {}) ⇒ Object
Constructor Details
#initialize(auth_id, auth_token, url = "https://api.plivo.com", version = "v1") ⇒ RestAPI
Returns a new instance of RestAPI.
33 34 35 36 37 38 39 40 41 |
# File 'lib/plivo.rb', line 33 def initialize(auth_id, auth_token, url="https://api.plivo.com", version="v1") @auth_id = auth_id @auth_token = auth_token @url = url.chomp('/') @version = version @api = @url + '/' + @version + '/Account/' + @auth_id @headers = {"User-Agent" => "RubyPlivo"} @rest = RestClient::Resource.new(@api, @auth_id, @auth_token) end |
Instance Attribute Details
#api ⇒ Object
Returns the value of attribute api.
31 32 33 |
# File 'lib/plivo.rb', line 31 def api @api end |
#auth_id ⇒ Object
Returns the value of attribute auth_id.
31 32 33 |
# File 'lib/plivo.rb', line 31 def auth_id @auth_id end |
#auth_token ⇒ Object
Returns the value of attribute auth_token.
31 32 33 |
# File 'lib/plivo.rb', line 31 def auth_token @auth_token end |
#headers ⇒ Object
Returns the value of attribute headers.
31 32 33 |
# File 'lib/plivo.rb', line 31 def headers @headers end |
#rest ⇒ Object
Returns the value of attribute rest.
31 32 33 |
# File 'lib/plivo.rb', line 31 def rest @rest end |
#url ⇒ Object
Returns the value of attribute url.
31 32 33 |
# File 'lib/plivo.rb', line 31 def url @url end |
#version ⇒ Object
Returns the value of attribute version.
31 32 33 |
# File 'lib/plivo.rb', line 31 def version @version end |
Instance Method Details
#create_application(params = {}) ⇒ Object
133 134 135 |
# File 'lib/plivo.rb', line 133 def create_application(params={}) return request('POST', "/Application/", params) end |
#create_endpoint(params = {}) ⇒ Object
386 387 388 |
# File 'lib/plivo.rb', line 386 def create_endpoint(params={}) return request('POST', "/Endpoint/", params) end |
#create_incoming_carrier(params = {}) ⇒ Object
410 411 412 |
# File 'lib/plivo.rb', line 410 def create_incoming_carrier(params={}) return request('POST', "/IncomingCarrier/", params) end |
#create_outgoing_carrier(params = {}) ⇒ Object
434 435 436 |
# File 'lib/plivo.rb', line 434 def create_outgoing_carrier(params={}) return request('POST', "/OutgoingCarrier/", params) end |
#create_outgoing_carrier_routing(params = {}) ⇒ Object
458 459 460 |
# File 'lib/plivo.rb', line 458 def create_outgoing_carrier_routing(params={}) return request('POST', "/OutgoingCarrierRouting/", params) end |
#create_subaccount(params = {}) ⇒ Object
109 110 111 |
# File 'lib/plivo.rb', line 109 def create_subaccount(params={}) return request('POST', "/Subaccount/", params) end |
#deaf_member(params = {}) ⇒ Object
326 327 328 329 330 |
# File 'lib/plivo.rb', line 326 def deaf_member(params={}) conference_name = params.delete('conference_name') member_id = params.delete('member_id') return request('POST', "/Conference/#{conference_name}/Member/#{member_id}/Deaf/", params) end |
#delete_application(params = {}) ⇒ Object
147 148 149 150 |
# File 'lib/plivo.rb', line 147 def delete_application(params={}) app_id = params.delete("app_id") return request('DELETE', "/Application/#{app_id}/", params) end |
#delete_endpoint(params = {}) ⇒ Object
400 401 402 403 |
# File 'lib/plivo.rb', line 400 def delete_endpoint(params={}) endpoint_id = params.delete('endpoint_id') return request('DELETE', "/Endpoint/#{endpoint_id}/", params) end |
#delete_incoming_carrier(params = {}) ⇒ Object
424 425 426 427 |
# File 'lib/plivo.rb', line 424 def delete_incoming_carrier(params={}) carrier_id = params.delete('carrier_id') return request('DELETE', "/IncomingCarrier/#{carrier_id}/", params) end |
#delete_outgoing_carrier(params = {}) ⇒ Object
448 449 450 451 |
# File 'lib/plivo.rb', line 448 def delete_outgoing_carrier(params={}) carrier_id = params.delete('carrier_id') return request('DELETE', "/OutgoingCarrier/#{carrier_id}/", params) end |
#delete_outgoing_carrier_routing(params = {}) ⇒ Object
472 473 474 475 |
# File 'lib/plivo.rb', line 472 def delete_outgoing_carrier_routing(params={}) routing_id = params.delete('routing_id') return request('DELETE', "/OutgoingCarrierRouting/#{routing_id}/", params) end |
#delete_recording(params = {}) ⇒ Object
376 377 378 379 |
# File 'lib/plivo.rb', line 376 def delete_recording(params={}) recording_id = params.delete('recording_id') return request('DELETE', "/Recording/#{recording_id}/", params) end |
#delete_subaccount(params = {}) ⇒ Object
123 124 125 126 |
# File 'lib/plivo.rb', line 123 def delete_subaccount(params={}) subauth_id = params.delete("subauth_id") || params.delete(:subauth_id) return request('DELETE', "/Subaccount/#{subauth_id}/", params) end |
#get_account(params = {}) ⇒ Object
Accounts ##
97 98 99 |
# File 'lib/plivo.rb', line 97 def get_account(params={}) return request('GET', "/", params) end |
#get_application(params = {}) ⇒ Object
137 138 139 140 |
# File 'lib/plivo.rb', line 137 def get_application(params={}) app_id = params.delete("app_id") return request('GET', "/Application/#{app_id}/", params) end |
#get_applications(params = {}) ⇒ Object
Applications ##
129 130 131 |
# File 'lib/plivo.rb', line 129 def get_applications(params={}) return request('GET', "/Application/", params) end |
#get_cdr(params = {}) ⇒ Object
206 207 208 209 |
# File 'lib/plivo.rb', line 206 def get_cdr(params={}) record_id = params.delete('record_id') return request('GET', "/Call/#{record_id}/", params) end |
#get_cdrs(params = {}) ⇒ Object
Calls ##
202 203 204 |
# File 'lib/plivo.rb', line 202 def get_cdrs(params={}) return request('GET', "/Call/", params) end |
#get_endpoint(params = {}) ⇒ Object
390 391 392 393 |
# File 'lib/plivo.rb', line 390 def get_endpoint(params={}) endpoint_id = params.delete('endpoint_id') return request('GET', "/Endpoint/#{endpoint_id}/", params) end |
#get_endpoints(params = {}) ⇒ Object
Endpoints ##
382 383 384 |
# File 'lib/plivo.rb', line 382 def get_endpoints(params={}) return request('GET', "/Endpoint/", params) end |
#get_incoming_carrier(params = {}) ⇒ Object
414 415 416 417 |
# File 'lib/plivo.rb', line 414 def get_incoming_carrier(params={}) carrier_id = params.delete('carrier_id') return request('GET', "/IncomingCarrier/#{carrier_id}/", params) end |
#get_incoming_carriers(params = {}) ⇒ Object
Incoming Carriers ##
406 407 408 |
# File 'lib/plivo.rb', line 406 def get_incoming_carriers(params={}) return request('GET', "/IncomingCarrier/", params) end |
#get_live_call(params = {}) ⇒ Object
216 217 218 219 220 |
# File 'lib/plivo.rb', line 216 def get_live_call(params={}) call_uuid = params.delete('call_uuid') params["status"] = "live" return request('GET', "/Call/#{call_uuid}/", params) end |
#get_live_calls(params = {}) ⇒ Object
211 212 213 214 |
# File 'lib/plivo.rb', line 211 def get_live_calls(params={}) params["status"] = "live" return request('GET', "/Call/", params) end |
#get_live_conference(params = {}) ⇒ Object
291 292 293 294 |
# File 'lib/plivo.rb', line 291 def get_live_conference(params={}) conference_name = params.delete('conference_name') return request('GET', "/Conference/#{conference_name}/", params) end |
#get_live_conferences(params = {}) ⇒ Object
Conferences ##
283 284 285 |
# File 'lib/plivo.rb', line 283 def get_live_conferences(params={}) return request('GET', "/Conference/", params) end |
#get_message(params = {}) ⇒ Object
495 496 497 498 |
# File 'lib/plivo.rb', line 495 def (params={}) record_id = params.delete('record_id') return request('GET', "/Message/#{record_id}/", params) end |
#get_messages(params = {}) ⇒ Object
491 492 493 |
# File 'lib/plivo.rb', line 491 def (params={}) return request('GET', "/Message/", params) end |
#get_number(params = {}) ⇒ Object
161 162 163 164 |
# File 'lib/plivo.rb', line 161 def get_number(params={}) number = params.delete("number") return request('GET', "/Number/#{number}/", params) end |
#get_number_group(params = {}) ⇒ Object
187 188 189 |
# File 'lib/plivo.rb', line 187 def get_number_group(params={}) return request('GET', "/AvailableNumberGroup/", params) end |
#get_number_group_details(params = {}) ⇒ Object
191 192 193 194 |
# File 'lib/plivo.rb', line 191 def get_number_group_details(params={}) group_id = params.delete('group_id') return request('GET', "/AvailableNumberGroup/#{group_id}/", params) end |
#get_numbers(params = {}) ⇒ Object
Numbers ##
153 154 155 |
# File 'lib/plivo.rb', line 153 def get_numbers(params={}) return request('GET', "/Number/", params) end |
#get_outgoing_carrier(params = {}) ⇒ Object
438 439 440 441 |
# File 'lib/plivo.rb', line 438 def get_outgoing_carrier(params={}) carrier_id = params.delete('carrier_id') return request('GET', "/OutgoingCarrier/#{carrier_id}/", params) end |
#get_outgoing_carrier_routing(params = {}) ⇒ Object
462 463 464 465 |
# File 'lib/plivo.rb', line 462 def get_outgoing_carrier_routing(params={}) routing_id = params.delete('routing_id') return request('GET', "/OutgoingCarrierRouting/#{routing_id}/", params) end |
#get_outgoing_carrier_routings(params = {}) ⇒ Object
Outgoing Carrier Routings ##
454 455 456 |
# File 'lib/plivo.rb', line 454 def get_outgoing_carrier_routings(params={}) return request('GET', "/OutgoingCarrierRouting/", params) end |
#get_outgoing_carriers(params = {}) ⇒ Object
Outgoing Carriers ##
430 431 432 |
# File 'lib/plivo.rb', line 430 def get_outgoing_carriers(params={}) return request('GET', "/OutgoingCarrier/", params) end |
#get_recording(params = {}) ⇒ Object
371 372 373 374 |
# File 'lib/plivo.rb', line 371 def get_recording(params={}) recording_id = params.delete('recording_id') return request('GET', "/Recording/#{recording_id}/", params) end |
#get_recordings(params = {}) ⇒ Object
Recordings ##
367 368 369 |
# File 'lib/plivo.rb', line 367 def get_recordings(params={}) return request('GET', "/Recording/", params) end |
#get_subaccount(params = {}) ⇒ Object
113 114 115 116 |
# File 'lib/plivo.rb', line 113 def get_subaccount(params={}) subauth_id = params.delete("subauth_id") || params.delete(:subauth_id) return request('GET', "/Subaccount/#{subauth_id}/", params) end |
#get_subaccounts(params = {}) ⇒ Object
105 106 107 |
# File 'lib/plivo.rb', line 105 def get_subaccounts(params={}) return request('GET', "/Subaccount/", params) end |
#hangup_all_calls(params = {}) ⇒ Object
226 227 228 |
# File 'lib/plivo.rb', line 226 def hangup_all_calls(params={}) return request('DELETE', "/Call/", params) end |
#hangup_all_conferences(params = {}) ⇒ Object
287 288 289 |
# File 'lib/plivo.rb', line 287 def hangup_all_conferences(params={}) return request('DELETE', "/Conference/", params) end |
#hangup_call(params = {}) ⇒ Object
235 236 237 238 |
# File 'lib/plivo.rb', line 235 def hangup_call(params={}) call_uuid = params.delete('call_uuid') return request('DELETE', "/Call/#{call_uuid}/", params) end |
#hangup_conference(params = {}) ⇒ Object
296 297 298 299 |
# File 'lib/plivo.rb', line 296 def hangup_conference(params={}) conference_name = params.delete('conference_name') return request('DELETE', "/Conference/#{conference_name}/", params) end |
#hangup_member(params = {}) ⇒ Object
301 302 303 304 305 |
# File 'lib/plivo.rb', line 301 def hangup_member(params={}) conference_name = params.delete('conference_name') member_id = params.delete('member_id') return request('DELETE', "/Conference/#{conference_name}/Member/#{member_id}/", params) end |
#hangup_request(params = {}) ⇒ Object
Calls requests ##
277 278 279 280 |
# File 'lib/plivo.rb', line 277 def hangup_request(params={}) request_uuid = params.delete('request_uuid') return request('DELETE', "/Request/#{request_uuid}/", params) end |
#hash_to_params(myhash) ⇒ Object
43 44 45 |
# File 'lib/plivo.rb', line 43 def hash_to_params(myhash) return myhash.map { |k, v| "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}" }.join("&") end |
#kick_member(params = {}) ⇒ Object
350 351 352 353 354 |
# File 'lib/plivo.rb', line 350 def kick_member(params={}) conference_name = params.delete('conference_name') member_id = params.delete('member_id') return request('POST', "/Conference/#{conference_name}/Member/#{member_id}/Kick/", params) end |
#link_application_number(params = {}) ⇒ Object
176 177 178 179 |
# File 'lib/plivo.rb', line 176 def link_application_number(params={}) number = params.delete("number") return request('POST', "/Number/#{number}/", params) end |
#make_call(params = {}) ⇒ Object
222 223 224 |
# File 'lib/plivo.rb', line 222 def make_call(params={}) return request('POST', "/Call/", params) end |
#modify_account(params = {}) ⇒ Object
101 102 103 |
# File 'lib/plivo.rb', line 101 def modify_account(params={}) return request('POST', "/", params) end |
#modify_application(params = {}) ⇒ Object
142 143 144 145 |
# File 'lib/plivo.rb', line 142 def modify_application(params={}) app_id = params.delete("app_id") return request('POST', "/Application/#{app_id}/", params) end |
#modify_endpoint(params = {}) ⇒ Object
395 396 397 398 |
# File 'lib/plivo.rb', line 395 def modify_endpoint(params={}) endpoint_id = params.delete('endpoint_id') return request('POST', "/Endpoint/#{endpoint_id}/", params) end |
#modify_incoming_carrier(params = {}) ⇒ Object
419 420 421 422 |
# File 'lib/plivo.rb', line 419 def modify_incoming_carrier(params={}) carrier_id = params.delete('carrier_id') return request('POST', "/IncomingCarrier/#{carrier_id}/", params) end |
#modify_outgoing_carrier(params = {}) ⇒ Object
443 444 445 446 |
# File 'lib/plivo.rb', line 443 def modify_outgoing_carrier(params={}) carrier_id = params.delete('carrier_id') return request('POST', "/OutgoingCarrier/#{carrier_id}/", params) end |
#modify_outgoing_carrier_routing(params = {}) ⇒ Object
467 468 469 470 |
# File 'lib/plivo.rb', line 467 def modify_outgoing_carrier_routing(params={}) routing_id = params.delete('routing_id') return request('POST', "/OutgoingCarrierRouting/#{routing_id}/", params) end |
#modify_subaccount(params = {}) ⇒ Object
118 119 120 121 |
# File 'lib/plivo.rb', line 118 def modify_subaccount(params={}) subauth_id = params.delete("subauth_id") || params.delete(:subauth_id) return request('POST', "/Subaccount/#{subauth_id}/", params) end |
#mute_member(params = {}) ⇒ Object
338 339 340 341 342 |
# File 'lib/plivo.rb', line 338 def mute_member(params={}) conference_name = params.delete('conference_name') member_id = params.delete('member_id') return request('POST', "/Conference/#{conference_name}/Member/#{member_id}/Mute/", params) end |
#play(params = {}) ⇒ Object
250 251 252 253 |
# File 'lib/plivo.rb', line 250 def play(params={}) call_uuid = params.delete('call_uuid') return request('POST', "/Call/#{call_uuid}/Play/", params) end |
#play_member(params = {}) ⇒ Object
307 308 309 310 311 |
# File 'lib/plivo.rb', line 307 def play_member(params={}) conference_name = params.delete('conference_name') member_id = params.delete('member_id') return request('POST', "/Conference/#{conference_name}/Member/#{member_id}/Play/", params) end |
#pricing(params = {}) ⇒ Object
Pricing ##
478 479 480 |
# File 'lib/plivo.rb', line 478 def pricing(params={}) return request('GET', "/Pricing/", params) end |
#record(params = {}) ⇒ Object
240 241 242 243 |
# File 'lib/plivo.rb', line 240 def record(params={}) call_uuid = params.delete('call_uuid') return request('POST', "/Call/#{call_uuid}/Record/", params) end |
#record_conference(params = {}) ⇒ Object
356 357 358 359 |
# File 'lib/plivo.rb', line 356 def record_conference(params={}) conference_name = params.delete('conference_name') return request('POST', "/Conference/#{conference_name}/Record/", params) end |
#rent_from_number_group(params = {}) ⇒ Object
196 197 198 199 |
# File 'lib/plivo.rb', line 196 def rent_from_number_group(params={}) group_id = params.delete('group_id') return request('POST', "/AvailableNumberGroup/#{group_id}/", params) end |
#rent_number(params = {}) ⇒ Object
166 167 168 169 |
# File 'lib/plivo.rb', line 166 def rent_number(params={}) number = params.delete("number") return request('POST', "/AvailableNumber/#{number}/", params) end |
#request(method, path, params = nil) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 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 |
# File 'lib/plivo.rb', line 47 def request(method, path, params=nil) if method == "POST" if not params params = {} end begin r = @rest[path].post params.to_json, :content_type => 'application/json' rescue => e response = e end if not response code = r.code raw = r.to_str response = JSON.parse(raw) end return [code, response] elsif method == "GET" if params path = path + '?' + hash_to_params(params) end begin r = @rest[path].get rescue => e response = e end if not response code = r.code raw = r.to_str response = JSON.parse(raw) end return [code, response] elsif method == "DELETE" if params path = path + '?' + hash_to_params(params) end begin r = @rest[path].delete rescue => e response = e end if not response code = r.code end return [code, ""] end return [405, 'Method Not Supported'] end |
#search_numbers(params = {}) ⇒ Object
157 158 159 |
# File 'lib/plivo.rb', line 157 def search_numbers(params={}) return request('GET', "/AvailableNumber/", params) end |
#send_digits(params = {}) ⇒ Object
271 272 273 274 |
# File 'lib/plivo.rb', line 271 def send_digits(params={}) call_uuid = params.delete('call_uuid') return request('POST', "/Call/#{call_uuid}/DTMF/", params) end |
#send_message(params = {}) ⇒ Object
Message ##
487 488 489 |
# File 'lib/plivo.rb', line 487 def (params={}) return request('POST', "/Message/", params) end |
#speak(params = {}) ⇒ Object
260 261 262 263 264 |
# File 'lib/plivo.rb', line 260 def speak(params={}) call_uuid = params.delete('call_uuid') params.update({"text" => HTMLEntities.new(:html4).encode(params['text'], :decimal)}) return request('POST', "/Call/#{call_uuid}/Speak/", params) end |
#speak_member(params = {}) ⇒ Object
319 320 321 322 323 324 |
# File 'lib/plivo.rb', line 319 def speak_member(params={}) conference_name = params.delete('conference_name') member_id = params.delete('member_id') params.update({"text" => HTMLEntities.new(:html4).encode(params['text'], :decimal)}) return request('POST', "/Conference/#{conference_name}/Member/#{member_id}/Speak/", params) end |
#stop_play(params = {}) ⇒ Object
255 256 257 258 |
# File 'lib/plivo.rb', line 255 def stop_play(params={}) call_uuid = params.delete('call_uuid') return request('DELETE', "/Call/#{call_uuid}/Play/", params) end |
#stop_play_member(params = {}) ⇒ Object
313 314 315 316 317 |
# File 'lib/plivo.rb', line 313 def stop_play_member(params={}) conference_name = params.delete('conference_name') member_id = params.delete('member_id') return request('DELETE', "/Conference/#{conference_name}/Member/#{member_id}/Play/", params) end |
#stop_record(params = {}) ⇒ Object
245 246 247 248 |
# File 'lib/plivo.rb', line 245 def stop_record(params={}) call_uuid = params.delete('call_uuid') return request('DELETE', "/Call/#{call_uuid}/Record/", params) end |
#stop_record_conference(params = {}) ⇒ Object
361 362 363 364 |
# File 'lib/plivo.rb', line 361 def stop_record_conference(params={}) conference_name = params.delete('conference_name') return request('DELETE', "/Conference/#{conference_name}/Record/", params) end |
#stop_speak(params = {}) ⇒ Object
266 267 268 269 |
# File 'lib/plivo.rb', line 266 def stop_speak(params={}) call_uuid = params.delete('call_uuid') return request('DELETE', "/Call/#{call_uuid}/Speak/", params) end |
#transfer_call(params = {}) ⇒ Object
230 231 232 233 |
# File 'lib/plivo.rb', line 230 def transfer_call(params={}) call_uuid = params.delete('call_uuid') return request('POST', "/Call/#{call_uuid}/", params) end |
#undeaf_member(params = {}) ⇒ Object
332 333 334 335 336 |
# File 'lib/plivo.rb', line 332 def undeaf_member(params={}) conference_name = params.delete('conference_name') member_id = params.delete('member_id') return request('DELETE', "/Conference/#{conference_name}/Member/#{member_id}/Deaf/", params) end |
#unlink_application_number(params = {}) ⇒ Object
181 182 183 184 185 |
# File 'lib/plivo.rb', line 181 def unlink_application_number(params={}) number = params.delete("number") params = {"app_id" => ""} return request('POST', "/Number/#{number}/", params) end |
#unmute_member(params = {}) ⇒ Object
344 345 346 347 348 |
# File 'lib/plivo.rb', line 344 def unmute_member(params={}) conference_name = params.delete('conference_name') member_id = params.delete('member_id') return request('DELETE', "/Conference/#{conference_name}/Member/#{member_id}/Mute/", params) end |
#unrent_number(params = {}) ⇒ Object
171 172 173 174 |
# File 'lib/plivo.rb', line 171 def unrent_number(params={}) number = params.delete("number") return request('DELETE', "/Number/#{number}/", params) end |