Class: Twilio::TaskRouter::WorkflowRule
- Inherits:
-
Object
- Object
- Twilio::TaskRouter::WorkflowRule
- Defined in:
- lib/twilio-ruby/task_router/workflow_builder.rb
Class Method Summary collapse
Instance Method Summary collapse
- #expression ⇒ Object
- #friendly_name ⇒ Object
-
#initialize(expression, targets, friendly_name = nil) ⇒ WorkflowRule
constructor
A new instance of WorkflowRule.
- #targets ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(expression, targets, friendly_name = nil) ⇒ WorkflowRule
Returns a new instance of WorkflowRule.
46 47 48 49 50 |
# File 'lib/twilio-ruby/task_router/workflow_builder.rb', line 46 def initialize(expression, targets, friendly_name=nil) @expression = expression @targets = targets @friendly_name = friendly_name end |
Class Method Details
.parse_json(rule) ⇒ Object
77 78 79 80 81 82 83 |
# File 'lib/twilio-ruby/task_router/workflow_builder.rb', line 77 def self.parse_json(rule) targets = Array.new rule['targets'].each do |target| targets.push(Twilio::TaskRouter::WorkflowRuleTarget.parse_json(target)) end Twilio::TaskRouter::WorkflowRule.new rule['expression'], targets, rule['friendly_name'] end |
Instance Method Details
#expression ⇒ Object
52 53 54 |
# File 'lib/twilio-ruby/task_router/workflow_builder.rb', line 52 def expression @expression end |
#friendly_name ⇒ Object
60 61 62 |
# File 'lib/twilio-ruby/task_router/workflow_builder.rb', line 60 def friendly_name @friendly_name end |
#targets ⇒ Object
56 57 58 |
# File 'lib/twilio-ruby/task_router/workflow_builder.rb', line 56 def targets @targets end |
#to_json ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/twilio-ruby/task_router/workflow_builder.rb', line 64 def to_json rule = {expression: @expression} ruleTargets = Array.new @targets.each do |target| ruleTargets.push(target.to_json) end rule['targets'] = ruleTargets unless @friendly_name.nil? rule['friendly_name'] = @friendly_name end rule end |