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
- #buy_phone_number(params = {}) ⇒ Object
- #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
- #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
-
#search_phone_number(params = {}) ⇒ Object
Numbers ##.
- #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
#buy_phone_number(params = {}) ⇒ Object
166 167 168 169 |
# File 'lib/plivo.rb', line 166 def buy_phone_number(params={}) number = params.delete("number") return request('POST', "/PhoneNumber/#{number}/", params) end |
#create_application(params = {}) ⇒ Object
142 143 144 |
# File 'lib/plivo.rb', line 142 def create_application(params={}) return request('POST', "/Application/", params) end |
#create_endpoint(params = {}) ⇒ Object
404 405 406 |
# File 'lib/plivo.rb', line 404 def create_endpoint(params={}) return request('POST', "/Endpoint/", params) end |
#create_incoming_carrier(params = {}) ⇒ Object
428 429 430 |
# File 'lib/plivo.rb', line 428 def create_incoming_carrier(params={}) return request('POST', "/IncomingCarrier/", params) end |
#create_outgoing_carrier(params = {}) ⇒ Object
452 453 454 |
# File 'lib/plivo.rb', line 452 def create_outgoing_carrier(params={}) return request('POST', "/OutgoingCarrier/", params) end |
#create_outgoing_carrier_routing(params = {}) ⇒ Object
476 477 478 |
# File 'lib/plivo.rb', line 476 def create_outgoing_carrier_routing(params={}) return request('POST', "/OutgoingCarrierRouting/", params) end |
#create_subaccount(params = {}) ⇒ Object
118 119 120 |
# File 'lib/plivo.rb', line 118 def create_subaccount(params={}) return request('POST', "/Subaccount/", params) end |
#deaf_member(params = {}) ⇒ Object
344 345 346 347 348 |
# File 'lib/plivo.rb', line 344 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
156 157 158 159 |
# File 'lib/plivo.rb', line 156 def delete_application(params={}) app_id = params.delete("app_id") return request('DELETE', "/Application/#{app_id}/", params) end |
#delete_endpoint(params = {}) ⇒ Object
418 419 420 421 |
# File 'lib/plivo.rb', line 418 def delete_endpoint(params={}) endpoint_id = params.delete('endpoint_id') return request('DELETE', "/Endpoint/#{endpoint_id}/", params) end |
#delete_incoming_carrier(params = {}) ⇒ Object
442 443 444 445 |
# File 'lib/plivo.rb', line 442 def delete_incoming_carrier(params={}) carrier_id = params.delete('carrier_id') return request('DELETE', "/IncomingCarrier/#{carrier_id}/", params) end |
#delete_outgoing_carrier(params = {}) ⇒ Object
466 467 468 469 |
# File 'lib/plivo.rb', line 466 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
490 491 492 493 |
# File 'lib/plivo.rb', line 490 def delete_outgoing_carrier_routing(params={}) routing_id = params.delete('routing_id') return request('DELETE', "/OutgoingCarrierRouting/#{routing_id}/", params) end |
#delete_recording(params = {}) ⇒ Object
394 395 396 397 |
# File 'lib/plivo.rb', line 394 def delete_recording(params={}) recording_id = params.delete('recording_id') return request('DELETE', "/Recording/#{recording_id}/", params) end |
#delete_subaccount(params = {}) ⇒ Object
132 133 134 135 |
# File 'lib/plivo.rb', line 132 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 ##
106 107 108 |
# File 'lib/plivo.rb', line 106 def get_account(params={}) return request('GET', "/", params) end |
#get_application(params = {}) ⇒ Object
146 147 148 149 |
# File 'lib/plivo.rb', line 146 def get_application(params={}) app_id = params.delete("app_id") return request('GET', "/Application/#{app_id}/", params) end |
#get_applications(params = {}) ⇒ Object
Applications ##
138 139 140 |
# File 'lib/plivo.rb', line 138 def get_applications(params={}) return request('GET', "/Application/", params) end |
#get_cdr(params = {}) ⇒ Object
224 225 226 227 |
# File 'lib/plivo.rb', line 224 def get_cdr(params={}) record_id = params.delete('record_id') return request('GET', "/Call/#{record_id}/", params) end |
#get_cdrs(params = {}) ⇒ Object
Calls ##
220 221 222 |
# File 'lib/plivo.rb', line 220 def get_cdrs(params={}) return request('GET', "/Call/", params) end |
#get_endpoint(params = {}) ⇒ Object
408 409 410 411 |
# File 'lib/plivo.rb', line 408 def get_endpoint(params={}) endpoint_id = params.delete('endpoint_id') return request('GET', "/Endpoint/#{endpoint_id}/", params) end |
#get_endpoints(params = {}) ⇒ Object
Endpoints ##
400 401 402 |
# File 'lib/plivo.rb', line 400 def get_endpoints(params={}) return request('GET', "/Endpoint/", params) end |
#get_incoming_carrier(params = {}) ⇒ Object
432 433 434 435 |
# File 'lib/plivo.rb', line 432 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 ##
424 425 426 |
# File 'lib/plivo.rb', line 424 def get_incoming_carriers(params={}) return request('GET', "/IncomingCarrier/", params) end |
#get_live_call(params = {}) ⇒ Object
234 235 236 237 238 |
# File 'lib/plivo.rb', line 234 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
229 230 231 232 |
# File 'lib/plivo.rb', line 229 def get_live_calls(params={}) params["status"] = "live" return request('GET', "/Call/", params) end |
#get_live_conference(params = {}) ⇒ Object
309 310 311 312 |
# File 'lib/plivo.rb', line 309 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 ##
301 302 303 |
# File 'lib/plivo.rb', line 301 def get_live_conferences(params={}) return request('GET', "/Conference/", params) end |
#get_message(params = {}) ⇒ Object
513 514 515 516 |
# File 'lib/plivo.rb', line 513 def (params={}) record_id = params.delete('record_id') return request('GET', "/Message/#{record_id}/", params) end |
#get_messages(params = {}) ⇒ Object
509 510 511 |
# File 'lib/plivo.rb', line 509 def (params={}) return request('GET', "/Message/", params) end |
#get_number(params = {}) ⇒ Object
179 180 181 182 |
# File 'lib/plivo.rb', line 179 def get_number(params={}) number = params.delete("number") return request('GET', "/Number/#{number}/", params) end |
#get_number_group(params = {}) ⇒ Object
205 206 207 |
# File 'lib/plivo.rb', line 205 def get_number_group(params={}) return request('GET', "/AvailableNumberGroup/", params) end |
#get_number_group_details(params = {}) ⇒ Object
209 210 211 212 |
# File 'lib/plivo.rb', line 209 def get_number_group_details(params={}) group_id = params.delete('group_id') return request('GET', "/AvailableNumberGroup/#{group_id}/", params) end |
#get_numbers(params = {}) ⇒ Object
171 172 173 |
# File 'lib/plivo.rb', line 171 def get_numbers(params={}) return request('GET', "/Number/", params) end |
#get_outgoing_carrier(params = {}) ⇒ Object
456 457 458 459 |
# File 'lib/plivo.rb', line 456 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
480 481 482 483 |
# File 'lib/plivo.rb', line 480 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 ##
472 473 474 |
# File 'lib/plivo.rb', line 472 def get_outgoing_carrier_routings(params={}) return request('GET', "/OutgoingCarrierRouting/", params) end |
#get_outgoing_carriers(params = {}) ⇒ Object
Outgoing Carriers ##
448 449 450 |
# File 'lib/plivo.rb', line 448 def get_outgoing_carriers(params={}) return request('GET', "/OutgoingCarrier/", params) end |
#get_recording(params = {}) ⇒ Object
389 390 391 392 |
# File 'lib/plivo.rb', line 389 def get_recording(params={}) recording_id = params.delete('recording_id') return request('GET', "/Recording/#{recording_id}/", params) end |
#get_recordings(params = {}) ⇒ Object
Recordings ##
385 386 387 |
# File 'lib/plivo.rb', line 385 def get_recordings(params={}) return request('GET', "/Recording/", params) end |
#get_subaccount(params = {}) ⇒ Object
122 123 124 125 |
# File 'lib/plivo.rb', line 122 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
114 115 116 |
# File 'lib/plivo.rb', line 114 def get_subaccounts(params={}) return request('GET', "/Subaccount/", params) end |
#hangup_all_calls(params = {}) ⇒ Object
244 245 246 |
# File 'lib/plivo.rb', line 244 def hangup_all_calls(params={}) return request('DELETE', "/Call/", params) end |
#hangup_all_conferences(params = {}) ⇒ Object
305 306 307 |
# File 'lib/plivo.rb', line 305 def hangup_all_conferences(params={}) return request('DELETE', "/Conference/", params) end |
#hangup_call(params = {}) ⇒ Object
253 254 255 256 |
# File 'lib/plivo.rb', line 253 def hangup_call(params={}) call_uuid = params.delete('call_uuid') return request('DELETE', "/Call/#{call_uuid}/", params) end |
#hangup_conference(params = {}) ⇒ Object
314 315 316 317 |
# File 'lib/plivo.rb', line 314 def hangup_conference(params={}) conference_name = params.delete('conference_name') return request('DELETE', "/Conference/#{conference_name}/", params) end |
#hangup_member(params = {}) ⇒ Object
319 320 321 322 323 |
# File 'lib/plivo.rb', line 319 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 ##
295 296 297 298 |
# File 'lib/plivo.rb', line 295 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
368 369 370 371 372 |
# File 'lib/plivo.rb', line 368 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
194 195 196 197 |
# File 'lib/plivo.rb', line 194 def link_application_number(params={}) number = params.delete("number") return request('POST', "/Number/#{number}/", params) end |
#make_call(params = {}) ⇒ Object
240 241 242 |
# File 'lib/plivo.rb', line 240 def make_call(params={}) return request('POST', "/Call/", params) end |
#modify_account(params = {}) ⇒ Object
110 111 112 |
# File 'lib/plivo.rb', line 110 def modify_account(params={}) return request('POST', "/", params) end |
#modify_application(params = {}) ⇒ Object
151 152 153 154 |
# File 'lib/plivo.rb', line 151 def modify_application(params={}) app_id = params.delete("app_id") return request('POST', "/Application/#{app_id}/", params) end |
#modify_endpoint(params = {}) ⇒ Object
413 414 415 416 |
# File 'lib/plivo.rb', line 413 def modify_endpoint(params={}) endpoint_id = params.delete('endpoint_id') return request('POST', "/Endpoint/#{endpoint_id}/", params) end |
#modify_incoming_carrier(params = {}) ⇒ Object
437 438 439 440 |
# File 'lib/plivo.rb', line 437 def modify_incoming_carrier(params={}) carrier_id = params.delete('carrier_id') return request('POST', "/IncomingCarrier/#{carrier_id}/", params) end |
#modify_outgoing_carrier(params = {}) ⇒ Object
461 462 463 464 |
# File 'lib/plivo.rb', line 461 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
485 486 487 488 |
# File 'lib/plivo.rb', line 485 def modify_outgoing_carrier_routing(params={}) routing_id = params.delete('routing_id') return request('POST', "/OutgoingCarrierRouting/#{routing_id}/", params) end |
#modify_subaccount(params = {}) ⇒ Object
127 128 129 130 |
# File 'lib/plivo.rb', line 127 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
356 357 358 359 360 |
# File 'lib/plivo.rb', line 356 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
268 269 270 271 |
# File 'lib/plivo.rb', line 268 def play(params={}) call_uuid = params.delete('call_uuid') return request('POST', "/Call/#{call_uuid}/Play/", params) end |
#play_member(params = {}) ⇒ Object
325 326 327 328 329 |
# File 'lib/plivo.rb', line 325 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 ##
496 497 498 |
# File 'lib/plivo.rb', line 496 def pricing(params={}) return request('GET', "/Pricing/", params) end |
#record(params = {}) ⇒ Object
258 259 260 261 |
# File 'lib/plivo.rb', line 258 def record(params={}) call_uuid = params.delete('call_uuid') return request('POST', "/Call/#{call_uuid}/Record/", params) end |
#record_conference(params = {}) ⇒ Object
374 375 376 377 |
# File 'lib/plivo.rb', line 374 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
214 215 216 217 |
# File 'lib/plivo.rb', line 214 def rent_from_number_group(params={}) group_id = params.delete('group_id') return request('POST', "/AvailableNumberGroup/#{group_id}/", params) end |
#rent_number(params = {}) ⇒ Object
184 185 186 187 |
# File 'lib/plivo.rb', line 184 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 95 96 97 98 99 100 101 102 103 |
# 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) else code = response.http_code response = JSON.parse(response.response.to_s) 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) else code = response.http_code response = JSON.parse(response.response.to_s) 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 else code = response.http_code response = JSON.parse(response.response.to_s) end return [code, ""] end return [405, 'Method Not Supported'] end |
#search_numbers(params = {}) ⇒ Object
175 176 177 |
# File 'lib/plivo.rb', line 175 def search_numbers(params={}) return request('GET', "/AvailableNumber/", params) end |
#search_phone_number(params = {}) ⇒ Object
Numbers ##
162 163 164 |
# File 'lib/plivo.rb', line 162 def search_phone_number(params={}) return request('GET', "/PhoneNumber/", params) end |
#send_digits(params = {}) ⇒ Object
289 290 291 292 |
# File 'lib/plivo.rb', line 289 def send_digits(params={}) call_uuid = params.delete('call_uuid') return request('POST', "/Call/#{call_uuid}/DTMF/", params) end |
#send_message(params = {}) ⇒ Object
Message ##
505 506 507 |
# File 'lib/plivo.rb', line 505 def (params={}) return request('POST', "/Message/", params) end |
#speak(params = {}) ⇒ Object
278 279 280 281 282 |
# File 'lib/plivo.rb', line 278 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
337 338 339 340 341 342 |
# File 'lib/plivo.rb', line 337 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
273 274 275 276 |
# File 'lib/plivo.rb', line 273 def stop_play(params={}) call_uuid = params.delete('call_uuid') return request('DELETE', "/Call/#{call_uuid}/Play/", params) end |
#stop_play_member(params = {}) ⇒ Object
331 332 333 334 335 |
# File 'lib/plivo.rb', line 331 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
263 264 265 266 |
# File 'lib/plivo.rb', line 263 def stop_record(params={}) call_uuid = params.delete('call_uuid') return request('DELETE', "/Call/#{call_uuid}/Record/", params) end |
#stop_record_conference(params = {}) ⇒ Object
379 380 381 382 |
# File 'lib/plivo.rb', line 379 def stop_record_conference(params={}) conference_name = params.delete('conference_name') return request('DELETE', "/Conference/#{conference_name}/Record/", params) end |
#stop_speak(params = {}) ⇒ Object
284 285 286 287 |
# File 'lib/plivo.rb', line 284 def stop_speak(params={}) call_uuid = params.delete('call_uuid') return request('DELETE', "/Call/#{call_uuid}/Speak/", params) end |
#transfer_call(params = {}) ⇒ Object
248 249 250 251 |
# File 'lib/plivo.rb', line 248 def transfer_call(params={}) call_uuid = params.delete('call_uuid') return request('POST', "/Call/#{call_uuid}/", params) end |
#undeaf_member(params = {}) ⇒ Object
350 351 352 353 354 |
# File 'lib/plivo.rb', line 350 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
199 200 201 202 203 |
# File 'lib/plivo.rb', line 199 def unlink_application_number(params={}) number = params.delete("number") params = {"app_id" => ""} return request('POST', "/Number/#{number}/", params) end |
#unmute_member(params = {}) ⇒ Object
362 363 364 365 366 |
# File 'lib/plivo.rb', line 362 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
189 190 191 192 |
# File 'lib/plivo.rb', line 189 def unrent_number(params={}) number = params.delete("number") return request('DELETE', "/Number/#{number}/", params) end |