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_or_update_with_id(options = {}) ⇒ 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_or_update_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
120 121 122 123 124 125 |
# File 'lib/ari/resources/bridge.rb', line 120 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
126 127 128 129 130 131 |
# File 'lib/ari/resources/bridge.rb', line 126 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_or_update_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_or_update_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
97 98 99 100 101 102 103 |
# File 'lib/ari/resources/bridge.rb', line 97 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
77 78 79 80 81 82 |
# File 'lib/ari/resources/bridge.rb', line 77 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.
211 212 213 214 215 216 217 |
# File 'lib/ari/resources/bridge.rb', line 211 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.
237 238 239 240 241 242 243 244 |
# File 'lib/ari/resources/bridge.rb', line 237 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.
245 246 247 248 249 250 251 252 |
# File 'lib/ari/resources/bridge.rb', line 245 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.
267 268 269 270 271 272 273 274 |
# File 'lib/ari/resources/bridge.rb', line 267 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
142 143 144 145 146 147 |
# File 'lib/ari/resources/bridge.rb', line 142 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
148 149 150 151 152 153 |
# File 'lib/ari/resources/bridge.rb', line 148 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
164 165 166 167 168 |
# File 'lib/ari/resources/bridge.rb', line 164 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
169 170 171 172 173 |
# File 'lib/ari/resources/bridge.rb', line 169 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
184 185 186 187 188 189 190 |
# File 'lib/ari/resources/bridge.rb', line 184 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
191 192 193 194 195 196 197 |
# File 'lib/ari/resources/bridge.rb', line 191 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
128 129 130 |
# File 'lib/ari/resources/bridge.rb', line 128 def add_channel( = {}) self.class.add_channel(.merge(bridgeId: self.id, client: @client)) end |
#create_or_update_with_id(options = {}) ⇒ Object
64 65 66 |
# File 'lib/ari/resources/bridge.rb', line 64 def create_or_update_with_id( = {}) self.class.create_or_update_with_id(.merge(bridgeId: self.id, client: @client)) end |
#destroy(options = {}) ⇒ Object
105 106 107 |
# File 'lib/ari/resources/bridge.rb', line 105 def destroy( = {}) self.class.destroy(.merge(bridgeId: self.id, client: @client)) end |
#get(options = {}) ⇒ Object
84 85 86 |
# File 'lib/ari/resources/bridge.rb', line 84 def get( = {}) self.class.get(.merge(bridgeId: self.id, client: @client)) end |
#play(options = {}) ⇒ Object
219 220 221 |
# File 'lib/ari/resources/bridge.rb', line 219 def play( = {}) self.class.play(.merge(bridgeId: self.id, client: @client)) end |
#play_with_id(options = {}) ⇒ Object
247 248 249 |
# File 'lib/ari/resources/bridge.rb', line 247 def play_with_id( = {}) self.class.play_with_id(.merge(bridgeId: self.id, client: @client)) end |
#record(options = {}) ⇒ Object
276 277 278 |
# File 'lib/ari/resources/bridge.rb', line 276 def record( = {}) self.class.record(.merge(bridgeId: self.id, client: @client)) end |
#remove_channel(options = {}) ⇒ Object
150 151 152 |
# File 'lib/ari/resources/bridge.rb', line 150 def remove_channel( = {}) self.class.remove_channel(.merge(bridgeId: self.id, client: @client)) end |
#start_moh(options = {}) ⇒ Object
171 172 173 |
# File 'lib/ari/resources/bridge.rb', line 171 def start_moh( = {}) self.class.start_moh(.merge(bridgeId: self.id, client: @client)) end |
#stop_moh(options = {}) ⇒ Object
193 194 195 |
# File 'lib/ari/resources/bridge.rb', line 193 def stop_moh( = {}) self.class.stop_moh(.merge(bridgeId: self.id, client: @client)) end |