Class: VoiceML::Queue

Inherits:
Object
  • Object
show all
Defined in:
lib/voiceml/models/queues.rb

Overview

A Twilio-compatible Queue resource.

Constant Summary collapse

ATTRIBUTES =
%w[
  sid account_sid friendly_name current_size max_size
  average_wait_time date_created date_updated uri
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Queue

Returns a new instance of Queue.



15
16
17
18
19
20
# File 'lib/voiceml/models/queues.rb', line 15

def initialize(attrs = {})
  ATTRIBUTES.each do |field|
    value = attrs.key?(field) ? attrs[field] : attrs[field.to_sym]
    instance_variable_set("@#{field}", value)
  end
end

Class Method Details

.from_hash(hash) ⇒ Object



22
23
24
25
26
# File 'lib/voiceml/models/queues.rb', line 22

def self.from_hash(hash)
  return nil if hash.nil?

  new(hash)
end