Class: Voice::Actions::Wait
- Inherits:
-
Object
- Object
- Voice::Actions::Wait
- Defined in:
- lib/vonage/voice/actions/wait.rb
Instance Attribute Summary collapse
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
- #action ⇒ Object
- #after_initialize! ⇒ Object
- #create_wait!(builder) ⇒ Object
-
#initialize(attributes = {}) ⇒ Wait
constructor
A new instance of Wait.
- #validate_timeout ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Wait
Returns a new instance of Wait.
9 10 11 12 13 |
# File 'lib/vonage/voice/actions/wait.rb', line 9 def initialize(attributes = {}) @timeout = attributes.fetch(:timeout, nil) after_initialize! end |
Instance Attribute Details
#timeout ⇒ Object
Returns the value of attribute timeout.
7 8 9 |
# File 'lib/vonage/voice/actions/wait.rb', line 7 def timeout @timeout end |
Instance Method Details
#action ⇒ Object
27 28 29 |
# File 'lib/vonage/voice/actions/wait.rb', line 27 def action create_wait!(self) end |
#after_initialize! ⇒ Object
15 16 17 |
# File 'lib/vonage/voice/actions/wait.rb', line 15 def after_initialize! validate_timeout if self.timeout end |
#create_wait!(builder) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/vonage/voice/actions/wait.rb', line 31 def create_wait!(builder) ncco = [ { action: 'wait' } ] ncco[0].merge!(timeout: builder.timeout) if builder.timeout ncco end |
#validate_timeout ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/vonage/voice/actions/wait.rb', line 19 def validate_timeout timeout = self.timeout raise ClientError.new("Expected 'timeout' parameter to be a number") unless timeout.is_a?(Numeric) self.timeout end |