Class: Connfu::Provisioning::Voice
- 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
-
#privacy ⇒ Object
Identifies if the conference is open to any phone number or users must be whitelisted to join the conference.
-
#rejected_message ⇒ Object
rejected message for invalid users while trying to join the conference.
-
#topic ⇒ Object
current topic.
-
#welcome_message ⇒ Object
welcome message for valid users while joining the conference.
Attributes inherited from Channel
#channel_type, #created_at, #uid, #updated_at
Class Method Summary collapse
-
.unmarshal(data) ⇒ Object
Creates a Voice object or an Array using a Hash values.
Instance Method Summary collapse
- #<<(phone) ⇒ Object
-
#initialize(params) ⇒ Voice
constructor
A new instance of Voice.
-
#phone_number ⇒ Object
Retrieves the phone numbers.
- #phones ⇒ Object
- #phones=(_phones) ⇒ Object
- #to_hash ⇒ Object
-
#whitelist ⇒ Object
access the Voice channel Whitelist.
Methods inherited from Channel
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
#privacy ⇒ Object
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_message ⇒ Object
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 end |
#topic ⇒ Object
current topic
27 28 29 |
# File 'lib/connfu/provisioning/voice.rb', line 27 def topic @topic end |
#welcome_message ⇒ Object
welcome message for valid users while joining the conference
30 31 32 |
# File 'lib/connfu/provisioning/voice.rb', line 30 def @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_number ⇒ Object
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 |
#phones ⇒ Object
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_hash ⇒ Object
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 |