Class: Adhearsion::CallController::Output::AbstractPlayer
- Defined in:
- lib/adhearsion/call_controller/output/abstract_player.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#controller ⇒ Object
Returns the value of attribute controller.
Instance Method Summary collapse
-
#initialize(controller) ⇒ AbstractPlayer
constructor
A new instance of AbstractPlayer.
- #new_output(options) ⇒ Object
- #play_ssml(ssml, options = {}) ⇒ Object
- #play_url(url, options = {}) ⇒ Object
Constructor Details
#initialize(controller) ⇒ AbstractPlayer
Returns a new instance of AbstractPlayer.
12 13 14 |
# File 'lib/adhearsion/call_controller/output/abstract_player.rb', line 12 def initialize(controller) @controller = controller end |
Instance Attribute Details
#controller ⇒ Object
Returns the value of attribute controller.
10 11 12 |
# File 'lib/adhearsion/call_controller/output/abstract_player.rb', line 10 def controller @controller end |
Instance Method Details
#new_output(options) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/adhearsion/call_controller/output/abstract_player.rb', line 26 def new_output() defaults = {} default_voice = Adhearsion.config.platform.media.default_voice || Adhearsion.config.punchblock[:default_voice] defaults[:voice] = default_voice if default_voice renderer = Adhearsion.config.platform.media.default_renderer || Adhearsion.config.punchblock[:media_engine] defaults[:renderer] = renderer if renderer Punchblock::Component::Output.new defaults.merge() end |
#play_ssml(ssml, options = {}) ⇒ Object
16 17 18 19 20 |
# File 'lib/adhearsion/call_controller/output/abstract_player.rb', line 16 def play_ssml(ssml, = {}) if [RubySpeech::SSML::Speak, Nokogiri::XML::Document].include? ssml.class output ssml, end end |
#play_url(url, options = {}) ⇒ Object
22 23 24 |
# File 'lib/adhearsion/call_controller/output/abstract_player.rb', line 22 def play_url(url, = {}) output url, .merge(render_document: {url: url, content_type: "application/ssml+xml"}) end |