Class: Ari::Bridge
- Defined in:
- lib/ari/resources/bridge.rb
Instance Attribute Summary collapse
-
#bridge_class ⇒ Object
readonly
Returns the value of attribute bridge_class.
-
#bridge_type ⇒ Object
readonly
Returns the value of attribute bridge_type.
-
#channels ⇒ Object
readonly
Returns the value of attribute channels.
-
#creator ⇒ Object
readonly
Returns the value of attribute creator.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#technology ⇒ Object
readonly
Returns the value of attribute technology.
Class Method Summary collapse
-
.add_channel(options = {}) ⇒ Object
POST /bridges/%bridgeId/addChannel.
-
.addChannel ⇒ Object
POST /bridges/%bridgeId/addChannel.
-
.create(options = {}) ⇒ Object
POST /bridges.
-
.create_with_id(options = {}) ⇒ Object
POST /bridges/%bridgeId.
-
.createWithId ⇒ Object
POST /bridges/%bridgeId.
-
.destroy(options = {}) ⇒ Object
DELETE /bridges/%bridgeId.
-
.get(options = {}) ⇒ Object
GET /bridges/%bridgeId.
-
.list(options = {}) ⇒ Object
GET /bridges.
-
.play(options = {}) ⇒ Object
POST /bridges/%bridgeId/play.
-
.play_with_id(options = {}) ⇒ Object
POST /bridges/%bridgeId/play/%playbackId.
-
.playWithId ⇒ Object
POST /bridges/%bridgeId/play/%playbackId.
-
.record(options = {}) ⇒ Object
POST /bridges/%bridgeId/record.
-
.remove_channel(options = {}) ⇒ Object
POST /bridges/%bridgeId/removeChannel.
-
.removeChannel ⇒ Object
POST /bridges/%bridgeId/removeChannel.
-
.start_moh(options = {}) ⇒ Object
POST /bridges/%bridgeId/moh.
-
.startMoh ⇒ Object
POST /bridges/%bridgeId/moh.
-
.stop_moh(options = {}) ⇒ Object
DELETE /bridges/%bridgeId/moh.
-
.stopMoh ⇒ Object
DELETE /bridges/%bridgeId/moh.
Instance Method Summary collapse
- #add_channel(options = {}) ⇒ Object
- #create_with_id(options = {}) ⇒ Object
- #destroy(options = {}) ⇒ Object
- #get(options = {}) ⇒ Object
- #play(options = {}) ⇒ Object
- #play_with_id(options = {}) ⇒ Object
- #record(options = {}) ⇒ Object
- #remove_channel(options = {}) ⇒ Object
- #start_moh(options = {}) ⇒ Object
- #stop_moh(options = {}) ⇒ Object
Methods inherited from Resource
#add_listener, client, #client, #remove_all_listeners!, #remove_listener
Methods inherited from Model
Constructor Details
This class inherits a constructor from Ari::Model
Instance Attribute Details
#bridge_class ⇒ Object (readonly)
Returns the value of attribute bridge_class.
15 16 17 |
# File 'lib/ari/resources/bridge.rb', line 15 def bridge_class @bridge_class end |
#bridge_type ⇒ Object (readonly)
Returns the value of attribute bridge_type.
15 16 17 |
# File 'lib/ari/resources/bridge.rb', line 15 def bridge_type @bridge_type end |
#channels ⇒ Object (readonly)
Returns the value of attribute channels.
15 16 17 |
# File 'lib/ari/resources/bridge.rb', line 15 def channels @channels end |
#creator ⇒ Object (readonly)
Returns the value of attribute creator.
15 16 17 |
# File 'lib/ari/resources/bridge.rb', line 15 def creator @creator end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
15 16 17 |
# File 'lib/ari/resources/bridge.rb', line 15 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
15 16 17 |
# File 'lib/ari/resources/bridge.rb', line 15 def name @name end |
#technology ⇒ Object (readonly)
Returns the value of attribute technology.
15 16 17 |
# File 'lib/ari/resources/bridge.rb', line 15 def technology @technology end |
Class Method Details
.add_channel(options = {}) ⇒ Object
POST /bridges/%bridgeId/addChannel
Add a channel to a bridge
Parameters:
bridgeId (required) - Bridge’s id channel (required) - Ids of channels to add to bridge role - Channel’s role in the bridge
121 122 123 124 125 126 |
# File 'lib/ari/resources/bridge.rb', line 121 def self.add_channel( = {}) raise ArgumentError.new("Parameter bridgeId must be passed in options hash.") unless [:bridgeId] raise ArgumentError.new("Parameter channel must be passed in options hash.") unless [:channel] path = '/bridges/%{bridgeId}/addChannel' % response = client().post(path, ) end |
.addChannel ⇒ Object
POST /bridges/%bridgeId/addChannel
Add a channel to a bridge
Parameters:
bridgeId (required) - Bridge’s id channel (required) - Ids of channels to add to bridge role - Channel’s role in the bridge
127 128 129 130 131 132 |
# File 'lib/ari/resources/bridge.rb', line 127 def self.add_channel( = {}) raise ArgumentError.new("Parameter bridgeId must be passed in options hash.") unless [:bridgeId] raise ArgumentError.new("Parameter channel must be passed in options hash.") unless [:channel] path = '/bridges/%{bridgeId}/addChannel' % response = client().post(path, ) end |
.create(options = {}) ⇒ Object
POST /bridges
Active bridges
Parameters:
type - Comma separated list of bridge type attributes (mixing, holding, dtmf_events, proxy_media). bridgeId - Unique ID to give to the bridge being created. name - Name to give to the bridge being created.
40 41 42 43 44 |
# File 'lib/ari/resources/bridge.rb', line 40 def self.create( = {}) path = '/bridges' response = client().post(path, ) Bridge.new(response.merge(client: [:client])) end |
.create_with_id(options = {}) ⇒ Object
POST /bridges/%bridgeId
Individual bridge
Parameters:
type - Comma separated list of bridge type attributes (mixing, holding, dtmf_events, proxy_media) to set. bridgeId (required) - Unique ID to give to the bridge being created. name - Set the name of the bridge.
57 58 59 60 61 62 |
# File 'lib/ari/resources/bridge.rb', line 57 def self.create_with_id( = {}) raise ArgumentError.new("Parameter bridgeId must be passed in options hash.") unless [:bridgeId] path = '/bridges/%{bridgeId}' % response = client().post(path, ) Bridge.new(response.merge(client: [:client])) end |
.createWithId ⇒ Object
POST /bridges/%bridgeId
Individual bridge
Parameters:
type - Comma separated list of bridge type attributes (mixing, holding, dtmf_events, proxy_media) to set. bridgeId (required) - Unique ID to give to the bridge being created. name - Set the name of the bridge.
63 64 65 66 67 68 |
# File 'lib/ari/resources/bridge.rb', line 63 def self.create_with_id( = {}) raise ArgumentError.new("Parameter bridgeId must be passed in options hash.") unless [:bridgeId] path = '/bridges/%{bridgeId}' % response = client().post(path, ) Bridge.new(response.merge(client: [:client])) end |
.destroy(options = {}) ⇒ Object
DELETE /bridges/%bridgeId
Individual bridge
Parameters:
bridgeId (required) - Bridge’s id
98 99 100 101 102 103 104 |
# File 'lib/ari/resources/bridge.rb', line 98 def self.destroy( = {}) raise ArgumentError.new("Parameter bridgeId must be passed in options hash.") unless [:bridgeId] path = '/bridges/%{bridgeId}' % response = client().delete(path, ) rescue Ari::RequestError => e raise unless e.code == '404' end |
.get(options = {}) ⇒ Object
GET /bridges/%bridgeId
Individual bridge
Parameters:
bridgeId (required) - Bridge’s id
78 79 80 81 82 83 |
# File 'lib/ari/resources/bridge.rb', line 78 def self.get( = {}) raise ArgumentError.new("Parameter bridgeId must be passed in options hash.") unless [:bridgeId] path = '/bridges/%{bridgeId}' % response = client().get(path, ) Bridge.new(response.merge(client: [:client])) end |
.list(options = {}) ⇒ Object
GET /bridges
Active bridges
23 24 25 26 27 |
# File 'lib/ari/resources/bridge.rb', line 23 def self.list( = {}) path = '/bridges' response = client().get(path, ) response.map { |hash| Bridge.new(hash.merge(client: [:client])) } end |
.play(options = {}) ⇒ Object
POST /bridges/%bridgeId/play
Play media to the participants of a bridge
Parameters:
bridgeId (required) - Bridge’s id media (required) - Media’s URI to play. lang - For sounds, selects language for sound. offsetms - Number of media to skip before playing. skipms - Number of milliseconds to skip for forward/reverse operations. playbackId - Playback Id.
212 213 214 215 216 217 218 |
# File 'lib/ari/resources/bridge.rb', line 212 def self.play( = {}) raise ArgumentError.new("Parameter bridgeId must be passed in options hash.") unless [:bridgeId] raise ArgumentError.new("Parameter media must be passed in options hash.") unless [:media] path = '/bridges/%{bridgeId}/play' % response = client().post(path, ) Playback.new(response.merge(client: [:client])) end |
.play_with_id(options = {}) ⇒ Object
POST /bridges/%bridgeId/play/%playbackId
Play media to a bridge
Parameters:
bridgeId (required) - Bridge’s id playbackId (required) - Playback ID. media (required) - Media’s URI to play. lang - For sounds, selects language for sound. offsetms - Number of media to skip before playing. skipms - Number of milliseconds to skip for forward/reverse operations.
238 239 240 241 242 243 244 245 |
# File 'lib/ari/resources/bridge.rb', line 238 def self.play_with_id( = {}) raise ArgumentError.new("Parameter bridgeId must be passed in options hash.") unless [:bridgeId] raise ArgumentError.new("Parameter playbackId must be passed in options hash.") unless [:playbackId] raise ArgumentError.new("Parameter media must be passed in options hash.") unless [:media] path = '/bridges/%{bridgeId}/play/%{playbackId}' % response = client().post(path, ) Playback.new(response.merge(client: [:client])) end |
.playWithId ⇒ Object
POST /bridges/%bridgeId/play/%playbackId
Play media to a bridge
Parameters:
bridgeId (required) - Bridge’s id playbackId (required) - Playback ID. media (required) - Media’s URI to play. lang - For sounds, selects language for sound. offsetms - Number of media to skip before playing. skipms - Number of milliseconds to skip for forward/reverse operations.
246 247 248 249 250 251 252 253 |
# File 'lib/ari/resources/bridge.rb', line 246 def self.play_with_id( = {}) raise ArgumentError.new("Parameter bridgeId must be passed in options hash.") unless [:bridgeId] raise ArgumentError.new("Parameter playbackId must be passed in options hash.") unless [:playbackId] raise ArgumentError.new("Parameter media must be passed in options hash.") unless [:media] path = '/bridges/%{bridgeId}/play/%{playbackId}' % response = client().post(path, ) Playback.new(response.merge(client: [:client])) end |
.record(options = {}) ⇒ Object
POST /bridges/%bridgeId/record
Record audio on a bridge
Parameters:
bridgeId (required) - Bridge’s id name (required) - Recording’s filename format (required) - Format to encode audio in maxDurationSeconds - Maximum duration of the recording, in seconds. 0 for no limit. maxSilenceSeconds - Maximum duration of silence, in seconds. 0 for no limit. ifExists - Action to take if a recording with the same name already exists. beep - Play beep when recording begins terminateOn - DTMF input to terminate recording.
268 269 270 271 272 273 274 275 |
# File 'lib/ari/resources/bridge.rb', line 268 def self.record( = {}) raise ArgumentError.new("Parameter bridgeId must be passed in options hash.") unless [:bridgeId] raise ArgumentError.new("Parameter name must be passed in options hash.") unless [:name] raise ArgumentError.new("Parameter format must be passed in options hash.") unless [:format] path = '/bridges/%{bridgeId}/record' % response = client().post(path, ) LiveRecording.new(response.merge(client: [:client])) end |
.remove_channel(options = {}) ⇒ Object
POST /bridges/%bridgeId/removeChannel
Remove a channel from a bridge
Parameters:
bridgeId (required) - Bridge’s id channel (required) - Ids of channels to remove from bridge
143 144 145 146 147 148 |
# File 'lib/ari/resources/bridge.rb', line 143 def self.remove_channel( = {}) raise ArgumentError.new("Parameter bridgeId must be passed in options hash.") unless [:bridgeId] raise ArgumentError.new("Parameter channel must be passed in options hash.") unless [:channel] path = '/bridges/%{bridgeId}/removeChannel' % response = client().post(path, ) end |
.removeChannel ⇒ Object
POST /bridges/%bridgeId/removeChannel
Remove a channel from a bridge
Parameters:
bridgeId (required) - Bridge’s id channel (required) - Ids of channels to remove from bridge
149 150 151 152 153 154 |
# File 'lib/ari/resources/bridge.rb', line 149 def self.remove_channel( = {}) raise ArgumentError.new("Parameter bridgeId must be passed in options hash.") unless [:bridgeId] raise ArgumentError.new("Parameter channel must be passed in options hash.") unless [:channel] path = '/bridges/%{bridgeId}/removeChannel' % response = client().post(path, ) end |
.start_moh(options = {}) ⇒ Object
POST /bridges/%bridgeId/moh
Play music on hold to a bridge
Parameters:
bridgeId (required) - Bridge’s id mohClass - Channel’s id
165 166 167 168 169 |
# File 'lib/ari/resources/bridge.rb', line 165 def self.start_moh( = {}) raise ArgumentError.new("Parameter bridgeId must be passed in options hash.") unless [:bridgeId] path = '/bridges/%{bridgeId}/moh' % response = client().post(path, ) end |
.startMoh ⇒ Object
POST /bridges/%bridgeId/moh
Play music on hold to a bridge
Parameters:
bridgeId (required) - Bridge’s id mohClass - Channel’s id
170 171 172 173 174 |
# File 'lib/ari/resources/bridge.rb', line 170 def self.start_moh( = {}) raise ArgumentError.new("Parameter bridgeId must be passed in options hash.") unless [:bridgeId] path = '/bridges/%{bridgeId}/moh' % response = client().post(path, ) end |
.stop_moh(options = {}) ⇒ Object
DELETE /bridges/%bridgeId/moh
Play music on hold to a bridge
Parameters:
bridgeId (required) - Bridge’s id
185 186 187 188 189 190 191 |
# File 'lib/ari/resources/bridge.rb', line 185 def self.stop_moh( = {}) raise ArgumentError.new("Parameter bridgeId must be passed in options hash.") unless [:bridgeId] path = '/bridges/%{bridgeId}/moh' % response = client().delete(path, ) rescue Ari::RequestError => e raise unless e.code == '404' end |
.stopMoh ⇒ Object
DELETE /bridges/%bridgeId/moh
Play music on hold to a bridge
Parameters:
bridgeId (required) - Bridge’s id
192 193 194 195 196 197 198 |
# File 'lib/ari/resources/bridge.rb', line 192 def self.stop_moh( = {}) raise ArgumentError.new("Parameter bridgeId must be passed in options hash.") unless [:bridgeId] path = '/bridges/%{bridgeId}/moh' % response = client().delete(path, ) rescue Ari::RequestError => e raise unless e.code == '404' end |
Instance Method Details
#add_channel(options = {}) ⇒ Object
129 130 131 |
# File 'lib/ari/resources/bridge.rb', line 129 def add_channel( = {}) self.class.add_channel(.merge(bridgeId: self.id, client: @client)) end |
#create_with_id(options = {}) ⇒ Object
65 66 67 |
# File 'lib/ari/resources/bridge.rb', line 65 def create_with_id( = {}) self.class.create_with_id(.merge(bridgeId: self.id, client: @client)) end |
#destroy(options = {}) ⇒ Object
106 107 108 |
# File 'lib/ari/resources/bridge.rb', line 106 def destroy( = {}) self.class.destroy(.merge(bridgeId: self.id, client: @client)) end |
#get(options = {}) ⇒ Object
85 86 87 |
# File 'lib/ari/resources/bridge.rb', line 85 def get( = {}) self.class.get(.merge(bridgeId: self.id, client: @client)) end |
#play(options = {}) ⇒ Object
220 221 222 |
# File 'lib/ari/resources/bridge.rb', line 220 def play( = {}) self.class.play(.merge(bridgeId: self.id, client: @client)) end |
#play_with_id(options = {}) ⇒ Object
248 249 250 |
# File 'lib/ari/resources/bridge.rb', line 248 def play_with_id( = {}) self.class.play_with_id(.merge(bridgeId: self.id, client: @client)) end |
#record(options = {}) ⇒ Object
277 278 279 |
# File 'lib/ari/resources/bridge.rb', line 277 def record( = {}) self.class.record(.merge(bridgeId: self.id, client: @client)) end |
#remove_channel(options = {}) ⇒ Object
151 152 153 |
# File 'lib/ari/resources/bridge.rb', line 151 def remove_channel( = {}) self.class.remove_channel(.merge(bridgeId: self.id, client: @client)) end |
#start_moh(options = {}) ⇒ Object
172 173 174 |
# File 'lib/ari/resources/bridge.rb', line 172 def start_moh( = {}) self.class.start_moh(.merge(bridgeId: self.id, client: @client)) end |
#stop_moh(options = {}) ⇒ Object
194 195 196 |
# File 'lib/ari/resources/bridge.rb', line 194 def stop_moh( = {}) self.class.stop_moh(.merge(bridgeId: self.id, client: @client)) end |