Class: Punchblock::Component::Record

Inherits:
ComponentNode show all
Defined in:
lib/punchblock/component/record.rb

Defined Under Namespace

Classes: Complete, Pause, Recording, Resume

Instance Attribute Summary

Attributes inherited from ComponentNode

#complete_event

Attributes inherited from RayoNode

#call_id, #client, #component_id, #connection, #original_component

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ComponentNode

#add_event, #initialize, #register_event_handler, #register_initial_handlers, #response=, #stop!, #stop_action, #write_action

Methods inherited from Punchblock::CommandNode

#initialize, #response, #response=, #write_attr

Methods inherited from RayoNode

class_from_registration, #eql?, import, #inspect, register, #source

Constructor Details

This class inherits a constructor from Punchblock::Component::ComponentNode

Class Method Details

.new(options = {}) ⇒ Command::Record

Creates an Rayo Record command

Examples:

record :text => 'Hello brown cow.'

returns:
  <record xmlns="urn:xmpp:rayo:record:1">Hello brown cow.</record>

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :text (String, Optional)

    to speak back

  • :voice (String, Optional)

    with which to render TTS

  • :ssml (String, Optional)

    document to render TTS

Returns:

  • (Command::Record)

    an Rayo “record” command



22
23
24
25
26
# File 'lib/punchblock/component/record.rb', line 22

def self.new(options = {})
  super().tap do |new_node|
    options.each_pair { |k,v| new_node.send :"#{k}=", v }
  end
end

Instance Method Details

#final_timeoutString

Returns the codec to use for recording.

Returns:

  • (String)

    the codec to use for recording



31
32
33
# File 'lib/punchblock/component/record.rb', line 31

def final_timeout
  read_attr :'final-timeout', :to_i
end

#final_timeout=(timeout) ⇒ Object

Parameters:

  • codec (String)

    to use for recording



38
39
40
# File 'lib/punchblock/component/record.rb', line 38

def final_timeout=(timeout)
  write_attr :'final-timeout', timeout
end

#formatString

Returns the codec to use for recording.

Returns:

  • (String)

    the codec to use for recording



45
46
47
# File 'lib/punchblock/component/record.rb', line 45

def format
  read_attr :format
end

#format=(format) ⇒ Object

Parameters:

  • codec (String)

    to use for recording



52
53
54
# File 'lib/punchblock/component/record.rb', line 52

def format=(format)
  write_attr :format, format
end

#initial_timeoutString

Returns the codec to use for recording.

Returns:

  • (String)

    the codec to use for recording



59
60
61
# File 'lib/punchblock/component/record.rb', line 59

def initial_timeout
  read_attr :'initial-timeout', :to_i
end

#initial_timeout=(timeout) ⇒ Object

Parameters:

  • codec (String)

    to use for recording



66
67
68
# File 'lib/punchblock/component/record.rb', line 66

def initial_timeout=(timeout)
  write_attr :'initial-timeout', timeout
end

#inspect_attributesObject

:nodoc:



126
127
128
# File 'lib/punchblock/component/record.rb', line 126

def inspect_attributes # :nodoc:
  [:final_timeout, :format, :initial_timeout, :max_duration, :start_beep, :start_paused, :stop_beep] + super
end

#max_durationString

Returns the codec to use for recording.

Returns:

  • (String)

    the codec to use for recording



73
74
75
# File 'lib/punchblock/component/record.rb', line 73

def max_duration
  read_attr :'max-duration', :to_i
end

#max_duration=(other) ⇒ Object

Parameters:

  • codec (String)

    to use for recording



80
81
82
# File 'lib/punchblock/component/record.rb', line 80

def max_duration=(other)
  write_attr :'max-duration', other
end

#pause!Object

Sends an Rayo pause message for the current Record

Raises:



156
157
158
159
160
161
162
# File 'lib/punchblock/component/record.rb', line 156

def pause!
  raise InvalidActionError, "Cannot pause a Record that is not executing" unless executing?
  pause_action.tap do |action|
    result = write_action action
    paused! if result
  end
end

#pause_actionCommand::Record::Pause

Pauses a running Record

Examples:

record_obj.pause_action.to_xml

returns:
  <pause xmlns="urn:xmpp:rayo:record:1"/>

Returns:

  • (Command::Record::Pause)

    an Rayo pause message for the current Record



149
150
151
# File 'lib/punchblock/component/record.rb', line 149

def pause_action
  Pause.new :component_id => component_id, :call_id => call_id
end

#resume!Object

Sends an Rayo resume message for the current Record

Raises:



181
182
183
184
185
186
187
# File 'lib/punchblock/component/record.rb', line 181

def resume!
  raise InvalidActionError, "Cannot resume a Record that is not paused." unless paused?
  resume_action.tap do |action|
    result = write_action action
    resumed! if result
  end
end

#resume_actionCommand::Record::Resume

Create an Rayo resume message for the current Record

Examples:

record_obj.resume_action.to_xml

returns:
  <resume xmlns="urn:xmpp:rayo:record:1"/>

Returns:

  • (Command::Record::Resume)

    an Rayo resume message



174
175
176
# File 'lib/punchblock/component/record.rb', line 174

def resume_action
  Resume.new :component_id => component_id, :call_id => call_id
end

#start_beepString

Returns the codec to use for recording.

Returns:

  • (String)

    the codec to use for recording



87
88
89
# File 'lib/punchblock/component/record.rb', line 87

def start_beep
  read_attr(:'start-beep') == 'true'
end

#start_beep=(sb) ⇒ Object

Parameters:

  • codec (String)

    to use for recording



94
95
96
# File 'lib/punchblock/component/record.rb', line 94

def start_beep=(sb)
  write_attr :'start-beep', sb
end

#start_pausedString

Returns the codec to use for recording.

Returns:

  • (String)

    the codec to use for recording



115
116
117
# File 'lib/punchblock/component/record.rb', line 115

def start_paused
  read_attr(:'start-paused') == 'true'
end

#start_paused=(other) ⇒ Object

Parameters:

  • codec (String)

    to use for recording



122
123
124
# File 'lib/punchblock/component/record.rb', line 122

def start_paused=(other)
  write_attr :'start-paused', other
end

#stop_beepString

Returns the codec to use for recording.

Returns:

  • (String)

    the codec to use for recording



101
102
103
# File 'lib/punchblock/component/record.rb', line 101

def stop_beep
  read_attr(:'stop-beep') == 'true'
end

#stop_beep=(sb) ⇒ Object

Parameters:

  • codec (String)

    to use for recording



108
109
110
# File 'lib/punchblock/component/record.rb', line 108

def stop_beep=(sb)
  write_attr :'stop-beep', sb
end