Sha256: 817de5420ca30a968d99469aa9200afd8a86447edd02fb5e5447d3347017c38c
Contents?: true
Size: 1.18 KB
Versions: 4
Compression:
Stored size: 1.18 KB
Contents
module Connfu module Provisioning ## # This class models a conference whitelist class Whitelist # WhitelistUser array attr_accessor :users # Conference phone attr_reader :voice def initialize(voice, users = []) @voice = voice @users = users end # Iterator based on users array def each users.each{|user| yield user } end def to_s value = [] self.instance_variables.each { |var| value << "#{var}: #{self.instance_variable_get(var)}" } value.join("\n").to_s end ## # Creates a Whitelist object using the raw data from the provisioning API # ==== Parameters # * +voice+ voice channel unique identifier # * +data+ raw data retrieved using the connFu API def self.unmarshal(voice, data) if data.is_a?(Array) numbers = [] data.each { |number| numbers << WhitelistUser.new(*number.values) } users = numbers else users = [WhitelistUser.new(*data.values)] end Whitelist.new(voice, users) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems