Class: Bandwidth::Bridge
- Inherits:
-
Object
- Object
- Bandwidth::Bridge
- Extended by:
- ClientWrapper
- Includes:
- ApiItem
- Defined in:
- lib/bandwidth/bridge.rb
Overview
Bridges resource. Bridge two calls allowing two way audio between them.
Class Method Summary collapse
-
.create(client, data) ⇒ Bridge
Create a bridge.
-
.get(client, id) ⇒ Bridge
Get information about an specific bridge.
-
.list(client, query = nil) ⇒ Array
Get a list of previous bridges.
Instance Method Summary collapse
-
#get_calls ⇒ Array
Return calls of current bridge.
-
#play_audio(data) ⇒ Object
Play an audio or speak a sentence in a bridge.
-
#update(data) ⇒ Object
Update a bridge.
Methods included from ClientWrapper
Methods included from ApiItem
#[], #[]=, #initialize, #to_data
Class Method Details
.create(client, data) ⇒ Bridge
Create a bridge
40 41 42 43 44 |
# File 'lib/bandwidth/bridge.rb', line 40 def self.create(client, data) headers = client.make_request(:post, client.concat_user_path(BRIDGE_PATH), data)[1] id = Client.get_id_from_location_header(headers[:location]) self.get(client, id) end |
.get(client, id) ⇒ Bridge
Get information about an specific bridge
15 16 17 18 |
# File 'lib/bandwidth/bridge.rb', line 15 def self.get(client, id) item = client.make_request(:get, client.concat_user_path("#{BRIDGE_PATH}/#{id}"))[0] Bridge.new(item, client) end |
.list(client, query = nil) ⇒ Array
Get a list of previous bridges
27 28 29 30 31 |
# File 'lib/bandwidth/bridge.rb', line 27 def self.list(client, query = nil) client.make_request(:get, client.concat_user_path(BRIDGE_PATH), query)[0].map do |item| Bridge.new(item, client) end end |
Instance Method Details
#get_calls ⇒ Array
Return calls of current bridge
67 68 69 70 71 |
# File 'lib/bandwidth/bridge.rb', line 67 def get_calls() @client.make_request(:get, @client.concat_user_path("#{BRIDGE_PATH}/#{id}/calls"))[0].map do |item| Call.new(item, @client) end end |
#play_audio(data) ⇒ Object
Play an audio or speak a sentence in a bridge
59 60 61 |
# File 'lib/bandwidth/bridge.rb', line 59 def play_audio(data) @client.make_request(:post, @client.concat_user_path("#{BRIDGE_PATH}/#{id}/audio"), data)[0] end |
#update(data) ⇒ Object
Update a bridge
51 52 53 |
# File 'lib/bandwidth/bridge.rb', line 51 def update(data) @client.make_request(:post, @client.concat_user_path("#{BRIDGE_PATH}/#{id}"), data)[0] end |