Class: Twilio::TaskRouter::WorkflowRuleTarget

Inherits:
Object
  • Object
show all
Defined in:
lib/twilio-ruby/task_router/workflow_builder.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(queue, priority = nil, timeout = nil, expression = nil) ⇒ WorkflowRuleTarget

Returns a new instance of WorkflowRuleTarget.



87
88
89
90
91
92
# File 'lib/twilio-ruby/task_router/workflow_builder.rb', line 87

def initialize(queue, priority=nil, timeout=nil, expression=nil)
  @queue = queue
  @priority = priority
  @timeout = timeout
  @expression = expression
end

Class Method Details

.parse_json(target) ⇒ Object



124
125
126
# File 'lib/twilio-ruby/task_router/workflow_builder.rb', line 124

def self.parse_json(target)
  Twilio::TaskRouter::WorkflowRuleTarget.new target['queue'], target['priority'], target['timeout'], target['expression']
end

Instance Method Details

#expressionObject



106
107
108
# File 'lib/twilio-ruby/task_router/workflow_builder.rb', line 106

def expression
  @expression
end

#priorityObject



98
99
100
# File 'lib/twilio-ruby/task_router/workflow_builder.rb', line 98

def priority
  @priority
end

#queueObject



94
95
96
# File 'lib/twilio-ruby/task_router/workflow_builder.rb', line 94

def queue
  @queue
end

#timeoutObject



102
103
104
# File 'lib/twilio-ruby/task_router/workflow_builder.rb', line 102

def timeout
  @timeout
end

#to_jsonObject



110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/twilio-ruby/task_router/workflow_builder.rb', line 110

def to_json
  target = {queue: @queue}
  unless @priority.nil?
    target['priority'] = @priority
  end
  unless @timeout.nil?
    target['timeout'] = @timeout
  end
  unless @expression.nil?
    target['expression'] = @expression
  end
  target
end