Class: Interfacets::Client::Channels::SpeechToText::Builder
- Inherits:
-
Object
- Object
- Interfacets::Client::Channels::SpeechToText::Builder
- Defined in:
- lib/interfacets/client/channels/speech_to_text.rb
Instance Attribute Summary collapse
-
#entity ⇒ Object
Returns the value of attribute entity.
-
#facet ⇒ Object
Returns the value of attribute facet.
Instance Method Summary collapse
- #callbacks ⇒ Object
- #event ⇒ Object
- #flush_event ⇒ Object
-
#initialize ⇒ Builder
constructor
A new instance of Builder.
- #record(on_done: ->(*, **) {}, on_progress: ->(*,**) {}, on_submit: ->(*, **) {}) ⇒ Object
Constructor Details
#initialize ⇒ Builder
Returns a new instance of Builder.
15 16 17 18 |
# File 'lib/interfacets/client/channels/speech_to_text.rb', line 15 def initialize @event = {} @callbacks = {} end |
Instance Attribute Details
#entity ⇒ Object
Returns the value of attribute entity.
13 14 15 |
# File 'lib/interfacets/client/channels/speech_to_text.rb', line 13 def entity @entity end |
#facet ⇒ Object
Returns the value of attribute facet.
12 13 14 |
# File 'lib/interfacets/client/channels/speech_to_text.rb', line 12 def facet @facet end |
Instance Method Details
#callbacks ⇒ Object
41 42 43 |
# File 'lib/interfacets/client/channels/speech_to_text.rb', line 41 def callbacks @callbacks ||= {} end |
#event ⇒ Object
45 46 47 |
# File 'lib/interfacets/client/channels/speech_to_text.rb', line 45 def event @event ||= {} end |
#flush_event ⇒ Object
20 21 22 |
# File 'lib/interfacets/client/channels/speech_to_text.rb', line 20 def flush_event @event.tap { @event = {} } end |
#record(on_done: ->(*, **) {}, on_progress: ->(*,**) {}, on_submit: ->(*, **) {}) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/interfacets/client/channels/speech_to_text.rb', line 24 def record( on_done: ->(*, **) {}, on_progress: ->(*,**) {}, on_submit: ->(*, **) {} ) id = SecureRandom.uuid @event = { id:, type: "record", } @callbacks[id] = { on_progress:, on_done:, on_submit:, } end |