Class: Connfu::Provisioning::Voice

Inherits:
Channel
  • Object
show all
Defined in:
lib/connfu/provisioning/voice.rb

Overview

This class models a connFu Voice channel

Defined Under Namespace

Classes: Privacy

Constant Summary collapse

UPDATE_ATTRIBUTES =

Voice channel attributes that could be updated

["topic", "welcome_message", "rejected_message", "privacy", "type"]

Instance Attribute Summary collapse

Attributes inherited from Channel

#channel_type, #created_at, #uid, #updated_at

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Channel

#to_s

Constructor Details

#initialize(params) ⇒ Voice

Returns a new instance of Voice.



39
40
41
42
# File 'lib/connfu/provisioning/voice.rb', line 39

def initialize(params)
  super(params)
  self.channel_type = "voice"
end

Instance Attribute Details

#privacyObject

Identifies if the conference is open to any phone number or users must be whitelisted to join the conference



37
38
39
# File 'lib/connfu/provisioning/voice.rb', line 37

def privacy
  @privacy
end

#rejected_messageObject

rejected message for invalid users while trying to join the conference



33
34
35
# File 'lib/connfu/provisioning/voice.rb', line 33

def rejected_message
  @rejected_message
end

#topicObject

current topic



27
28
29
# File 'lib/connfu/provisioning/voice.rb', line 27

def topic
  @topic
end

#welcome_messageObject

welcome message for valid users while joining the conference



30
31
32
# File 'lib/connfu/provisioning/voice.rb', line 30

def welcome_message
  @welcome_message
end

Class Method Details

.unmarshal(data) ⇒ Object

Creates a Voice object or an Array using a Hash values



73
74
75
76
77
78
79
80
81
82
83
# File 'lib/connfu/provisioning/voice.rb', line 73

def unmarshal(data)
  obj = super(data)
  if obj.is_a?(Array) # more than one element
    obj.each { |voice|
      voice.phones = voice.phones.map { |phone| Phone.new(voice.uid, phone["phone_number"], phone["country"]) }
    }
  else # one element
    obj.phones = obj.phones.map { |phone| Phone.new(obj.uid, phone["phone_number"], phone["country"]) }
    obj
  end
end

Instance Method Details

#<<(phone) ⇒ Object



66
67
68
# File 'lib/connfu/provisioning/voice.rb', line 66

def <<(phone)
  phones << phone
end

#phone_numberObject

Retrieves the phone numbers



54
55
56
# File 'lib/connfu/provisioning/voice.rb', line 54

def phone_number
  values = phones.collect{|phone| phone[:phone_number]}
end

#phonesObject



58
59
60
# File 'lib/connfu/provisioning/voice.rb', line 58

def phones
  @phones||=[]
end

#phones=(_phones) ⇒ Object



62
63
64
# File 'lib/connfu/provisioning/voice.rb', line 62

def phones=(_phones)
  @phones=_phones
end

#to_hashObject



44
45
46
# File 'lib/connfu/provisioning/voice.rb', line 44

def to_hash
  {"uid" => uid, "channel_type" => channel_type, "phones" => phones.map(&:to_hash)}
end

#whitelistObject

access the Voice channel Whitelist



49
50
51
# File 'lib/connfu/provisioning/voice.rb', line 49

def whitelist
  Whitelist.new(@name)
end