Class: Punchblock::Command::Reject
- Inherits:
-
Punchblock::CommandNode
- Object
- Niceogiri::XML::Node
- RayoNode
- Punchblock::CommandNode
- Punchblock::Command::Reject
- Includes:
- HasHeaders
- Defined in:
- lib/punchblock/command/reject.rb
Constant Summary collapse
- VALID_REASONS =
[:busy, :decline, :error].freeze
Constants inherited from RayoNode
Instance Attribute Summary
Attributes inherited from RayoNode
#client, #component_id, #connection, #domain, #original_component, #target_call_id, #target_mixer_name
Class Method Summary collapse
-
.new(options = {}) ⇒ Command::Reject
Create a Rayo reject command.
Instance Method Summary collapse
-
#inspect_attributes ⇒ Object
:nodoc:.
-
#reason ⇒ Symbol
The reason type for rejecting a call.
-
#reason=(reject_reason) ⇒ Object
Set the reason for rejecting the call.
Methods included from HasHeaders
#headers, #headers=, #headers_hash
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::CommandNode
Class Method Details
.new(options = {}) ⇒ Command::Reject
Create a Rayo reject command
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/punchblock/command/reject.rb', line 29 def self.new( = {}) super().tap do |new_node| case when Nokogiri::XML::Node new_node.inherit when Hash .each_pair { |k,v| new_node.send :"#{k}=", v } end end end |
Instance Method Details
#inspect_attributes ⇒ Object
:nodoc:
63 64 65 |
# File 'lib/punchblock/command/reject.rb', line 63 def inspect_attributes # :nodoc: [:reason] + super end |
#reason ⇒ Symbol
Returns the reason type for rejecting a call.
43 44 45 46 |
# File 'lib/punchblock/command/reject.rb', line 43 def reason node = reason_node node ? node.name.to_sym : nil end |
#reason=(reject_reason) ⇒ Object
Set the reason for rejecting the call
55 56 57 58 59 60 61 |
# File 'lib/punchblock/command/reject.rb', line 55 def reason=(reject_reason) if reject_reason && !VALID_REASONS.include?(reject_reason.to_sym) raise ArgumentError, "Invalid Reason (#{reject_reason}), use: #{VALID_REASONS*' '}" end children.each(&:remove) self << RayoNode.new(reject_reason) if reject_reason end |